SmartSysCodeMapper.xml 17.2 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="com.glsx.smart.mapper.SmartSysCodeMapper">
    <resultMap id="BaseResultMap" type="com.glsx.smart.entity.SmartSysCode">
        <!--@mbg.generated-->
        <!--@Table smart_sys_code-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="dict_type" jdbcType="VARCHAR" property="dictType"/>
        <result column="dict_key" jdbcType="VARCHAR" property="dictKey"/>
        <result column="dict_value" jdbcType="VARCHAR" property="dictValue"/>
        <result column="parent_key" jdbcType="VARCHAR" property="parentKey"/>
        <result column="sort" jdbcType="TINYINT" property="sort"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="level" jdbcType="TINYINT" property="level"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, dict_type, dict_key, dict_value, parent_key, sort, `status`, `level`, remark,
        create_time, create_by, update_time, update_by
    </sql>
    <update id="updateBatch" parameterType="java.util.List">
        <!--@mbg.generated-->
        update smart_sys_code
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="dict_type = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.dictType,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="dict_key = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.dictKey,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="dict_value = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.dictValue,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="parent_key = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.parentKey,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="sort = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.sort,jdbcType=TINYINT}
                </foreach>
            </trim>
            <trim prefix="`status` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=TINYINT}
                </foreach>
            </trim>
            <trim prefix="`level` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.level,jdbcType=TINYINT}
                </foreach>
            </trim>
            <trim prefix="remark = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="create_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
                </foreach>
            </trim>
            <trim prefix="create_by = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=BIGINT}
                </foreach>
            </trim>
            <trim prefix="update_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
                </foreach>
            </trim>
            <trim prefix="update_by = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=BIGINT}
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="list" item="item" open="(" separator=", ">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
    <update id="updateBatchSelective" parameterType="java.util.List">
        <!--@mbg.generated-->
        update smart_sys_code
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="dict_type = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.dictType != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.dictType,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="dict_key = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.dictKey != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.dictKey,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="dict_value = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.dictValue != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.dictValue,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="parent_key = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.parentKey != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.parentKey,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sort = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.sort != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.sort,jdbcType=TINYINT}
                    </if>
                </foreach>
            </trim>
            <trim prefix="`status` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.status != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.status,jdbcType=TINYINT}
                    </if>
                </foreach>
            </trim>
            <trim prefix="`level` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.level != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.level,jdbcType=TINYINT}
                    </if>
                </foreach>
            </trim>
            <trim prefix="remark = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.remark != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="create_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.createTime != null">
                        when id = #{item.id,jdbcType=BIGINT} then
                        #{item.createTime,jdbcType=TIMESTAMP}
                    </if>
                </foreach>
            </trim>
            <trim prefix="create_by = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.createBy != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=BIGINT}
                    </if>
                </foreach>
            </trim>
            <trim prefix="update_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.updateTime != null">
                        when id = #{item.id,jdbcType=BIGINT} then
                        #{item.updateTime,jdbcType=TIMESTAMP}
                    </if>
                </foreach>
            </trim>
            <trim prefix="update_by = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.updateBy != null">
                        when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=BIGINT}
                    </if>
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="list" item="item" open="(" separator=", ">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
    <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into smart_sys_code
        (dict_type, dict_key, dict_value, parent_key, sort, `status`, `level`, remark, create_time,
        create_by, update_time, update_by)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.dictType,jdbcType=VARCHAR}, #{item.dictKey,jdbcType=VARCHAR},
            #{item.dictValue,jdbcType=VARCHAR},
            #{item.parentKey,jdbcType=VARCHAR}, #{item.sort,jdbcType=TINYINT},
            #{item.status,jdbcType=TINYINT},
            #{item.level,jdbcType=TINYINT}, #{item.remark,jdbcType=VARCHAR},
            #{item.createTime,jdbcType=TIMESTAMP},
            #{item.createBy,jdbcType=BIGINT}, #{item.updateTime,jdbcType=TIMESTAMP},
            #{item.updateBy,jdbcType=BIGINT}
            )
        </foreach>
    </insert>
    <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.smart.entity.SmartSysCode" useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into smart_sys_code
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            dict_type,
            dict_key,
            dict_value,
            parent_key,
            sort,
            `status`,
            `level`,
            remark,
            create_time,
            create_by,
            update_time,
            update_by,
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            #{dictType,jdbcType=VARCHAR},
            #{dictKey,jdbcType=VARCHAR},
            #{dictValue,jdbcType=VARCHAR},
            #{parentKey,jdbcType=VARCHAR},
            #{sort,jdbcType=TINYINT},
            #{status,jdbcType=TINYINT},
            #{level,jdbcType=TINYINT},
            #{remark,jdbcType=VARCHAR},
            #{createTime,jdbcType=TIMESTAMP},
            #{createBy,jdbcType=BIGINT},
            #{updateTime,jdbcType=TIMESTAMP},
            #{updateBy,jdbcType=BIGINT},
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=BIGINT},
            </if>
            dict_type = #{dictType,jdbcType=VARCHAR},
            dict_key = #{dictKey,jdbcType=VARCHAR},
            dict_value = #{dictValue,jdbcType=VARCHAR},
            parent_key = #{parentKey,jdbcType=VARCHAR},
            sort = #{sort,jdbcType=TINYINT},
            `status` = #{status,jdbcType=TINYINT},
            `level` = #{level,jdbcType=TINYINT},
            remark = #{remark,jdbcType=VARCHAR},
            create_time = #{createTime,jdbcType=TIMESTAMP},
            create_by = #{createBy,jdbcType=BIGINT},
            update_time = #{updateTime,jdbcType=TIMESTAMP},
            update_by = #{updateBy,jdbcType=BIGINT},
        </trim>
    </insert>
    <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.smart.entity.SmartSysCode" useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into smart_sys_code
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="dictType != null and dictType != ''">
                dict_type,
            </if>
            <if test="dictKey != null and dictKey != ''">
                dict_key,
            </if>
            <if test="dictValue != null and dictValue != ''">
                dict_value,
            </if>
            <if test="parentKey != null and parentKey != ''">
                parent_key,
            </if>
            <if test="sort != null">
                sort,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="level != null">
                `level`,
            </if>
            <if test="remark != null and remark != ''">
                remark,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="dictType != null and dictType != ''">
                #{dictType,jdbcType=VARCHAR},
            </if>
            <if test="dictKey != null and dictKey != ''">
                #{dictKey,jdbcType=VARCHAR},
            </if>
            <if test="dictValue != null and dictValue != ''">
                #{dictValue,jdbcType=VARCHAR},
            </if>
            <if test="parentKey != null and parentKey != ''">
                #{parentKey,jdbcType=VARCHAR},
            </if>
            <if test="sort != null">
                #{sort,jdbcType=TINYINT},
            </if>
            <if test="status != null">
                #{status,jdbcType=TINYINT},
            </if>
            <if test="level != null">
                #{level,jdbcType=TINYINT},
            </if>
            <if test="remark != null and remark != ''">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createBy != null">
                #{createBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=BIGINT},
            </if>
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=BIGINT},
            </if>
            <if test="dictType != null and dictType != ''">
                dict_type = #{dictType,jdbcType=VARCHAR},
            </if>
            <if test="dictKey != null and dictKey != ''">
                dict_key = #{dictKey,jdbcType=VARCHAR},
            </if>
            <if test="dictValue != null and dictValue != ''">
                dict_value = #{dictValue,jdbcType=VARCHAR},
            </if>
            <if test="parentKey != null and parentKey != ''">
                parent_key = #{parentKey,jdbcType=VARCHAR},
            </if>
            <if test="sort != null">
                sort = #{sort,jdbcType=TINYINT},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=TINYINT},
            </if>
            <if test="level != null">
                `level` = #{level,jdbcType=TINYINT},
            </if>
            <if test="remark != null and remark != ''">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createBy != null">
                create_by = #{createBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=BIGINT},
            </if>
        </trim>
    </insert>
</mapper>