admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
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>