From bbc84a06cf88cd70df389adc2432419d259cd6ff Mon Sep 17 00:00:00 2001
From: huangjiayang <5265313@qq.com>
Date: 星期三, 14 五月 2025 09:47:21 +0800
Subject: [PATCH] 【UPDATE】修改日历管理相关接口和数据结构

---
 aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml
index 642ac4c..b6effe1 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml
@@ -18,10 +18,13 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="holidays"    column="holidays"    />
+        <result property="applicable"    column="applicable"    />
+        <result property="applicableTranslate"    column="applicable_translate"    />
     </resultMap>
 
     <sql id="selectApsWorkCalendarVo">
-        select id, description, type, effective_date, expiring_date, content, applicable_factory, applicable_workshop, applicable_process, create_by, create_time, update_by, update_time from aps_work_calendar
+        select id, description, type, effective_date, expiring_date, content, applicable_factory, applicable_workshop, applicable_process, create_by, create_time, update_by, update_time, holidays, applicable, applicable_translate from aps_work_calendar
     </sql>
 
     <select id="selectApsWorkCalendarList" parameterType="ApsWorkCalendar" resultMap="ApsWorkCalendarResult">
@@ -31,7 +34,13 @@
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="effectiveDate != null and expiringDate != null"> and ((effective_date &gt;= #{effectiveDate} and effective_date &lt;= #{expiringDate}) or (expiring_date &gt;= #{effectiveDate} and expiring_date &lt;= #{expiringDate}))</if>
 <!--            <if test="content != null  and content != ''"> and content = #{content}</if>-->
-            <if test="applicableFactory != null  and applicableFactory != ''"> and applicable_factory = #{applicableFactory}</if>
+            <if test="applicableFactory != null  and applicableFactory != ''">
+              and EXISTS (
+                SELECT 1
+                FROM jsonb_array_elements(applicable) AS obj
+                WHERE obj ->> 'factory' = #{applicableFactory}
+                )
+            </if>
             <if test="applicableWorkshop != null  and applicableWorkshop != ''"> and applicable_workshop = #{applicableWorkshop}</if>
             <if test="applicableProcess != null  and applicableProcess != ''"> and applicable_process = #{applicableProcess}</if>
         </where>
@@ -58,6 +67,9 @@
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="holidays != null">holidays,</if>
+            <if test="applicable != null">applicable,</if>
+            <if test="applicableTranslate != null">applicable_translate,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -73,6 +85,9 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="holidays != null">#{holidays, typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if>
+            <if test="applicable != null">#{applicable, typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if>
+            <if test="applicableTranslate != null">#{applicableTranslate},</if>
          </trim>
     </insert>
 
@@ -91,6 +106,9 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="holidays != null">holidays = #{holidays, typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if>
+            <if test="applicable != null">applicable = #{applicable, typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if>
+            <if test="applicableTranslate != null">applicable_translate = #{applicableTranslate},</if>
         </trim>
         where id = #{id}
     </update>
@@ -99,10 +117,14 @@
         delete from aps_work_calendar where id = #{id}
     </delete>
 
-    <delete id="deleteApsWorkCalendarByIds" parameterType="String">
-        delete from aps_work_calendar where id in 
+    <delete id="deleteApsWorkCalendarByIds" parameterType="ApsWorkCalendar">
+        delete from aps_work_calendar where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
+
+    <delete id="deleteApsWorkCalendar" parameterType="ApsWorkCalendar">
+        delete from aps_work_calendar where effective_date=#{effectiveDate} and expiring_date=#{expiringDate} and applicable_factory=#{applicableFactory} and applicable_workshop=#{applicableWorkshop} and applicable_process=#{applicableProcess}
+    </delete>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3