教育训练处考试制证系统后端
“djh”
2025-04-24 f9cb0f3f384279b2cbe87c35dde3ba573a0197f3
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?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.gkhy.exam.pay.mapper.CoalPayMapper">
    
    <resultMap type="CoalPay" id="CoalPayResult">
        <result property="id"    column="id"    />
        <result property="batchName"    column="batch_name"    />
        <result property="deptId"    column="dept_id"    />
        <result property="payType"    column="pay_type"    />
        <result property="amount"    column="amount"    />
        <result property="year"    column="year"    />
        <result property="quarter"    column="quarter"    />
        <result property="payPersonType"    column="pay_person_type"    />
        <result property="payCompanyName"    column="pay_company_name"    />
        <result property="payCompanyCard"    column="pay_company_card"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
 
    <sql id="selectCoalPayVo">
        select id,
               batch_name,
               dept_id,
               pay_type,
               amount,
               year,
               quarter,
               pay_person_type, pay_company_name, pay_company_card, update_by, update_time, create_by, create_time, del_flag from coal_pay
    </sql>
 
    <insert id="insertBath" parameterType="CoalPay" useGeneratedKeys="true" keyProperty="id">
        insert into coal_pay
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="batchName != null and batchName != ''">batch_name,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="payType != null">pay_type,</if>
            <if test="amount != null">amount,</if>
            <if test="year != null and year != ''">year,</if>
            <if test="quarter != null">quarter,</if>
            <if test="payPersonType != null">pay_person_type,</if>
            <if test="payCompanyName != null">pay_company_name,</if>
            <if test="payCompanyCard != null">pay_company_card,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null">del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="batchName != null and batchName != ''">#{batchName},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="payType != null">#{payType},</if>
            <if test="amount != null">#{amount},</if>
            <if test="year != null and year != ''">#{year},</if>
            <if test="quarter != null">#{quarter},</if>
            <if test="payPersonType != null">#{payPersonType},</if>
            <if test="payCompanyName != null">#{payCompanyName},</if>
            <if test="payCompanyCard != null">#{payCompanyCard},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>
 
    <update id="updateByIds">
        update coal_pay set del_flag=2 where id in
            <foreach item="id" collection="array" open="(" separator="," close=")">
                #{id}
            </foreach>
    </update>
 
    <update id="updateByPayId">
        update  coal_pay
        <trim prefix="SET" suffixOverrides=",">
            <if test="payPersonType != null">pay_person_type = #{payPersonType},</if>
            <if test="payCompanyName != null">pay_company_name = #{payCompanyName},</if>
            <if test="payCompanyCard != null">pay_company_card = #{payCompanyCard},</if>
        </trim>
        where id = #{coalPayId}
    </update>
    <update id="updateCoalPayById">
        update coal_pay
        <trim prefix="SET" suffixOverrides=",">
            <if test="batchName != null and batchName != ''">batch_name = #{batchName},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="payType != null">pay_type = #{payType},</if>
            <if test="amount != null">amount = #{amount},</if>
            <if test="year != null and year != ''">year = #{year},</if>
            <if test="quarter != null">quarter = #{quarter},</if>
            <if test="payPersonType != null">pay_person_type = #{payPersonType},</if>
            <if test="payCompanyName != null">pay_company_name = #{payCompanyName},</if>
            <if test="payCompanyCard != null">pay_company_card = #{payCompanyCard},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
    <select id="selectCoalPayList" resultType="com.gkhy.exam.pay.dto.rep.CoalPayRepDto">
        select id,
        batch_name,
        dept_id,
        pay_type,
        amount,
        year,
        quarter,
        pay_person_type, pay_company_name, pay_company_card, update_by, update_time, create_by, create_time, del_flag ,
        ( SELECT COUNT(cps.id) FROM coal_pay_student cps WHERE cps.del_flag = 0 AND cps.coal_pay_id = coal_pay.id ) AS total_num,
        ( SELECT COUNT(cps.id) FROM coal_pay_student cps WHERE cps.del_flag = 0 AND cps.coal_pay_id = coal_pay.id AND cps.pay_status = 1 ) AS have_pay_num
        from coal_pay
        <where>
            <if test="deptId != null ">
                and dept_id = #{deptId}
            </if>
            <if test="minDate !=null">
                and create_time &gt;= #{minDate}
            </if>
            <if test="maxDate != null">
                and create_time &lt;= #{maxDate}
            </if>
            and del_flag = 0
            order by create_time desc
        </where>
    </select>
 
 
    <!--    <select id="selectCoalPayList" parameterType="CoalPay">-->
<!--        <include refid="selectCoalPayVo"/>-->
<!--        <where>-->
<!--            <if test="deptId != null ">-->
<!--                and dept_id = #{deptId}-->
<!--            </if>-->
<!--            <if test="minDate !=null">-->
<!--                and create_time &gt;= #{minDate}-->
<!--            </if>-->
<!--            <if test="maxDate != null">-->
<!--                and create_time &lt;= #{maxDate}-->
<!--            </if>-->
<!--            and del_flag = 0-->
<!--            order by create_time desc-->
<!--        </where>-->
<!--&lt;!&ndash;    </select>&ndash;&gt;-->
</mapper>