|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
<mapper namespace="com.yohoufo.dal.product.StorageDepositMapper" >
|
|
|
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.StorageDeposit" >
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
<result column="product_id" property="productId" jdbcType="INTEGER" />
|
|
|
<result column="goods_id" property="goodsId" jdbcType="INTEGER" />
|
|
|
<result column="storage_id" property="storageId" jdbcType="INTEGER" />
|
|
|
<result column="deposit_code" property="depositCode" jdbcType="VARCHAR" />
|
|
|
<result column="shelf_code" property="shelfCode" jdbcType="VARCHAR" />
|
|
|
<result column="owner_uid" property="ownerUid" jdbcType="INTEGER" />
|
|
|
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
|
|
|
<result column="skup" property="skup" jdbcType="BIGINT" />
|
|
|
<result column="status" property="status" jdbcType="INTEGER" />
|
|
|
<result column="order_status" property="orderStatus" jdbcType="INTEGER" />
|
|
|
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
|
|
|
<result column="create_time" property="createTime" jdbcType="INTEGER" />
|
|
|
<result column="deposit_start_time" property="depositStartTime" jdbcType="INTEGER" />
|
|
|
<result column="deposit_end_time" property="depositEndTime" jdbcType="INTEGER" />
|
|
|
<result column="edit_pid" property="editPid" jdbcType="INTEGER" />
|
|
|
<result column="del_status" property="delStatus" jdbcType="INTEGER" />
|
|
|
<result column="out_type" property="outType" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" >
|
|
|
<result column="product_id" property="productId" jdbcType="INTEGER" />
|
|
|
<result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" />
|
|
|
<result column="storage_count" property="storageCount" jdbcType="INTEGER" />
|
|
|
<result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="Base_Column_List" >
|
|
|
id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
|
|
|
skup, status, order_status, update_time, create_time, deposit_start_time, deposit_end_time,
|
|
|
edit_pid, del_status, out_type
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from storage_deposit
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
delete from storage_deposit
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.yohoufo.dal.order.model.StorageDeposit" >
|
|
|
insert into storage_deposit (id, product_id, goods_id,
|
|
|
storage_id, deposit_code, shelf_code,
|
|
|
owner_uid, order_code, skup,
|
|
|
status, order_status, update_time,
|
|
|
create_time, deposit_start_time, deposit_end_time,
|
|
|
edit_pid, del_status, out_type
|
|
|
)
|
|
|
values (#{id,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER},
|
|
|
#{storageId,jdbcType=INTEGER}, #{depositCode,jdbcType=VARCHAR}, #{shelfCode,jdbcType=VARCHAR},
|
|
|
#{ownerUid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{skup,jdbcType=BIGINT},
|
|
|
#{status,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
|
|
|
#{createTime,jdbcType=INTEGER}, #{depositStartTime,jdbcType=INTEGER}, #{depositEndTime,jdbcType=INTEGER},
|
|
|
#{editPid,jdbcType=INTEGER}, #{delStatus,jdbcType=INTEGER}, #{outType,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.yohoufo.dal.order.model.StorageDeposit" >
|
|
|
insert into storage_deposit
|
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
<if test="id != null" >
|
|
|
id,
|
|
|
</if>
|
|
|
<if test="productId != null" >
|
|
|
product_id,
|
|
|
</if>
|
|
|
<if test="goodsId != null" >
|
|
|
goods_id,
|
|
|
</if>
|
|
|
<if test="storageId != null" >
|
|
|
storage_id,
|
|
|
</if>
|
|
|
<if test="depositCode != null" >
|
|
|
deposit_code,
|
|
|
</if>
|
|
|
<if test="shelfCode != null" >
|
|
|
shelf_code,
|
|
|
</if>
|
|
|
<if test="ownerUid != null" >
|
|
|
owner_uid,
|
|
|
</if>
|
|
|
<if test="orderCode != null" >
|
|
|
order_code,
|
|
|
</if>
|
|
|
<if test="skup != null" >
|
|
|
skup,
|
|
|
</if>
|
|
|
<if test="status != null" >
|
|
|
status,
|
|
|
</if>
|
|
|
<if test="orderStatus != null" >
|
|
|
order_status,
|
|
|
</if>
|
|
|
<if test="updateTime != null" >
|
|
|
update_time,
|
|
|
</if>
|
|
|
<if test="createTime != null" >
|
|
|
create_time,
|
|
|
</if>
|
|
|
<if test="depositStartTime != null" >
|
|
|
deposit_start_time,
|
|
|
</if>
|
|
|
<if test="depositEndTime != null" >
|
|
|
deposit_end_time,
|
|
|
</if>
|
|
|
<if test="editPid != null" >
|
|
|
edit_pid,
|
|
|
</if>
|
|
|
<if test="delStatus != null" >
|
|
|
del_status,
|
|
|
</if>
|
|
|
<if test="outType != null" >
|
|
|
out_type,
|
|
|
</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
<if test="id != null" >
|
|
|
#{id,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="productId != null" >
|
|
|
#{productId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="goodsId != null" >
|
|
|
#{goodsId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="storageId != null" >
|
|
|
#{storageId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositCode != null" >
|
|
|
#{depositCode,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="shelfCode != null" >
|
|
|
#{shelfCode,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="ownerUid != null" >
|
|
|
#{ownerUid,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="orderCode != null" >
|
|
|
#{orderCode,jdbcType=BIGINT},
|
|
|
</if>
|
|
|
<if test="skup != null" >
|
|
|
#{skup,jdbcType=BIGINT},
|
|
|
</if>
|
|
|
<if test="status != null" >
|
|
|
#{status,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="orderStatus != null" >
|
|
|
#{orderStatus,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null" >
|
|
|
#{updateTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="createTime != null" >
|
|
|
#{createTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositStartTime != null" >
|
|
|
#{depositStartTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositEndTime != null" >
|
|
|
#{depositEndTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="editPid != null" >
|
|
|
#{editPid,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="delStatus != null" >
|
|
|
#{delStatus,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="outType != null" >
|
|
|
#{outType,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.StorageDeposit" >
|
|
|
update storage_deposit
|
|
|
<set >
|
|
|
<if test="productId != null" >
|
|
|
product_id = #{productId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="goodsId != null" >
|
|
|
goods_id = #{goodsId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="storageId != null" >
|
|
|
storage_id = #{storageId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositCode != null" >
|
|
|
deposit_code = #{depositCode,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="shelfCode != null" >
|
|
|
shelf_code = #{shelfCode,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="ownerUid != null" >
|
|
|
owner_uid = #{ownerUid,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="orderCode != null" >
|
|
|
order_code = #{orderCode,jdbcType=BIGINT},
|
|
|
</if>
|
|
|
<if test="skup != null" >
|
|
|
skup = #{skup,jdbcType=BIGINT},
|
|
|
</if>
|
|
|
<if test="status != null" >
|
|
|
status = #{status,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="orderStatus != null" >
|
|
|
order_status = #{orderStatus,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null" >
|
|
|
update_time = #{updateTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="createTime != null" >
|
|
|
create_time = #{createTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositStartTime != null" >
|
|
|
deposit_start_time = #{depositStartTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="depositEndTime != null" >
|
|
|
deposit_end_time = #{depositEndTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="editPid != null" >
|
|
|
edit_pid = #{editPid,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="delStatus != null" >
|
|
|
del_status = #{delStatus,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="outType != null" >
|
|
|
out_type = #{outType,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.StorageDeposit" >
|
|
|
update storage_deposit
|
|
|
set product_id = #{productId,jdbcType=INTEGER},
|
|
|
goods_id = #{goodsId,jdbcType=INTEGER},
|
|
|
storage_id = #{storageId,jdbcType=INTEGER},
|
|
|
deposit_code = #{depositCode,jdbcType=VARCHAR},
|
|
|
shelf_code = #{shelfCode,jdbcType=VARCHAR},
|
|
|
owner_uid = #{ownerUid,jdbcType=INTEGER},
|
|
|
order_code = #{orderCode,jdbcType=BIGINT},
|
|
|
skup = #{skup,jdbcType=BIGINT},
|
|
|
status = #{status,jdbcType=INTEGER},
|
|
|
order_status = #{orderStatus,jdbcType=INTEGER},
|
|
|
update_time = #{updateTime,jdbcType=INTEGER},
|
|
|
create_time = #{createTime,jdbcType=INTEGER},
|
|
|
deposit_start_time = #{depositStartTime,jdbcType=INTEGER},
|
|
|
deposit_end_time = #{depositEndTime,jdbcType=INTEGER},
|
|
|
edit_pid = #{editPid,jdbcType=INTEGER},
|
|
|
del_status = #{delStatus,jdbcType=INTEGER},
|
|
|
out_type = #{outType,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<select id="queryUserDepositProductCount" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select count(distinct product_id) from storage_deposit
|
|
|
where owner_uid = #{uid} and status=1 and del_status=0
|
|
|
</select>
|
|
|
<select id="queryUserDepositProductId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select distinct product_id from storage_deposit
|
|
|
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
|
|
|
</select>
|
|
|
|
|
|
<select id="queryUserDepositProduct" resultMap="CountResultMap">
|
|
|
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count from storage_deposit
|
|
|
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
|
|
|
and product_id in
|
|
|
<foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
group by product_id
|
|
|
</select>
|
|
|
<select id="queryUserDopositBackCount" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select count(*) from storage_deposit
|
|
|
where owner_uid = #{uid} and status in(2,3,4) and out_type in(0,1) and del_status=0
|
|
|
</select>
|
|
|
<select id="queryUserDopositBack" resultMap="BaseResultMap">
|
|
|
select * from storage_deposit
|
|
|
where owner_uid = #{uid} and status in(2,3,4) and out_type in(0,1) and del_status=0
|
|
|
limit #{start}, #{count}
|
|
|
</select>
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|