huangjiayang
2025-05-14 bbc84a06cf88cd70df389adc2432419d259cd6ff
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>