XiaoRuby
2023-09-01 8e39c9bbf8a8bb4707f2a766295b40497ae96706
production-server/src/main/resources/mapper/ManualTechnologyMapper.xml
@@ -1,15 +1,48 @@
<?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">
    <select id="seleDatil" resultType="java.util.Map">
    <resultMap id="seleDatilMap" type="map">
        <id property="lable" column="techfather"/>
        <collection property="children" resultMap="seleDatilTowMap" javaType="List"/>
    </resultMap>
    <resultMap id="seleDatilTowMap" type="map">
        <id property="lable" column="techname"/>
        <result property="id" column="id"/>
        <result property="deviceGroup" column="device_group"/>
        <result property="technologyId" column="manufacture_order_id"/>
    </resultMap>
    <select id="seleDatil" resultMap="seleDatilMap">
        select manual_technology.id,
               techfather,
               techname,
               device_group,
               name
               device_group
        from mom_ocean.manual_technology
                 left join mom_ocean.device
                           on device.id = device_id
        where manufacture_order_id=#{manOrdId}
        where manufacture_order_id = #{manOrdId}
    </select>
</mapper>
    <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}
    </select>
</mapper>