XiaoRuby
2023-09-04 91b2da2c3a42656e842f7c9e0c4af6aa02dbaa3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0" encoding="UTF-8"?>
<!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>