zss
2023-09-24 527cbd85e37842d93d081f33916dca5c6f7156e0
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?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.TechniqueModelMapper">
    <!--查询生产工艺维护列表 右边展示该工艺下能使用的设备所能做的项目-->
    <resultMap id="selectAllTequeMap" type="map">
        <id property="dname" column="dname"/>
        <collection property="children" resultMap="selectAllTequeMaps" javaType="List"/>
    </resultMap>
    <resultMap id="selectAllTequeMaps" type="map">
        <id property="id" column="id"/>
        <result property="father" column="father"/>
        <result property="unit" column="unit"/>
        <result property="name" column="name"/>
    </resultMap>
    <!--根据技术指标id批量删除-->
    <update id="delTechById">
        update mom_ocean.technique_model
        set state=0
        where technical_model_id = #{id}
    </update>
    <!--根据技术指标id批量删除-->
    <update id="delAllTech">
        update mom_ocean.technique_model
        set state=0
        where technical_model_id in (${id})
    </update>
    <select id="selectAllTeque" resultMap="selectAllTequeMap">
        select d.name dname,
               qm.id,
               cm.father,
               unit,
               cm.name
        from mom_ocean.technique_model qm,
             mom_ocean.technical_model cm,
             mom_ocean.device d,
             mom_ocean.technology_template tt
        where qm.state = 1
          and d.state = 1
          and d.id = qm.device_id
          and cm.id = qm.technical_model_id
          and tt.id = qm.tech_tem_id
          and qm.tech_tem_id = #{id}
    </select>
 
    <!--新增生产工艺维护 选择项目父类,子类,带出单位-->
    <resultMap id="chooseProMap" type="map">
        <id property="name" column="father"/>
        <collection property="children" resultMap="chooseProMaps" javaType="List"/>
    </resultMap>
    <resultMap id="chooseProMaps" type="map">
        <id property="id" column="technicalModelId"/>
        <result property="name" column="name"/>
        <result property="unit" column="unit"/>
    </resultMap>
    <select id="choosePro" resultMap="chooseProMap">
        select father,
               id technicalModelId,
               name,
               unit
        from mom_ocean.technical_model
        where state = 1
          and tech_tem_id = #{id}
    </select>
 
    <!--新增生产工艺维护 选择设备-->
    <select id="chooseDeiv" resultType="java.util.Map">
        select id devId,
               name
        from mom_ocean.device
        where state = 1
          and device_status in (1, 5)
          and father = (select device_group
                        from mom_ocean.technology_template
                        where technology_template.state = 1
                          and technology_template.id = #{id})
    </select>
 
    <!--根据生产工艺id查看详情-->
    <select id="selecQueById" resultType="java.util.Map">
        select tt.type,
               tt.father techFather,
               tt.name   techName,
               tt.id     tid,
               d.id      did,
               d.name    dname,
               cm.father,
               cm.name,
               unit
        from mom_ocean.technique_model qm,
             mom_ocean.technology_template tt,
             mom_ocean.device d,
             mom_ocean.technical_model cm
        where qm.tech_tem_id = tt.id
          and device_id = d.id
          and cm.id = qm.technical_model_id
          and qm.id = #{id}
    </select>
 
    <!--批量删除-->
    <update id="delAllQue">
        update mom_ocean.technique_model
        set state=0
        where id in (${ids})
    </update>
 
    <!--根据工艺路线id删除-->
    <update id="delQueByTechId">
        update mom_ocean.technique_model
        set state=0
        where tech_tem_id = #{id}
    </update>
 
    <!--根据工艺路线id批量删除-->
    <update id="delAllByTechId">
        update mom_ocean.technique_model
        set state=0
        where tech_tem_id in (${ids})
    </update>
</mapper>