fuliqi
2025-01-06 7a93f4097430703dc60c4aee0240ed348a0ab1df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?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.ycl.platform.mapper.CalculateRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.platform.domain.vo.CalculateReportDetailVO">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="deduct_category" property="unitName" />
        <result column="score_condition" property="contractName" />
        <result column="description" property="calculateTime" />
        <result column="deduct_money" property="deductMoney" />
        <result column="score" property="deductMoney" />
        <collection property="recordList" column="contract_id" select="selectByContractId" ofType="com.ycl.platform.domain.vo.CalculateMoneyRuleVO"/>
    </resultMap>
 
    <update id="updateBatch" parameterType="java.util.List">
        update t_calculate_record
        <trim prefix="set" suffixOverrides=","><!-- 表示在生成的 SQL 语句前面添加 set 关键字,并移除末尾逗号 -->
            <trim prefix="deduct_money =case" suffix="end,"><!-- 构造case语法 末尾加上end,如果需要更新多个字段复制这个trim -->
                <foreach collection="list" item="item">
                    when id=#{item.id} then #{item.deductMoney}
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
 
    <update id="batchPublish">
        update t_calculate_record set status = 'publish'
        where contract_id = #{contractId} and which_year =#{whichYear}
    </update>
 
    <update id="updatePublishById">
        update t_calculate_record set status = #{status}
        where id = #{id}
    </update>
</mapper>