BosAssistantDetailMapper.xml 3.53 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.bosAssistantDetail.mapper.BosAssistantDetailMapper">

    <resultMap type="com.huaheng.pc.config.bosAssistantDetail.domain.BosAssistantDetail" id="bosAssistantDetailResult">
        <result property="entityId"  jdbcType="INTEGER"  column="entityId"    />
        <result property="id"    column="id"    />
        <result property="number"    column="number"    />
        <result property="dataValue"    column="dataValue"    />
        <result property="documentStatus"    column="documentStatus"    />
        <result property="isSysPreset"    column="isSysPreset"    />
        <result property="description"    column="description"    />
    </resultMap>
    <sql id="selectBosAssistantDetailVo">
        select entityId, id,number, dataValue, documentStatus,isSysPreset,description from bos_assistant_detail
    </sql>
    <select id="selectByNumber" resultType="com.huaheng.pc.config.bosAssistantDetail.domain.BosAssistantDetail">
        <include refid="selectBosAssistantDetailVo"></include>
        <where>
            `number`=#{code} and id=#{id}
        </where>
    </select>
    <insert id="insertBatch" parameterType="java.util.List">
        INSERT INTO bos_assistant_detail
        (entityId,number,id,dataValue,documentStatus,isSysPreset,description) VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.entityId},#{item.number},#{item.id},#{item.dataValue},#{item.documentStatus},#{item.isSysPreset},#{item.description})
        </foreach>
    </insert>

    <update id="modifyBatch" parameterType="java.util.List">
        update bos_assistant_detail
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="description =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.description!=null">
                        when entityId=#{item.entityId}
                        then #{item.description}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isSysPreset =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.isSysPreset!=null">
                        when entityId=#{item.entityId}
                        then #{item.isSysPreset}
                    </if>
                </foreach>
            </trim>
            <trim prefix="dataValue =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.dataValue!=null">
                        when entityId=#{item.entityId}
                        then #{item.dataValue}
                    </if>
                </foreach>
            </trim>
            <trim prefix="documentStatus =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.documentStatus!=null">
                        when entityId=#{item.entityId}
                        then #{item.documentStatus}
                    </if>
                </foreach>
            </trim>
        </trim>
        where entityId in
        <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
            #{item.entityId}
        </foreach>
    </update>

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