SysDictDataMapper.xml 6.08 KB
<?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="cn.com.polysoft.template.dao.system.SysDictDataMapper">
    <resultMap id="BaseResultMap" type="cn.com.polysoft.template.entity.system.SysDictData">
        <id column="dict_code" jdbcType="VARCHAR" property="dictCode"/>
        <result column="dict_sort" jdbcType="INTEGER" property="dictSort"/>
        <result column="dict_label" jdbcType="VARCHAR" property="dictLabel"/>
        <result column="dict_value" jdbcType="VARCHAR" property="dictValue"/>
        <result column="dict_type" jdbcType="VARCHAR" property="dictType"/>
        <result column="is_default" jdbcType="CHAR" property="isDefault"/>
        <result column="status" jdbcType="CHAR" property="status"/>
        <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
        <result column="create_time" jdbcType="DATE" property="createTime"/>
        <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
        <result column="update_time" jdbcType="DATE" property="updateTime"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
    </resultMap>
    <sql id="Base_Column_List">
        dict_code
        , dict_sort, dict_label, dict_value, dict_type, is_default, "status", create_by,
    create_time, update_by, update_time, remark
    </sql>
    <select id="selectSysDictDataByDictCode" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from "sys_dict_data"
        where dict_code = #{dictCode,jdbcType=VARCHAR}
        ORDER BY dict_sort
    </select>


    <select id="selectSysDictDataByDictType" resultType="cn.com.polysoft.template.entity.system.SysDictData">

        select
        <include refid="Base_Column_List"/>
        from "sys_dict_data"
        where dict_type = #{dictType,jdbcType=VARCHAR}
        ORDER BY dict_sort
    </select>

    <delete id="deleteSysDictDataByDictCode" parameterType="java.lang.String">
        delete
        from "sys_dict_data"
        where dict_code = #{dictCode,jdbcType=VARCHAR}
    </delete>

    <insert id="insertSysDictData" keyColumn="dict_code" keyProperty="dictCode"
            parameterType="cn.com.polysoft.template.entity.system.SysDictData" useGeneratedKeys="true">
        insert into "sys_dict_data"
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dictSort != null">
                dict_sort,
            </if>
            <if test="dictLabel != null">
                dict_label,
            </if>
            <if test="dictValue != null">
                dict_value,
            </if>
            <if test="dictType != null">
                dict_type,
            </if>
            <if test="isDefault != null">
                is_default,
            </if>
            <if test="status != null">
                "status",
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="remark != null">
                remark,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dictSort != null">
                #{dictSort,jdbcType=INTEGER},
            </if>
            <if test="dictLabel != null">
                #{dictLabel,jdbcType=VARCHAR},
            </if>
            <if test="dictValue != null">
                #{dictValue,jdbcType=VARCHAR},
            </if>
            <if test="dictType != null">
                #{dictType,jdbcType=VARCHAR},
            </if>
            <if test="isDefault != null">
                #{isDefault,jdbcType=CHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=CHAR},
            </if>
            <if test="createBy != null">
                #{createBy,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=DATE},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=DATE},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateSysDictData" parameterType="cn.com.polysoft.template.entity.system.SysDictData">
        update "sys_dict_data"
        <set>
            <if test="dictSort != null">
                dict_sort = #{dictSort,jdbcType=INTEGER},
            </if>
            <if test="dictLabel != null">
                dict_label = #{dictLabel,jdbcType=VARCHAR},
            </if>
            <if test="dictValue != null">
                dict_value = #{dictValue,jdbcType=VARCHAR},
            </if>
            <if test="dictType != null">
                dict_type = #{dictType,jdbcType=VARCHAR},
            </if>
            <if test="isDefault != null">
                is_default = #{isDefault,jdbcType=CHAR},
            </if>
            <if test="status != null">
                "status" = #{status,jdbcType=CHAR},
            </if>
            <if test="createBy != null">
                create_by = #{createBy,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=DATE},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=DATE},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
        </set>
        where dict_code = #{dictCode,jdbcType=VARCHAR}
    </update>

</mapper>