From c1628ae5526ffae9cb12e70778cac8195c405382 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期一, 18 八月 2025 09:28:21 +0800
Subject: [PATCH] 新增功能
---
multi-system/src/main/resources/mapper/system/CatalogueMapper.xml | 70 ++++++++++++++++++++++++++++++----
1 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/multi-system/src/main/resources/mapper/system/CatalogueMapper.xml b/multi-system/src/main/resources/mapper/system/CatalogueMapper.xml
index 170cccb..ea745dc 100644
--- a/multi-system/src/main/resources/mapper/system/CatalogueMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/CatalogueMapper.xml
@@ -9,15 +9,26 @@
</insert>
<insert id="insertCatalogueDataFile">
- INSERT INTO `train_exam`.`catalogue_data_file`
+ INSERT INTO `catalogue_data_file`
( `catalogue_id`,`company_id`, `name`, `file_path`,`file_name`, `type`, `create_by`, `create_time` )
VALUES
( #{catalogueId},#{companyId}, #{name}, #{filePath},#{fileName}, #{type}, #{createBy}, #{createTime} )
</insert>
+ <insert id="insertCatalogue" useGeneratedKeys="true" keyProperty="id">
+ INSERT INTO `catalogue` ( `parent_id`, `number`, `mess`, `type`,`company_id` )
+ VALUES
+ (
+ #{parentId},
+ #{number},
+ #{mess},
+ #{type},
+ #{companyId}
+ )
+ </insert>
<update id="updateCatalogueData">
UPDATE `catalogue_data`
- SET
+ <set>
<if test="companyId!=null">
`company_id` = #{companyId},
</if>
@@ -27,24 +38,25 @@
<if test="content!=null and content!=''">
`content` = #{content},
</if>
- <if test="analysic!=null and analysic!=''">
+ <if test="analysis!=null and analysis!=''">
`analysis` = #{analysis},
</if>
<if test="delFlag!=null and delFlag!=''">
`del_flag` = #{delFlag},
</if>
- <if test="updateBy!=null and update!=''">
+ <if test="updateBy!=null and updateBy!=''">
`update_by` = #{updateBy},
</if>
<if test="updateTime!=null">
`update_time` = #{updateTime}
</if>
+ </set>
WHERE
`id` = #{id}
</update>
<update id="updateCatalogueDataFile">
UPDATE `catalogue_data_file`
- set
+ <set>
<if test="catalogueId!=null">
`catalogue_id` = #{catalogueId},
</if>
@@ -72,17 +84,26 @@
<if test="updateTime != null" >
update_time = #{updateTime}
</if>
+ </set>
where id = #{id}
</update>
+ <update id="updateCatalogueDataFileByCompanyId">
+ UPDATE catalogue_data_file set del_flag = #{delFlag} ,update_by = #{updateBy} , update_time=#{updateTime} where company_id =#{companyId} and catalogue_id = #{catalogueId}
+ </update>
+ <delete id="deleteByCatalogueDataFileId">
+ DELETE FROM catalogue_data_file WHERE id = #{id}
+ </delete>
<select id="selectCatalogueList" resultType="com.gkhy.exam.system.domain.vo.CatalogueVo">
SELECT
`id`,
+ company_id,
`parent_id`,
`number`,
`mess`,
`type`,
`del_flag`,
+ `sort`,
`create_by`,
`create_time`,
`update_by`,
@@ -90,10 +111,27 @@
FROM
catalogue
WHERE del_flag = 1
- <if test="type!=null">
+ <if test="type!=null and type!=''">
and type = #{type}
</if>
- ORDER BY create_time ASC
+ <if test="companyId!=null and companyId!=''">
+ and company_id = #{companyId}
+ </if>
+ ORDER BY
+ CAST(SUBSTRING_INDEX(number, '.', 1) AS UNSIGNED) ASC,
+ CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(number, '.', 2), '.', -1) AS UNSIGNED) ASC, -- 第二级
+ CAST(
+ CASE
+ WHEN LENGTH(number) - LENGTH(REPLACE(number, '.', '')) >= 2
+ THEN SUBSTRING_INDEX(number, '.', -1)
+ ELSE '0'
+ END AS UNSIGNED
+ ) ASC
+ <if test="type!=1 and type!=null">
+ ,sort asc
+ </if>
+ ,create_time asc
+
</select>
<select id="selectCatalogueDataList" resultType="com.gkhy.exam.system.domain.vo.CatalogueDataVo">
SELECT
@@ -141,7 +179,6 @@
SELECT
`id`,
`company_id`,
- name,
`catalogue_id`,
`content`,
`analysis`,
@@ -152,7 +189,22 @@
`update_time`
FROM
catalogue_data
- where company_id = #{companyId} and del_flag = 1
+ where company_id = #{companyId} and del_flag = 1 and catalogue_id = #{catalogueId}
</select>
+ <select id="selectCatalogueDataById" resultType="com.gkhy.exam.system.domain.CatalogueData">
+ SELECT
+ `id`,
+ `company_id`,
+ `catalogue_id`,
+ `content`,
+ `analysis`,
+ `del_flag`,
+ `create_by`,
+ `create_time`,
+ `update_by`,
+ `update_time`
+ FROM
+ catalogue_data where del_flag = 1 and id=#{catalogueDataId}
+ </select>
</mapper>
--
Gitblit v1.9.2