zss
2023-08-30 af9457d7ce94c7684a9439d46b0025bd6e66d8af
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
<?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.TechnicalModelMapper">
    <!--查询技术指标维护列表 左边二级展示工序和工艺  -->
    <resultMap id="selectAllTechTemMap" type="map">
        <id property="name" column="father"/>
        <collection property="children" resultMap="selectAllTechTemTowMap" javaType="List"/>
    </resultMap>
    <resultMap id="selectAllTechTemTowMap" type="map">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
    </resultMap>
    <select id="selectAllTechTem" resultMap="selectAllTechTemMap">
        select id,
        name,
        father
        from mom_ocean.technology_template
        where state=1
        and type=#{type}
        <if test="message!=null and message!=''">
            and name like concat('%',#{message},'%')
        </if>
    </select>
 
    <!--查询技术指标维护列表 右边展示该工艺下的检验项目-->
    <resultMap id="selectAllTechNamMap" type="map">
        <id property="name" column="father"/>
        <collection property="children" resultMap="selectAllTechNamTowMap" javaType="List"/>
    </resultMap>
    <resultMap id="selectAllTechNamTowMap" type="map">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="name" column="unit"/>
    </resultMap>
    <select id="selectAllTechNam" resultMap="selectAllTechNamMap">
        select id,
               father,
               name,
               unit
        from mom_ocean.technical_model
        where state = 1
          and tech_tem_id = #{id}
    </select>
 
    <!--新增技术指标维护 选择工序和工艺-->
    <resultMap id="chooseTechFathMap" type="map">
        <id property="name" column="techFather"/>
        <collection property="children" resultMap="chooseTechFathTowMap" javaType="List"/>
    </resultMap>
    <resultMap id="chooseTechFathTowMap" type="map">
        <id property="id" column="techTemId"/>
        <result property="name" column="techName"/>
    </resultMap>
    <select id="chooseTechFath" resultMap="chooseTechFathMap">
        select id techTemId,
               name   techName,
               father techFather
        from mom_ocean.technology_template
        where state = 1
          and type = #{type}
    </select>
 
    <!--新增技术指标维护 选择项目父类-->
    <select id="chooseProFath" resultType="java.lang.String">
        select distinct father
        from mom_ocean.technical_model
        where state = 1
          and tech_tem_id = #{id}
    </select>
 
    <!--根据id查询详情-->
    <select id="selecTechById" resultType="java.util.Map">
        select technical_model.father,
               technical_model.name,
               unit,
               technology_template.name   techName,
               technology_template.father techFather,
               type
        from mom_ocean.technical_model,
             mom_ocean.technology_template
        where technical_model.state = 1
          and technology_template.id = tech_tem_id
          and technical_model.id = #{id}
    </select>
 
    <!--批量删除根据技术指标id-->
    <update id="delAllTech">
        update mom_ocean.technical_model
        set state=0
        where id in (${ids})
    </update>
 
    <!--删除根据工艺路线id-->
    <update id="delTeMoByTechId">
        update mom_ocean.technical_model
            set state=0
        where tech_tem_id=#{id}
    </update>
 
    <!--批量删除根据工艺路线id-->
    <update id="delAllByTechId">
        update mom_ocean.technical_model
        set state=0
        where tech_tem_id in (${ids})
    </update>
</mapper>