From d30f51ef23798fea6e83859684267cbb133fed9c Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: 星期一, 20 一月 2025 10:17:31 +0800
Subject: [PATCH] 特种作业非煤缴费版本

---
 exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml |  220 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 180 insertions(+), 40 deletions(-)

diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
index 3016cea..1452f5f 100644
--- a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
+++ b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
@@ -1,52 +1,189 @@
 <?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">
+        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"    />
+        <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="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">
+        <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"/>
+
+    </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
+        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>
+            <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="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.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.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
+        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.pay_status = 0
+          and t.phone = #{phone}
+          and t.id_card = #{idCard} limit 1
+    </select>
+
 
     <insert id="insertNonCoalPay" parameterType="NonCoalPay" useGeneratedKeys="true" keyProperty="id">
         insert into non_coal_pay
@@ -66,7 +203,7 @@
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="delFlag != null">del_flag,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="batchName != null and batchName != ''">#{batchName},</if>
             <if test="deptId != null">#{deptId},</if>
@@ -83,7 +220,7 @@
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="delFlag != null">#{delFlag},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateNonCoalPay" parameterType="NonCoalPay">
@@ -108,14 +245,17 @@
         where id = #{id}
     </update>
 
-    <delete id="deleteNonCoalPayById" parameterType="Long">
-        delete from non_coal_pay where id = #{id}
-    </delete>
+    <update id="deleteNonCoalPayById" parameterType="Long">
+        update non_coal_pay
+        set del_flag  = 2,
+            update_by = #{updateBy} non_coal_pay
+        where id = #{id}
+    </update>
 
-    <delete id="deleteNonCoalPayByIds" parameterType="String">
-        delete from non_coal_pay where id in 
+    <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>
-    </delete>
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.2