zss
2023-09-05 b9e2c1619cf61bcd5f24b858fff738244d20566e
standard-server/src/main/resources/mapper/TechniqueMapper.xml
@@ -31,19 +31,101 @@
    </resultMap>
    <select id="selectAllTeq" resultMap="oneMap">
        select tq.id tqid,
               device,
               product_father,
               product,
               unit,
               name,
               father
        device,
        product_father,
        product,
        unit,
        name,
        father
        from mom_ocean.technique tq
                 left join mom_ocean.technology tc on tq.technology_id = tc.id
        left join mom_ocean.technology tc on tq.technology_id = tc.id
        where tq.state = 1
          and specifications_id = #{specificationsId}
          and tq.version = #{version}
        and specifications_id = #{specificationsId}
        and tq.version = #{version}
        <if test="message!=null and message!=''">
            and device like concat('%',#{message},'%')
        </if>
    </select>
    <!--右上角新增-生产工艺-选择设备-->
    <select id="chooseDev" resultType="java.util.Map">
        select name device
        from mom_ocean.device
        where state = 1
          and device_status in (1, 5)
          and father = (select distinct device_group
                        from mom_ocean.technology
                        where technology.state = 1
                          and technology.id = #{technologyId})
    </select>
    <!--右上角新增-生产工艺-选择项目(父子),单位-->
    <resultMap id="chooseProMap" type="map">
        <id property="name" column="productFather"/>
        <collection property="children" resultMap="chooseProMaps" javaType="List"/>
    </resultMap>
    <resultMap id="chooseProMaps" type="map">
        <id property="name" column="product"/>
        <result property="unit" column="unit"/>
    </resultMap>
    <select id="choosePro" resultMap="chooseProMap">
        select name   product,
               father productFather,
               unit
        from mom_ocean.product
        where state = 1
          and technology_id = #{technologyId}
    </select>
    <!--根据型号id查询该型号下所有工艺的生产工艺-->
    <select id="selAllBySpeId" resultType="com.yuanchu.mom.pojo.Technique">
        select *
        from mom_ocean.technique
        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>
    <!--根据工艺路线id查询所有版本-->
    <select id="selectVerByTeId" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.technique
        where state = 1
          and technology_id = #{technologyId}
    </select>
    <!--查询该工艺下最新版本在一个检验项目下可以使用哪些设备-->
    <select id="selDevByVerTecIdFaNam" resultType="java.util.Map">
        select device.id, device
        from mom_ocean.technique
                 left join mom_ocean.device on name = device
        where technique.state = 1
          and technology_id = #{technologyId}
          and product_father = #{father}
          and product = #{name}
          and version = #{ver}
    </select>
    <!--根据工艺路线id删除生产工艺-->
    <update id="delTeqByTecId">
        update mom_ocean.technique
        set state=0
        where technology_id = #{id}
    </update>
    <!--根据工艺路线id批量删除-->
    <update id="delAllByTecId">
        update mom_ocean.technique
        set state=0
        where technology_id in (${ids})
    </update>
    <!--根据生产工艺id批量删除-->
    <update id="delAllTeq">
        update mom_ocean.technique
        set state=0
        where id in (${ids})
    </update>
</mapper>