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/NonCoalCategoryMapper.xml |   99 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 79 insertions(+), 20 deletions(-)

diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml
index 4d36750..f44bd8b 100644
--- a/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml
+++ b/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml
@@ -21,6 +21,13 @@
         <result property="updateTime" column="update_time"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
+        <result property="operateTypeName" column="operate_type_name"/>
+        <result property="districtName" column="district_name"/>
+    </resultMap>
+
+    <resultMap type="NonCoalCategory" id="NonCoalCategoryResultVO" extends="NonCoalCategoryResult">
+        <result property="operateTypeName" column="operate_type_name"/>
+
     </resultMap>
 
     <sql id="selectNonCoalCategoryVo">
@@ -30,38 +37,90 @@
                subject_name,
                operate_type_id,
                amount,
-               bussiness_code,
+               business_code,
                company_code,
                drawer,
                reviewer,
-               invoicing_company_code, describe, update_by, update_time, create_by, create_time
+               invoicing_company_code,
+               `describe`,
+               update_by,
+               update_time,
+               create_by,
+               create_time
         from non_coal_category
     </sql>
 
     <select id="selectNonCoalCategoryList" parameterType="NonCoalCategory" resultMap="NonCoalCategoryResult">
-        <include refid="selectNonCoalCategoryVo"/>
+        select a.id,
+        a.district_code,
+        a.category_type,
+        a.subject_name,
+        a.operate_type_id,
+        a.amount,
+        a.business_code,
+        a.company_code,
+        a.drawer,
+        a.reviewer,
+        a.invoicing_company_code,
+        a.`describe`,
+        a.update_by,
+        a.update_time,
+        a.create_by,
+        a.create_time,
+        (SELECT GROUP_CONCAT(name SEPARATOR '/') FROM sys_operate_type
+        WHERE FIND_IN_SET(id, (SELECT ancestors FROM sys_operate_type WHERE id = a.operate_type_id)) or id =
+        a.operate_type_id ) operate_type_name,
+        b.name district_name
+        from non_coal_category a
+        left join sys_district b on a.district_code = b.code
         <where>
-            <if test="districtCode != null  and districtCode != ''">and district_code = #{districtCode}</if>
-            <if test="categoryType != null ">and category_type = #{categoryType}</if>
-            <if test="subjectName != null  and subjectName != ''">and subject_name like concat('%', #{subjectName},
+            and a.del_flag = 0
+            <if test="districtCode != null  and districtCode != ''">and a.district_code = #{districtCode}</if>
+            <if test="categoryType != null ">and a.category_type = #{categoryType}</if>
+            <if test="subjectName != null  and subjectName != ''">and a.subject_name like concat('%', #{subjectName},
                 '%')
             </if>
-            <if test="operateTypeId != null ">and operate_type_id = #{operateTypeId}</if>
-            <if test="amount != null ">and amount = #{amount}</if>
-            <if test="bussinessCode != null  and bussinessCode != ''">and bussiness_code = #{bussinessCode}</if>
-            <if test="companyCode != null  and companyCode != ''">and company_code = #{companyCode}</if>
-            <if test="drawer != null  and drawer != ''">and drawer = #{drawer}</if>
-            <if test="reviewer != null  and reviewer != ''">and reviewer = #{reviewer}</if>
-            <if test="invoicingCompanyCode != null  and invoicingCompanyCode != ''">and invoicing_company_code =
+            <if test="operateTypeId != null ">and a.operate_type_id = #{operateTypeId}</if>
+            <if test="amount != null ">and a.amount = #{amount}</if>
+            <if test="bussinessCode != null  and bussinessCode != ''">and a.business_code = #{bussinessCode}</if>
+            <if test="companyCode != null  and companyCode != ''">and a.company_code = #{companyCode}</if>
+            <if test="drawer != null  and drawer != ''">and a.drawer = #{drawer}</if>
+            <if test="reviewer != null  and reviewer != ''">and a.reviewer = #{reviewer}</if>
+            <if test="invoicingCompanyCode != null  and invoicingCompanyCode != ''">and a.invoicing_company_code =
                 #{invoicingCompanyCode}
             </if>
-            <if test="describe != null  and describe != ''">and describe = #{describe}</if>
+            <if test="describe != null  and describe != ''">and a.`describe` = #{describe}</if>
         </where>
+        order by create_time desc
     </select>
 
     <select id="selectNonCoalCategoryById" parameterType="Long" resultMap="NonCoalCategoryResult">
-        <include refid="selectNonCoalCategoryVo"/>
-        where id = #{id}
+        select a.id,
+               a.district_code,
+               a.category_type,
+               a.subject_name,
+               a.operate_type_id,
+               a.amount,
+               a.business_code,
+               a.company_code,
+               a.drawer,
+               a.reviewer,
+               a.invoicing_company_code,
+               a.`describe`,
+               a.update_by,
+               a.update_time,
+               a.create_by,
+               a.create_time,
+               (SELECT GROUP_CONCAT(name SEPARATOR '/')
+                FROM sys_operate_type
+                WHERE FIND_IN_SET(id, (SELECT ancestors FROM sys_operate_type WHERE id = a.operate_type_id))
+                   or id =
+                      a.operate_type_id) operate_type_name,
+               b.name                    district_name
+        from non_coal_category a
+                 left join sys_district b on a.district_code = b.code
+
+        where a.id = #{id}
     </select>
 
     <insert id="insertNonCoalCategory" parameterType="NonCoalCategory" useGeneratedKeys="true" keyProperty="id">
@@ -72,12 +131,12 @@
             <if test="subjectName != null and subjectName != ''">subject_name,</if>
             <if test="operateTypeId != null">operate_type_id,</if>
             <if test="amount != null">amount,</if>
-            <if test="bussinessCode != null and bussinessCode != ''">bussiness_code,</if>
+            <if test="bussinessCode != null and bussinessCode != ''">business_code,</if>
             <if test="companyCode != null and companyCode != ''">company_code,</if>
             <if test="drawer != null and drawer != ''">drawer,</if>
             <if test="reviewer != null and reviewer != ''">reviewer,</if>
             <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code,</if>
-            <if test="describe != null">describe,</if>
+            <if test="describe != null">`describe`,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="createBy != null">create_by,</if>
@@ -112,14 +171,14 @@
             <if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if>
             <if test="operateTypeId != null">operate_type_id = #{operateTypeId},</if>
             <if test="amount != null">amount = #{amount},</if>
-            <if test="bussinessCode != null and bussinessCode != ''">bussiness_code = #{bussinessCode},</if>
+            <if test="bussinessCode != null and bussinessCode != ''">business_code = #{bussinessCode},</if>
             <if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
             <if test="drawer != null and drawer != ''">drawer = #{drawer},</if>
             <if test="reviewer != null and reviewer != ''">reviewer = #{reviewer},</if>
             <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code =
                 #{invoicingCompanyCode},
             </if>
-            <if test="describe != null">describe = #{describe},</if>
+            <if test="describe != null">`describe` = #{describe},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

--
Gitblit v1.9.2