XiaoRuby
2023-09-07 c28d3bb363dde2afb44c168b93379b2bf6b1f67f
production-server/src/main/resources/mapper/ManufactureOrderProcessMapper.xml
@@ -2,4 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.ManufactureOrderProcessMapper">
    <update id="updateTime" parameterType="integer">
        UPDATE manufacture_order_process p
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="start_time =case" suffix="end,">
                <foreach collection="list" item="list" index="index">
                    WHEN p.id=#{list.id} THEN #{list.startTime}
                </foreach>
            </trim>
            <trim prefix="end_time =case" suffix="end,">
                <foreach collection="list" item="list" index="index">
                    WHEN p.id=#{list.id} THEN #{list.endTime}
                </foreach>
            </trim>
        </trim>
        WHERE p.id in
        <foreach collection="list" item="list" index="index" separator="," open="(" close=")">
            <if test="list.startTime != null and list.endTime != null">
                #{list.id, jdbcType=BIGINT}
            </if>
        </foreach>
    </update>
    <select id="selectSchedulingStartTime" resultType="date">
        SELECT DATE_FORMAT(p.`start_time`, '%Y-%m-%d')
        FROM manufacture_order_process p
        WHERE p.`manufacture_scheduling_id` = #{schedulingId}
            LIMIT 1
    </select>
</mapper>