From 107781d7eee538910550563aa766e1da0734fca9 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期四, 22 四月 2021 16:45:02 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/store/UserStorehouseServiceDaoImplMapper.xml | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/store/UserStorehouseServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/UserStorehouseServiceDaoImplMapper.xml
index 3d3c7c8..ce3f613 100644
--- a/java110-db/src/main/resources/mapper/store/UserStorehouseServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/store/UserStorehouseServiceDaoImplMapper.xml
@@ -13,6 +13,13 @@
)
</insert>
+ <insert id="saveUserStorehouses" parameterType="Map">
+ insert into user_storehouse(
+ res_name,b_id,store_id,stock,res_id,user_id,us_id
+ ) values (
+ #{resName},'-1',#{storeId},#{stock},#{resId},#{userId},#{usId}
+ )
+ </insert>
<!-- 鏌ヨ涓汉鐗╁搧淇℃伅锛圔usiness锛� add by wuxw 2018-07-03 -->
<select id="getBusinessUserStorehouseInfo" parameterType="Map" resultType="Map">
@@ -44,9 +51,7 @@
<if test="usId !=null and usId != ''">
and t.us_id= #{usId}
</if>
-
</select>
-
<!-- 淇濆瓨涓汉鐗╁搧淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveUserStorehouseInfoInstance" parameterType="Map">
@@ -76,16 +81,16 @@
<if test="usId !=null and usId != ''">
and t.us_id= #{usId}
</if>
-
</insert>
-
<!-- 鏌ヨ涓汉鐗╁搧淇℃伅 add by wuxw 2018-07-03 -->
<select id="getUserStorehouseInfo" parameterType="Map" resultType="Map">
select t.res_name,t.res_name resName,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id bId,t.store_id,t.store_id
- storeId,t.stock,t.res_id,t.res_id resId,t.user_id,t.user_id userId,t.us_id,t.us_id usId
- from user_storehouse t
- where 1 =1
+ storeId,t.stock,t.res_id,t.res_id resId,t.user_id,t.user_id userId,t.us_id,t.us_id usId,rs.res_code resCode,
+ rs.goods_type goodsType,rs.out_low_price outLowPrice,rs.out_high_price outHighPrice,rst.name goodsTypeName from user_storehouse t
+ left join resource_store rs on t.res_id = rs.res_id and rs.status_cd = '0'
+ left join resource_store_type rst on rs.goods_type = rst.goods_type and rst.status_cd = '0'
+ where 1 = 1
<if test="resName !=null and resName != ''">
and t.res_name= #{resName}
</if>
@@ -107,6 +112,9 @@
<if test="userId !=null and userId != ''">
and t.user_id= #{userId}
</if>
+ <if test="goodsType !=null and goodsType != ''">
+ and rs.goods_type= #{goodsType}
+ </if>
<if test="usId !=null and usId != ''">
and t.us_id= #{usId}
</if>
@@ -114,9 +122,7 @@
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
-
</select>
-
<!-- 淇敼涓汉鐗╁搧淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateUserStorehouseInfoInstance" parameterType="Map">
@@ -146,14 +152,14 @@
<if test="usId !=null and usId != ''">
and t.us_id= #{usId}
</if>
-
</update>
<!-- 鏌ヨ涓汉鐗╁搧鏁伴噺 add by wuxw 2018-07-03 -->
<select id="queryUserStorehousesCount" parameterType="Map" resultType="Map">
- select count(1) count
- from user_storehouse t
- where 1 =1
+ select count(1) count from user_storehouse t
+ left join resource_store rs on t.res_id = rs.res_id and rs.status_cd = '0'
+ left join resource_store_type rst on rs.goods_type = rst.goods_type and rst.status_cd = '0'
+ where 1 = 1
<if test="resName !=null and resName != ''">
and t.res_name= #{resName}
</if>
@@ -175,11 +181,11 @@
<if test="userId !=null and userId != ''">
and t.user_id= #{userId}
</if>
+ <if test="goodsType !=null and goodsType != ''">
+ and rs.goods_type= #{goodsType}
+ </if>
<if test="usId !=null and usId != ''">
and t.us_id= #{usId}
</if>
-
-
</select>
-
</mapper>
--
Gitblit v1.8.0