FlexValuesMapper.xml 3.86 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.huaheng.pc.config.flexValues.mapper.FlexValuesMapper">
    
    <resultMap type="com.huaheng.pc.config.flexValues.domain.FlexValues" id="flexValuesResult">
        <result property="entryId"    column="entryId"    />
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="number"    column="number"    />
        <result property="flexValueNumber"    column="flexValueNumber"    />
        <result property="flexValueName"    column="flexValueName"    />
        <result property="useOrgId"    column="useOrgId"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
	<sql id="selectflexValuesVo">
        select entryId,id, name, number, flexValueNumber,flexValueName,useOrgId,deleted from flex_values
    </sql>
    <insert id="insertBatch" parameterType="java.util.List">
        INSERT INTO flex_values
        (entryId,id, name, number, flexValueNumber,flexValueName,useOrgId) VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.entryId},#{item.id},#{item.name},#{item.number},#{item.flexValueNumber},#{item.flexValueName},#{item.useOrgId}
            )
        </foreach>
    </insert>

    <update id="modifyBatch" parameterType="java.util.List">
        update flex_values
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="id =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.id!=null">
                        when entryId=#{item.entryId}
                        then #{item.id}
                    </if>
                </foreach>
            </trim>
            <trim prefix="name =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.name!=null">
                        when entryId=#{item.entryId}
                        then #{item.name}
                    </if>
                </foreach>
            </trim>
            <trim prefix="number =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.number!=null">
                        when entryId=#{item.entryId}
                        then #{item.number}
                    </if>
                </foreach>
            </trim>
            <trim prefix="flexValueNumber =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.flexValueNumber!=null">
                        when entryId=#{item.entryId}
                        then #{item.flexValueNumber}
                    </if>
                </foreach>
            </trim>
            <trim prefix="flexValueName =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.flexValueName!=null">
                        when entryId=#{item.entryId}
                        then #{item.flexValueName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="useOrgId =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.useOrgId!=null">
                        when entryId=#{item.entryId}
                        then #{item.useOrgId}
                    </if>
                </foreach>
            </trim>
        </trim>
        where entryId in
        <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
            #{item.entryId}
        </foreach>
    </update>

    <update id="truncateTable">
        truncate table flex_values
    </update>
</mapper>