From 2a64b537e8e3bce9ce030585a3da17d48379c0ad Mon Sep 17 00:00:00 2001
From: sfd <sun.sunshine@163.com>
Date: 星期一, 26 五月 2025 15:04:45 +0800
Subject: [PATCH] 修改json类型转换错误
---
aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 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 b0b0b98..3a80553 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
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aps.core.mapper.ApsWorkCalendarMapper">
- <resultMap type="ApsWorkCalendar" id="ApsWorkCalendarResult">
+ <resultMap type="com.aps.core.domain.ApsWorkCalendar" id="ApsWorkCalendarResult">
<result property="id" column="id" />
<result property="description" column="description" />
<result property="type" column="type" />
@@ -18,20 +18,29 @@
<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">
+ <select id="selectApsWorkCalendarList" parameterType="com.aps.core.domain.ApsWorkCalendar" resultMap="ApsWorkCalendarResult">
<include refid="selectApsWorkCalendarVo"/>
<where>
<if test="description != null and description != ''"> and description like '%' || #{description} || '%'</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="effectiveDate != null and expiringDate != null"> and ((effective_date >= #{effectiveDate} and effective_date <= #{expiringDate}) or (expiring_date >= #{effectiveDate} and expiring_date <= #{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="content != null and content != ''"> and content = #{content}</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>
@@ -42,7 +51,7 @@
where id = #{id}
</select>
- <insert id="insertApsWorkCalendar" parameterType="ApsWorkCalendar">
+ <insert id="insertApsWorkCalendar" parameterType="com.aps.core.domain.ApsWorkCalendar">
insert into aps_work_calendar
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
@@ -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,10 +85,13 @@
<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>
- <update id="updateApsWorkCalendar" parameterType="ApsWorkCalendar">
+ <update id="updateApsWorkCalendar" parameterType="com.aps.core.domain.ApsWorkCalendar">
update aps_work_calendar
<trim prefix="SET" suffixOverrides=",">
<if test="description != null">description = #{description},</if>
@@ -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="com.aps.core.domain.ApsWorkCalendar">
+ delete from aps_work_calendar where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
+
+ <delete id="deleteApsWorkCalendar" parameterType="com.aps.core.domain.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