教育训练处考试制证系统后端
heheng
2025-02-20 c269821bdd06a8eb452b09c1effe14efd646b9d7
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<?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.NonCoalPayMapper">
 
    <resultMap type="NonCoalPay" id="NonCoalPayResult">
        <result property="id" column="id"/>
        <result property="batchName" column="batch_name"/>
        <result property="deptId" column="dept_id"/>
        <result property="districtCode" column="district_code"/>
        <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>
    <resultMap id="NonCoalPayPageResult" type="com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto"
               extends="NonCoalPayResult">
        <result property="deptName" column="dept_name"/>
        <result property="districtName" column="district_name"/>
        <result property="totalNum" column="total_num"/>
        <result property="havePayNum" column="have_pay_num"/>
    </resultMap>
 
    <resultMap type="com.gkhy.exam.pay.dto.rep.NonCoalPayDetailRepDto" id="getNonCoalPayResult">
        <result property="id" column="id"/>
        <result property="batchName" column="batch_name"/>
        <result property="deptId" column="dept_id"/>
        <result property="deptName" column="dept_name"/>
        <result property="districtCode" column="district_code"/>
        <result property="districtName" column="district_name"/>
        <result property="payType" column="pay_type"/>
        <result property="amount" column="amount"/>
        <result property="year" column="year"/>
        <result property="payPersonType" column="pay_person_type"/>
        <result property="quarter" column="quarter"/>
        <collection property="nonCoalPayCategoryList" javaType="java.util.List" resultMap="nonCoalPayCategoryList"/>
    </resultMap>
    <resultMap id="nonCoalPayCategoryList" type="com.gkhy.exam.pay.dto.rep.NonCoalPayCategoryRepDto">
        <result property="id" column="non_category_id"/>
        <result property="nonCoalPayId" column="non_coal_pay_id"/>
        <result property="categoryId" column="category_id"/>
        <result property="subjectName" column="subject_name"/>
        <result property="categoryType" column="category_type"/>
        <result property="categoryAmount" column="category_amount"/>
    </resultMap>
 
    <resultMap id="getNonCoalPayResultH5" type="com.gkhy.exam.pay.dto.rep.NonCoalPayDetailH5RepDto"
               extends="getNonCoalPayResult">
        <result property="nonCoalStudentId" column="non_coal_student_id"/>
        <result property="phone" column="phone"/>
        <result property="idCard" column="id_card"/>
        <result property="studentName" column="student_name"/>
        <result property="payStatus" column="pay_status"/>
        <result property="govPayStatus" column="gov_pay_status"/>
        <result property="fileData" column="file_data"/>
        <result property="nonCoalPayType" column="non_coal_pay_type"/>
        <result property="orderId" column="order_id"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
 
 
    <sql id="selectNonCoalPayVo">
        select id,
               batch_name,
               dept_id,
               district_code,
               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 non_coal_pay
    </sql>
 
    <select id="selectNonCoalPayList" parameterType="NonCoalPay" resultMap="NonCoalPayResult">
        <include refid="selectNonCoalPayVo"/>
        <where>
            <if test="batchName != null  and batchName != ''">and batch_name like concat('%', #{batchName}, '%')</if>
            <if test="deptId != null ">and dept_id = #{deptId}</if>
            <if test="districtCode != null  and districtCode != ''">and district_code = #{districtCode}</if>
            <if test="payType != null ">and pay_type = #{payType}</if>
            <if test="amount != null ">and amount = #{amount}</if>
            <if test="year != null  and year != ''">and year = #{year}</if>
            <if test="quarter != null ">and quarter = #{quarter}</if>
            <if test="payPersonType != null ">and pay_person_type = #{payPersonType}</if>
            <if test="payCompanyName != null  and payCompanyName != ''">and pay_company_name like concat('%',
                #{payCompanyName}, '%')
            </if>
            <if test="payCompanyCard != null  and payCompanyCard != ''">and pay_company_card = #{payCompanyCard}</if>
        </where>
    </select>
 
 
    <select id="getNonCoalPayList" parameterType="NonCoalPay" resultMap="NonCoalPayPageResult">
        select a.id,
        a.batch_name,
        a.dept_id,
        a.district_code,
        d.dept_name ,
        d2.name as district_name,
        a.pay_type,
        a.amount, a.year, a.quarter, a.pay_person_type, a.pay_company_name, a.pay_company_card, a.update_by,
        a.update_time, a.create_by, a.create_time, (select count(id) from non_coal_pay_student where a.id =
        non_coal_pay_id) as total_num,
        (select count(id) from non_coal_pay_student where a.id = non_coal_pay_id and pay_status = 1) as have_pay_num
        from non_coal_pay a
        left join sys_dept d on a.dept_id = d.dept_id
        left join sys_district d2 on a.district_code = d2.code
        where 1=1 and a.del_flag = 0
        <if test="batchName != null  and batchName != ''">and a.batch_name like concat('%', #{batchName}, '%')</if>
        <if test="deptId != null ">and a.dept_id = #{deptId}</if>
        <if test="districtCode != null  and districtCode != ''">and a.district_code = #{districtCode}</if>
        <if test="payType != null ">and a.pay_type = #{payType}</if>
        <if test="amount != null ">and a.amount = #{amount}</if>
        <if test="year != null  and year != ''">and a.year = #{year}</if>
        <if test="quarter != null ">and a.quarter = #{quarter}</if>
        <if test="payPersonType != null ">and a.pay_person_type = #{payPersonType}</if>
        <if test="payCompanyName != null  and payCompanyName != ''">and a.pay_company_name like concat('%',
            #{payCompanyName}, '%')
        </if>
        <if test="params.startTime != null and params.startTime != ''"><!-- 开始时间检索 -->
            AND a.create_time &gt;= #{params.startTime}
        </if>
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            AND a.create_time &lt;= #{params.endTime}
        </if>
        <if test="payCompanyCard != null  and payCompanyCard != ''">and a.pay_company_card = #{payCompanyCard}</if>
        order by a.create_time desc
    </select>
 
    <select id="selectNonCoalPayById" parameterType="Long" resultMap="NonCoalPayResult">
        <include refid="selectNonCoalPayVo"/>
        where id = #{id}
    </select>
 
 
    <select id="getNonCoalPayById" parameterType="Long" resultMap="getNonCoalPayResult">
        select a.id,
               a.batch_name,
               a.dept_id,
               d2.name as district_name,
               d.dept_name,
               a.district_code,
               a.pay_type,
               a.pay_person_type,
               a.amount,
               a.year,
               a.quarter,
               b.id    as non_category_id,
               b.category_id,
               c.subject_name,
               c.category_type,
               b.category_amount
        from non_coal_pay a
                 inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0
                 left join non_coal_category c on b.category_id = c.id and c.del_flag = 0
                 left join sys_dept d on a.dept_id = d.dept_id
                 left join sys_district d2 on a.district_code = d2.code
        where a.id = #{id}
    </select>
 
    <select id="selectNonCoalPayByParam" resultMap="getNonCoalPayResultH5">
        select a.id,
               a.batch_name,
               a.dept_id,
               d2.name    as district_name,
               d.dept_name,
               a.district_code,
               a.pay_type,
               a.pay_person_type,
               a.amount,
               a.year,
               a.quarter,
               b.id       as non_category_id,
               b.category_id,
               c.subject_name,
               c.category_type,
               b.category_amount,
               t.id       as non_coal_student_id,
               t.phone,
               t.id_card,
               t.name     as student_name,
               t.pay_status,
               t.gov_pay_status,
               t.file_data,
               t.pay_type as non_coal_pay_type,
               t.order_id,
               t.create_time
        from non_coal_pay a
                 inner join non_coal_pay_student t on t.non_coal_pay_id = a.id and t.del_flag = 0
                 inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0
                 left join non_coal_category c on b.category_id = c.id and c.del_flag = 0
                 left join sys_dept d on a.dept_id = d.dept_id
                 left join sys_district d2 on a.district_code = d2.code
        where a.del_flag = 0
          and t.phone = #{phone}
          and t.id_card = #{idCard}
        order by t.pay_status asc, t.create_time desc
 
    </select>
 
    <resultMap type="com.gkhy.exam.pay.dto.rep.NonCoalPayOrder" id="getNonCoalPayResultOrder">
        <result property="id" column="id"/>
        <result property="batchName" column="batch_name"/>
        <result property="amount" column="amount"/>
        <result property="payPersonType" column="pay_person_type"/>
        <result property="payCompanyName" column="pay_company_name"/>
        <result property="payCompanyCard" column="pay_company_card"/>
        <collection property="nonCoalPayCategoryList" javaType="java.util.List"
                    resultMap="nonCoalPayCategoryListOrder"/>
        <collection property="nonCoalStuList" javaType="java.util.List"
                    resultMap="nonCoalPayStuListOrder"/>
    </resultMap>
    <resultMap id="nonCoalPayCategoryListOrder" type="com.gkhy.exam.pay.dto.rep.NonCoalCateRep">
        <result property="id" column="non_category_id"/>
        <result property="businessCode" column="business_code"/>
        <result property="companyCode" column="company_code"/>
        <result property="invoicingCompanyCode" column="invoicing_company_code"/>
        <result property="drawer" column="drawer"/>
        <result property="reviewer" column="reviewer"/>
        <result property="categoryId" column="category_id"/>
        <result property="subjectName" column="subject_name"/>
        <result property="categoryType" column="category_type"/>
        <result property="categoryAmount" column="category_amount"/>
    </resultMap>
 
    <resultMap id="nonCoalPayStuListOrder" type="com.gkhy.exam.pay.dto.rep.NonCoalStuRep">
        <result property="id" column="non_coal_student_id"/>
        <result property="phone" column="phone"/>
        <result property="idCard" column="id_card"/>
        <result property="studentName" column="student_name"/>
        <result property="payStatus" column="pay_status"/>
        <result property="orderId" column="order_id"/>
        <result property="orderNo" column="order_no"/>
        <result property="govPayStatus" column="gov_pay_status"/>
    </resultMap>
 
 
    <select id="selectNonCoalPayOrderByParam" resultMap="getNonCoalPayResultOrder">
        select a.id,
        a.batch_name,
        a.pay_type,
        a.amount,
        a.pay_person_type,
        a.pay_company_name,
        a.pay_company_card,
        b.id as non_category_id,
        b.category_id,
        c.subject_name,
        c.category_type,
        c.business_code,
        c.company_code,
        c.drawer,
        c.reviewer,
        c.invoicing_company_code,
        b.category_amount,
        t.id as non_coal_student_id,
        t.phone,
        t.id_card,
        t.name as student_name,
        t.pay_status,
        t.order_id,
        t.gov_pay_status,
        t.order_no
        from non_coal_pay a
        inner join non_coal_pay_student t on t.non_coal_pay_id = a.id and t.del_flag = 0
        <if test="isPay != null and isPay == 1 ">and t.pay_status = 0</if>
        inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0
        left join non_coal_category c on b.category_id = c.id and c.del_flag = 0
        where a.del_flag = 0
        <if test="payType != null and payType == 2 ">and a.id = #{dataId} and t.pay_type = #{payType}</if>
        <if test="payType != null and payType == 1 ">and t.id = #{dataId} and t.pay_type = #{payType}</if>
 
    </select>
 
 
    <insert id="insertNonCoalPay" parameterType="NonCoalPay" useGeneratedKeys="true" keyProperty="id">
        insert into non_coal_pay
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="batchName != null and batchName != ''">batch_name,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="districtCode != null and districtCode != ''">district_code,</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="updateBy != null and updateBy != ''">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_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="districtCode != null and districtCode != ''">#{districtCode},</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="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>
 
    <update id="updateNonCoalPay" parameterType="NonCoalPay">
        update non_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="districtCode != null and districtCode != ''">district_code = #{districtCode},</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>
 
    <update id="deleteNonCoalPayById">
        update non_coal_pay
        set del_flag  = 2,
            update_by = #{updateBy}
        where id = #{id}
    </update>
 
    <update id="deleteNonCoalPayByIds">
        update non_coal_pay set del_flag = 2 set where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>