wujianwei
2025-08-13 0d4084a24bcba6c1941d997712850af800fb60aa
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?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.ruoyi.cwgl.mapper.EstimatedReceivableLogMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.EstimatedReceivableLog" id="EstimatedReceivableLogResult">
        <result property="id"    column="id"    />
        <result property="estimatedId"    column="estimated_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="operation"    column="operation"    />
    </resultMap>
 
    <sql id="selectEstimatedReceivableLogVo">
        select thisTab.id, thisTab.estimated_id, thisTab.create_by, thisTab.create_time, thisTab.operation from estimated_receivable_log AS thisTab
    </sql>
    <sql id="selectEstimatedReceivableLogVoCount">
        select count(0) from estimated_receivable_log as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="estimatedId != null "> and thisTab.estimated_id = #{estimatedId}</if>
        <if test="operation != null  and operation != ''"> and thisTab.operation = #{operation}</if>
    </sql>
 
    <!--查询-->
    <select id="selectEstimatedReceivableLogById" parameterType="Integer" resultMap="EstimatedReceivableLogResult">
        <include refid="selectEstimatedReceivableLogVo"/>
        where id = #{id}
    </select>
 
    <select id="selectEstimatedReceivableLogCount" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableLog" resultType="int">
        <include refid="selectEstimatedReceivableLogVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectEstimatedReceivableLogList" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableLog" resultMap="EstimatedReceivableLogResult">
        <include refid="selectEstimatedReceivableLogVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertEstimatedReceivableLog" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableLog"  useGeneratedKeys="true" keyProperty="id">
        insert into estimated_receivable_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="estimatedId != null">estimated_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="operation != null">operation,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="estimatedId != null">#{estimatedId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="operation != null">#{operation},</if>
         </trim>
    </insert>
 
    <insert id="insertEstimatedReceivableLogBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into estimated_receivable_log
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,estimated_id,create_by,create_time,operation,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.estimatedId},#{item.createBy},#{item.createTime},#{item.operation},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateEstimatedReceivableLog" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableLog">
        update estimated_receivable_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="estimatedId != null">estimated_id = #{estimatedId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="operation != null">operation = #{operation},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateEstimatedReceivableLogBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update estimated_receivable_log
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.estimatedId != null">estimated_id = #{item.estimatedId},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.operation != null">operation = #{item.operation},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteEstimatedReceivableLogById" parameterType="Integer">
        delete from estimated_receivable_log where id = #{id}
    </delete>
    <delete id="deleteEstimatedReceivableLogByIds" parameterType="Integer">
        delete from estimated_receivable_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>