zss
2023-09-06 fa0d4fc230b44c04b969b4f7c7bd0ea72a61572d
production-server/src/main/resources/mapper/ManualTechnologyMapper.xml
@@ -1,38 +1,6 @@
<?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.ManualTechnologyMapper">
    <!--批量更新-->
    <update id="updateBatchManualTechnology">
        UPDATE mom_ocean.manual_technology
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="device_id=case" suffix="end,">
                <foreach collection="manualTechnologies" item="manualTechnologie">
                    WHEN id =#{manualTechnologie.id} THEN #{manualTechnologie.deviceId}
                </foreach>
            </trim>
            <trim prefix="start_time=case" suffix="end,">
                <foreach collection="manualTechnologies" item="manualTechnologie">
                    WHEN id =#{manualTechnologie.id} THEN #{manualTechnologie.startTime}
                </foreach>
            </trim>
            <trim prefix="end_time=case" suffix="end,">
                <foreach collection="manualTechnologies" item="manualTechnologie">
                    WHEN id =#{manualTechnologie.id} THEN #{manualTechnologie.endTime}
                </foreach>
            </trim>
            <trim prefix="scheduling_number=case" suffix="end,">
                <foreach collection="manualTechnologies" item="manualTechnologie">
                    WHEN id =#{manualTechnologie.id} THEN #{schedulingNumber}
                </foreach>
            </trim>
        </trim>
        <where>
            <foreach collection="manualTechnologies" separator="or" item="manualTechnologie">
                id =#{manualTechnologie.id}
            </foreach>
        </where>
    </update>
    <resultMap id="seleDatilMap" type="map">
        <id property="lable" column="techfather"/>
        <collection property="children" resultMap="seleDatilTowMap" javaType="List"/>
@@ -42,7 +10,6 @@
        <id property="lable" column="techname"/>
        <result property="id" column="id"/>
        <result property="deviceGroup" column="device_group"/>
        <result property="deviceName" column="name"/>
        <result property="technologyId" column="manufacture_order_id"/>
    </resultMap>
@@ -50,12 +17,46 @@
        select manual_technology.id,
               techfather,
               techname,
               device_group,
               name,
               manufacture_order_id
               device_group
        from mom_ocean.manual_technology
                 left join mom_ocean.device
                           on device.id = device_id
        where manufacture_order_id = #{manOrdId}
    </select>
    <resultMap id="selectListTowTreeFirstMap" type="map">
        <id property="techfather" column="techfather"/>
        <collection property="children" javaType="list" resultMap="selectListTowTreeSecondMap"/>
    </resultMap>
    <resultMap id="selectListTowTreeSecondMap" type="map">
        <id property="id" column="id"/>
        <result property="techname" column="techname"/>
        <result property="deviceName" column="name"/>
        <result property="startTime" column="start_time"/>
        <result property="endTime" column="end_time"/>
        <result property="period" column="period"/>
    </resultMap>
    <select id="selectListTowTree" resultMap="selectListTowTreeFirstMap">
        SELECT p.`id`,
               t.`techfather`,
               t.`techname`,
               d.`name`,
               DATE_FORMAT(p.`start_time`, '%Y-%m-%d') start_time,
               DATE_FORMAT(p.`end_time`, '%Y-%m-%d')   end_time,
               p.`period`
        FROM manufacture_order_process p
                 LEFT JOIN device d ON d.`id` = p.`device_id`
                 LEFT JOIN manual_technology t ON t.`id` = p.`manual_technology_id`
        WHERE p.`state` = 1
          AND p.`manufacture_scheduling_id` = #{schedulingId}
        ORDER BY p.`create_time` DESC
    </select>
    <!--根据生产订单id查询所有(倒序)-->
    <select id="selAllByMoId" resultType="com.yuanchu.mom.pojo.ManualTechnology">
        select *
        from mom_ocean.manual_technology
        where state = 1
          and manufacture_order_id = #{id}
        order by id desc
    </select>
</mapper>