From 9f87ca56f82c2352adbb7201a190ac944e6deeeb Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期五, 08 九月 2023 17:55:54 +0800
Subject: [PATCH] MOM系统-9-08
---
standard-server/src/main/resources/mapper/ProductMapper.xml | 149 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/standard-server/src/main/resources/mapper/ProductMapper.xml b/standard-server/src/main/resources/mapper/ProductMapper.xml
index cee2fea..ffb32b8 100644
--- a/standard-server/src/main/resources/mapper/ProductMapper.xml
+++ b/standard-server/src/main/resources/mapper/ProductMapper.xml
@@ -3,42 +3,117 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.ProductMapper">
-
- <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.Product">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="father" column="father" jdbcType="VARCHAR"/>
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
- <result property="required" column="required" jdbcType="VARCHAR"/>
- <result property="internal" column="internal" jdbcType="VARCHAR"/>
- <result property="state" column="state" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="version" column="version" jdbcType="INTEGER"/>
- <result property="specificationsId" column="specifications_id" jdbcType="INTEGER"/>
- </resultMap>
-
- <resultMap id="selectTreeProduct" type="ProductDto">
- <id property="father" column="father" jdbcType="VARCHAR"/>
- <collection property="children" resultMap="productDto2ListMap"/>
- </resultMap>
-
- <resultMap id="productDto2ListMap" type="ProductDto2">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
- <result property="required" column="required" jdbcType="VARCHAR"/>
- <result property="internal" column="internal" jdbcType="VARCHAR"/>
- <result property="state" column="state" jdbcType="INTEGER"/>
- </resultMap>
-
- <select id="selectTreeProduct" resultMap="selectTreeProduct">
- SELECT p.id, p.`name`, IFNULL(p.`father`,p.`name`) father, p.`unit`, p.`required`, p.`internal`
- FROM product p
- where p.specifications_id = #{specifications}
- <if test="project != null and project != ''">
- AND p.father like concat('%',#{project},'%')
- </if>
- and p.state = 1
+ <!--鏍规嵁鍨嬪彿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.name 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>
+
+ <!--鏍规嵁鎶�鏈寚鏍噄d鎵归噺鍒犻櫎-->
+ <update id="delAllPro">
+ update mom_ocean.product
+ set state=0
+ where id in (${ids})
+ </update>
</mapper>
--
Gitblit v1.9.3