From 88b54772dbcf5ecab1e2316e4e4626ac901b8908 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 22 一月 2019 15:58:24 +0800
Subject: [PATCH] 邀请码添加返回状态

---
 fanli/src/main/java/com/yeshi/fanli/mapping/user/UserGoodsStorageMapper.xml |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserGoodsStorageMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserGoodsStorageMapper.xml
index 0d704e4..39fe8ff 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserGoodsStorageMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserGoodsStorageMapper.xml
@@ -51,11 +51,55 @@
     </set> where guc_id = #{id,jdbcType=BIGINT}
   </update>
   
+   <insert id="insertBatch"  useGeneratedKeys="true" keyProperty="id"  parameterType="java.util.List">
+  		insert into yeshi_ec_user_goods_storage
+	     (<include refid="Base_Column_List" />)
+	    values
+  		
+  		<foreach collection="list" item="item" separator=",">
+		      (
+		 		#{item.id,jdbcType=BIGINT},
+		 		#{item.commonGoods.id,jdbcType=BIGINT},
+		 		#{item.uid,jdbcType=BIGINT},
+		 		#{item.state,jdbcType=INTEGER},
+		 		#{item.createTime.id,jdbcType=TIMESTAMP},
+		 		#{item.updateTime,jdbcType=TIMESTAMP}
+		     )
+		   
+  		</foreach>
+  </insert>
+  
+  	<update id="updateBatchSelective" parameterType="java.util.List">
+        update yeshi_ec_user_goods_storage 
+        <trim prefix="set" suffixOverrides=",">
+             <trim prefix="guc_state =case" suffix="end,">
+                <foreach collection="list" item="item" index="index">
+               	 	<if test="item.state !=null">
+                     when guc_id=#{item.id} then #{item.state}
+                     </if>
+                </foreach>
+            </trim>
+             <trim prefix="guc_updatetime =case" suffix="end,">
+                <foreach collection="list" item="item" index="index">
+               	 	<if test="item.updateTime !=null">
+                     when guc_id=#{item.id} then #{item.updateTime}
+                     </if>
+                </foreach>
+            </trim>
+        </trim>
+        where guc_id in
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item.id,jdbcType=BIGINT}
+        </foreach>
+ 	</update>
+   
+  
+  
   <select id="listQueryByUid" resultMap="BaseResultMap">
 	 SELECT * FROM yeshi_ec_user_goods_storage  tg
 	 LEFT JOIN  `yeshi_ec_common_goods` cg ON tg.`guc_common_id` = cg.`cg_id`
 	 WHERE tg.`guc_uid` = #{uid}
-	 ORDER BY tg.`guc_updatetime` DESC
+	 ORDER BY  cg.cg_state, tg.guc_state, tg.`guc_updatetime` DESC
      LIMIT #{start},#{count}
    </select>
    
@@ -88,4 +132,17 @@
 		WHERE g.`guc_uid` = #{uid} AND c.`cg_goods_id`= #{auctionId}  
    </select>
 	
+   <select id="listQueryByIds" resultMap="BaseResultMap" parameterType="java.util.List">
+		SELECT * FROM `yeshi_ec_user_goods_storage` g 
+		LEFT JOIN  `yeshi_ec_common_goods` c ON g.`guc_common_id` = c.`cg_id`
+		WHERE g.guc_id IN <foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+   </select>
+   
+   
+   	<update id="updateShareState" parameterType="java.lang.Long">
+		UPDATE `yeshi_ec_user_goods_storage` ts SET ts.`guc_state` = 1 
+		WHERE ts.`guc_common_id` IN
+		 (SELECT tg.`gu_common_goods_id` FROM yeshi_ec_share_goods_group tg WHERE tg.`gu_record_id` = #{shareId})
+	</update>
 </mapper>

--
Gitblit v1.8.0