zss
2023-09-25 44a9b4729e058e75dfba2892803038ee91963d77
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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">
    <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
        from mom_ocean.manual_technology
        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>