<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.backendsys.modules.system.dao.SysCommonDao">

    <!--<sql id="includeCommon">-->
    <!--    id,-->
    <!--    name,-->
    <!--    COALESCE(description, '') description,-->
    <!--    COALESCE(tag, '') tag,-->
    <!--    COALESCE(value, '') value,-->
    <!--    value_type,-->
    <!--    COALESCE(value_option, '') value_option,-->
    <!--    category,-->
    <!--    COALESCE(sort, '') sort,-->
    <!--    create_time-->
    <!--</sql>-->

    <!--<resultMap id="resultMapCommonList" type="com.backendsys.modules.system.entity.SysCommon">-->
    <!--    <id property="id" column="id" jdbcType="BIGINT" />-->
    <!--    <result property="name" column="name" />-->
    <!--    <result property="description" column="description" />-->
    <!--    <result property="value" column="value" />-->
    <!--    <result property="value_type" column="value_type" />-->
    <!--    <result property="value_option" column="value_option" />-->
    <!--    <result property="category" column="category" />-->
    <!--    <result property="sort" column="sort" javaType="java.lang.Integer" />-->
    <!--    <result property="create_time" column="create_time" />-->
    <!--</resultMap>-->

    <!--<select id="selectSysCommonList" resultMap="resultMapCommonList">-->
    <!--    SELECT <include refid="includeCommon" />-->
    <!--    FROM sys_common-->
    <!--</select>-->

    <update id="updateCommon" parameterType="com.backendsys.modules.system.entity.SysCommon"
            useGeneratedKeys="true" keyProperty="id">
        UPDATE sys_common SET
        <trim suffixOverrides="," suffix=" ">
            <if test="name != null and name != ''">name = #{name},</if>
            <if test="description != null and description != ''">description = #{description},</if>
            <if test="value != null and value != ''">value = #{value},</if>
            <if test="value_type != null and value_type != ''">value_type = #{value_type},</if>
            <if test="value_option != null and value_option != ''">value_option = #{value_option},</if>
            <if test="category != null and category != ''">category = #{category},</if>
            <if test="sort != null and sort != ''">sort = #{sort},</if>
        </trim>
        WHERE id = #{id};
    </update>

</mapper>