From 9bc1958825de5c9427659a8824a9e86864c2a457 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期四, 03 七月 2025 17:27:18 +0800
Subject: [PATCH] 修改

---
 multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml b/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
index a8011e9..17d8961 100644
--- a/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
@@ -1,6 +1,16 @@
 <?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.system.mapper.CompanyIndustryTemplateMapper">
+    <insert id="insertIndustrys">
+        INSERT INTO `company_industry_template` (
+        `company_id`,`chapter`,`type`,`template_name`,`industry_type`,`create_by`,`create_time`
+        )
+        VALUES
+        <foreach collection="companyIndustryTemplates" separator="," item="item">
+            (#{item.companyId},#{item.chapter},#{item.type},#{item.templateName},#{item.industryType},
+            #{item.createBy},#{item.createTime})
+        </foreach>
+    </insert>
     <update id="updateCompanyIndustryTemplateById" parameterType="com.gkhy.exam.system.domain.CompanyIndustryTemplate">
         UPDATE company_industry_template
         <set>
@@ -9,6 +19,9 @@
             </if>
             <if test="companyName != null and companyName != ''" >
                 company_name = #{companyName},
+            </if>
+            <if test="chapter!=null and chapter!=''">
+                chapter = #{chapter},
             </if>
             <if test="templateName != null and templateName !=''" >
                 template_name = #{templateName},
@@ -49,6 +62,8 @@
             ci.`id`,
             ci.`company_id`,
             ci.`company_name`,
+            ci.chapter,
+            ci.`type`,
             ci.`template_name`,
             ci.`industry_type`,
             cit.name as industry_name,
@@ -71,7 +86,18 @@
         <if test="industryType!=null">
             and ci.industry_type = #{industryType}
         </if>
+        <if test="type!=null and type!=''">
+            and ci.type like concat('%',#{type},'%')
+        </if>
         ORDER BY
-            ci.create_time DESC
+        CAST(SUBSTRING_INDEX(ci.chapter, '.', 1) AS UNSIGNED) ASC,
+        CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(ci.chapter, '.', 2), '.', -1) AS UNSIGNED) ASC,  -- 第二级
+        CAST(
+        CASE
+        WHEN LENGTH(ci.chapter) - LENGTH(REPLACE(ci.chapter, '.', '')) >= 2
+        THEN SUBSTRING_INDEX(ci.chapter, '.', -1)
+        ELSE '0'
+        END AS UNSIGNED
+        ) ASC
     </select>
 </mapper>

--
Gitblit v1.9.2