zss
2023-09-15 22899f74279a47f4ec79e1325f8489d948ced005
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.ProductMapper">
    <!--根据型号id查询项目(技术指标)-->
    <select id="selectProductList" resultType="java.util.Map">
        select name,
               father,
               unit,
               required,
               internal
        from mom_ocean.product
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
    </select>
 
    <!--根据型号id查询所有版本-->
    <select id="selectVerByPro" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.product
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
        order by version desc
    </select>
 
    <!--右侧数据展示 技术指标(检验项目)-->
    <resultMap id="oneMap" type="map">
        <id property="tfather" column="tfather"/>
        <collection property="children" resultMap="twoMap" javaType="List"/>
    </resultMap>
    <resultMap id="twoMap" type="map">
        <id property="tname" column="tname"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <resultMap id="threeMap" type="map">
        <id property="pfather" column="pfather"/>
        <collection property="children" resultMap="fourMap" javaType="List"/>
    </resultMap>
    <resultMap id="fourMap" type="map">
        <id property="pid" column="pid"/>
        <result property="pname" column="pname"/>
        <result property="unit" column="unit"/>
        <result property="required" column="required"/>
        <result property="internal" column="internal"/>
    </resultMap>
    <select id="selectAllPro" resultMap="oneMap">
        select p.id pid,
        p.name pname,
        p.father pfather,
        unit,
        required,
        internal,
        t.father tfather,
        t.name tname
        from mom_ocean.product p
        left join mom_ocean.technology t on p.technology_id = t.id
        where p.state = 1
        and p.version = #{version}
        and specifications_id = #{specificationsId}
        <if test="message!=null and message!=''">
            and p.father like concat('%',#{message},'%')
        </if>
    </select>
 
    <!--右上角新增-技术指标-选择项目父类-->
    <select id="chooseFather" resultType="java.util.Map">
        select distinct father
        from mom_ocean.product
        where state = 1
          and technology_id = #{technologyId}
    </select>
 
    <!--根据型号id查询该型号下的所有工艺的技术指标-->
    <select id="selAllBySpeId" resultType="com.yuanchu.mom.pojo.Product">
        select *
        from mom_ocean.product
        where state = 1
          and version = #{version}
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
    </select>
    <!--查询标准BOM技术指标中该型号工艺下最新版本的检验项目-->
    <select id="selProByVerSpe" resultType="com.yuanchu.mom.pojo.Product">
        select *
        from mom_ocean.product
        where state = 1
          and technology_id = #{technologyId}
    </select>
 
    <!--根据工艺路线id删除-->
    <update id="delProByTecId">
        update mom_ocean.product
        set state=0
        where technology_id = #{id}
    </update>
 
    <!--根据工艺路线id批量删除-->
    <update id="delAllByTechId">
        update mom_ocean.product
        set state=0
        where technology_id in (${ids})
    </update>
 
    <!--根据技术指标id批量删除-->
    <update id="delAllPro">
        update mom_ocean.product
        set state=0
        where id in (${ids})
    </update>
</mapper>