|
|
|
|
<?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="cc.hiver.mall.dao.mapper.PurchaseMapper">
|
|
|
|
|
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.Purchase">
|
|
|
|
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
|
|
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
|
|
|
|
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
|
|
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
|
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
|
|
|
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
|
|
|
|
|
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
|
|
|
|
|
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
|
|
|
|
|
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
|
|
|
|
|
<result column="should_pay" jdbcType="DECIMAL" property="shouldPay" />
|
|
|
|
|
<result column="already_pay" jdbcType="DECIMAL" property="alreadyPay" />
|
|
|
|
|
<result column="no_pay" jdbcType="DECIMAL" property="noPay" />
|
|
|
|
|
<result column="other_pay" jdbcType="DECIMAL" property="otherPay" />
|
|
|
|
|
<result column="in_storage_status" jdbcType="INTEGER" property="inStorageStatus" />
|
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
<result column="balance_deduction_amount" jdbcType="DECIMAL" property="balanceDeductionAmount" />
|
|
|
|
|
<result column="purchase_time" jdbcType="TIMESTAMP" property="purchaseTime" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="DebtResultMap" type="cc.hiver.mall.pojo.dto.DebtSupplier">
|
|
|
|
|
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
|
|
|
|
|
<result column="consignee_name" jdbcType="VARCHAR" property="consigneeName" />
|
|
|
|
|
<result column="no_pay" jdbcType="DECIMAL" property="noPay" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="Example_Where_Clause">
|
|
|
|
|
<where>
|
|
|
|
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
|
|
|
<if test="criteria.valid">
|
|
|
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="criterion.noValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.singleValue">
|
|
|
|
|
and ${criterion.condition} #{criterion.value}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.betweenValue">
|
|
|
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.listValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
|
|
#{listItem}
|
|
|
|
|
</foreach>
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</foreach>
|
|
|
|
|
</trim>
|
|
|
|
|
</if>
|
|
|
|
|
</foreach>
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="Update_By_Example_Where_Clause">
|
|
|
|
|
<where>
|
|
|
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
|
|
|
<if test="criteria.valid">
|
|
|
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="criterion.noValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.singleValue">
|
|
|
|
|
and ${criterion.condition} #{criterion.value}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.betweenValue">
|
|
|
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.listValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
|
|
#{listItem}
|
|
|
|
|
</foreach>
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</foreach>
|
|
|
|
|
</trim>
|
|
|
|
|
</if>
|
|
|
|
|
</foreach>
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
id, create_by,create_by_name, create_time, del_flag, update_by, update_time, supplier_id,supplier_name, shop_id,
|
|
|
|
|
total_amount, should_pay, already_pay, no_pay,other_pay, in_storage_status,remark, balance_deduction_amount,
|
|
|
|
|
purchase_time
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectByExample" parameterType="cc.hiver.mall.entity.PurchaseExample" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<if test="distinct">
|
|
|
|
|
distinct
|
|
|
|
|
</if>
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
from t_purchase
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Example_Where_Clause" />
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderByClause != null">
|
|
|
|
|
order by ${orderByClause}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
from t_purchase
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
|
|
|
delete from t_purchase
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</delete>
|
|
|
|
|
<delete id="deleteByExample" parameterType="cc.hiver.mall.entity.PurchaseExample">
|
|
|
|
|
delete from t_purchase
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Example_Where_Clause" />
|
|
|
|
|
</if>
|
|
|
|
|
</delete>
|
|
|
|
|
<insert id="insert" parameterType="cc.hiver.mall.entity.Purchase">
|
|
|
|
|
insert into t_purchase (id, create_by, create_by_name, create_time,
|
|
|
|
|
del_flag, update_by, update_time,
|
|
|
|
|
supplier_id,supplier_name, shop_id, total_amount,
|
|
|
|
|
should_pay, already_pay, no_pay,other_pay, in_storage_status,remark, balance_deduction_amount,purchase_time
|
|
|
|
|
)
|
|
|
|
|
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{supplierId,jdbcType=VARCHAR},#{supplierName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
#{shouldPay,jdbcType=DECIMAL}, #{alreadyPay,jdbcType=DECIMAL}, #{noPay,jdbcType=DECIMAL}, #{otherPay,jdbcType=DECIMAL}, #{inStorageStatus,jdbcType=INTEGER},
|
|
|
|
|
#{remark,jdbcType=VARCHAR}, #{balanceDeductionAmount,jdbcType=DECIMAL},#{purchaseTime,jdbcType=TIMESTAMP}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Purchase">
|
|
|
|
|
insert into t_purchase
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
create_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createByName != null">
|
|
|
|
|
create_by_name,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
update_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierId != null">
|
|
|
|
|
supplier_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">
|
|
|
|
|
supplier_name,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shopId != null">
|
|
|
|
|
shop_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalAmount != null">
|
|
|
|
|
total_amount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shouldPay != null">
|
|
|
|
|
should_pay,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="alreadyPay != null">
|
|
|
|
|
already_pay,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="noPay != null">
|
|
|
|
|
no_pay,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="noPay != null">
|
|
|
|
|
other_pay,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="inStorageStatus != null">
|
|
|
|
|
in_storage_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="remark != null">
|
|
|
|
|
remark,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="balanceDeductionAmount != null">
|
|
|
|
|
balance_deduction_amount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="purchaseTime != null">
|
|
|
|
|
purchase_time,
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
#{id,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
#{createBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createByName != null">
|
|
|
|
|
#{createByName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
#{delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
#{updateBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierId != null">
|
|
|
|
|
#{supplierId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">
|
|
|
|
|
#{supplierName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shopId != null">
|
|
|
|
|
#{shopId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalAmount != null">
|
|
|
|
|
#{totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shouldPay != null">
|
|
|
|
|
#{shouldPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="alreadyPay != null">
|
|
|
|
|
#{alreadyPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="noPay != null">
|
|
|
|
|
#{noPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<select id="countByExample" parameterType="cc.hiver.mall.entity.PurchaseExample" resultType="java.lang.Long">
|
|
|
|
|
select count(*) from t_purchase
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Example_Where_Clause" />
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
|
|
|
update t_purchase
|
|
|
|
|
<set>
|
|
|
|
|
<if test="record.id != null">
|
|
|
|
|
id = #{record.id,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.createBy != null">
|
|
|
|
|
create_by = #{record.createBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.createByName != null">
|
|
|
|
|
create_by_name = #{record.createByName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.createTime != null">
|
|
|
|
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.delFlag != null">
|
|
|
|
|
del_flag = #{record.delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.updateBy != null">
|
|
|
|
|
update_by = #{record.updateBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.updateTime != null">
|
|
|
|
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.supplierId != null">
|
|
|
|
|
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.supplierName != null">
|
|
|
|
|
supplier_name = #{record.supplierName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.shopId != null">
|
|
|
|
|
shop_id = #{record.shopId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.totalAmount != null">
|
|
|
|
|
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.shouldPay != null">
|
|
|
|
|
should_pay = #{record.shouldPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.alreadyPay != null">
|
|
|
|
|
already_pay = #{record.alreadyPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.noPay != null">
|
|
|
|
|
no_pay = #{record.noPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.otherpay != null">
|
|
|
|
|
other_pay = #{record.otherpay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.inStorageStatus != null">
|
|
|
|
|
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.remark != null">
|
|
|
|
|
remark = #{record.remark,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.balanceDeductionAmount != null">
|
|
|
|
|
balance_deduction_amount = #{record.balanceDeductionAmount,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="record.purchaseTime != null">
|
|
|
|
|
purchase_time = #{record.purchaseTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByExample" parameterType="map">
|
|
|
|
|
update t_purchase
|
|
|
|
|
set id = #{record.id,jdbcType=VARCHAR},
|
|
|
|
|
create_by = #{record.createBy,jdbcType=VARCHAR},
|
|
|
|
|
create_by_name = #{record.createByName,jdbcType=VARCHAR},
|
|
|
|
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
del_flag = #{record.delFlag,jdbcType=INTEGER},
|
|
|
|
|
update_by = #{record.updateBy,jdbcType=VARCHAR},
|
|
|
|
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
|
|
|
|
|
supplier_name = #{record.supplierName,jdbcType=VARCHAR},
|
|
|
|
|
shop_id = #{record.shopId,jdbcType=VARCHAR},
|
|
|
|
|
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
should_pay = #{record.shouldPay,jdbcType=DECIMAL},
|
|
|
|
|
already_pay = #{record.alreadyPay,jdbcType=DECIMAL},
|
|
|
|
|
no_pay = #{record.noPay,jdbcType=DECIMAL},
|
|
|
|
|
other_pay = #{record.otherPay,jdbcType=DECIMAL},
|
|
|
|
|
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
|
|
|
|
|
remark = #{record.remark,jdbcType=VARCHAR},
|
|
|
|
|
balance_deduction_amount = #{record.balanceDeductionAmount,jdbcType=DECIMAL},
|
|
|
|
|
purchase_time = #{record.purchaseTime,jdbcType=TIMESTAMP}
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.Purchase">
|
|
|
|
|
update t_purchase
|
|
|
|
|
<set>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
create_by = #{createBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createByName != null">
|
|
|
|
|
create_by_name = #{createByName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
update_by = #{updateBy,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierId != null">
|
|
|
|
|
supplier_id = #{supplierId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">
|
|
|
|
|
supplier_name = #{supplierName,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shopId != null">
|
|
|
|
|
shop_id = #{shopId,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalAmount != null">
|
|
|
|
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="shouldPay != null">
|
|
|
|
|
should_pay = #{shouldPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="alreadyPay != null">
|
|
|
|
|
already_pay = #{alreadyPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="noPay != null">
|
|
|
|
|
no_pay = #{noPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="otherPay != null">
|
|
|
|
|
other_pay = #{otherPay,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="inStorageStatus != null">
|
|
|
|
|
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="remark != null">
|
|
|
|
|
remark = #{remark,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="balanceDeductionAmount != null">
|
|
|
|
|
balance_deduction_amount = #{balanceDeductionAmount,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="purchaseTime != null">
|
|
|
|
|
purchase_time = #{purchaseTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Purchase">
|
|
|
|
|
update t_purchase
|
|
|
|
|
set create_by = #{createBy,jdbcType=VARCHAR},
|
|
|
|
|
create_by_name = #{createByName,jdbcType=VARCHAR},
|
|
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
|
|
|
|
update_by = #{updateBy,jdbcType=VARCHAR},
|
|
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
supplier_id = #{supplierId,jdbcType=VARCHAR},
|
|
|
|
|
supplier_name = #{supplierName,jdbcType=VARCHAR},
|
|
|
|
|
shop_id = #{shopId,jdbcType=VARCHAR},
|
|
|
|
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
|
|
|
|
should_pay = #{shouldPay,jdbcType=DECIMAL},
|
|
|
|
|
already_pay = #{alreadyPay,jdbcType=DECIMAL},
|
|
|
|
|
no_pay = #{noPay,jdbcType=DECIMAL},
|
|
|
|
|
other_pay = #{otherPay,jdbcType=DECIMAL},
|
|
|
|
|
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
|
|
|
|
|
remark = #{remark,jdbcType=INTEGER},
|
|
|
|
|
balance_deduction_amount = #{balanceDeductionAmount,jdbcType=DECIMAL},
|
|
|
|
|
purchase_time = #{purchaseTime,jdbcType=TIMESTAMP}
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="selectDebtByShopId" resultMap="DebtResultMap">
|
|
|
|
|
SELECT
|
|
|
|
|
tc.id as supplier_id,
|
|
|
|
|
tc.consignee_name,
|
|
|
|
|
td.amount_owed as no_pay
|
|
|
|
|
FROM
|
|
|
|
|
t_supplier tc
|
|
|
|
|
LEFT JOIN t_debt td ON tc.id = td.user_id
|
|
|
|
|
WHERE
|
|
|
|
|
tc.del_flag = '0'
|
|
|
|
|
and tc.shop_id = #{queryParams.shopId}
|
|
|
|
|
order by no_earn desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPurchaseList" parameterType="cc.hiver.mall.pojo.query.PurchasePageQuery" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from t_purchase
|
|
|
|
|
where shop_id = #{queryParams.shopId}
|
|
|
|
|
<if test="queryParams.startDate != null and queryParams.startDate != '' and queryParams.endDate != null and queryParams.endDate != ''">
|
|
|
|
|
and purchase_time BETWEEN #{queryParams.startDate} AND #{queryParams.endDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='queryParams.fromWhere!=null and queryParams.fromWhere.trim() neq ""'>
|
|
|
|
|
<if test='queryParams.fromWhere == "0"'>
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="queryParams.isAiList != null and queryParams.isAiList != ''">
|
|
|
|
|
<!-- 查询ai列表-->
|
|
|
|
|
and in_storage_status in ('2','3','4')
|
|
|
|
|
</if>
|
|
|
|
|
<!-- 根据供货商查询 -->
|
|
|
|
|
<if test="queryParams.supplierId != null and queryParams.supplierId != ''">
|
|
|
|
|
and supplier_id = #{queryParams.supplierId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
|
|
|
|
|
and (id in(
|
|
|
|
|
select purchase_id from t_purchase_detail
|
|
|
|
|
where product_id in (
|
|
|
|
|
select id from t_product
|
|
|
|
|
where product_name like concat('%',#{queryParams.searchStr},'%')
|
|
|
|
|
or product_sn like concat('%',#{queryParams.searchStr},'%')
|
|
|
|
|
)
|
|
|
|
|
group by purchase_id
|
|
|
|
|
)
|
|
|
|
|
or supplier_name like concat('%',#{queryParams.searchStr},'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
order by purchase_time desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getPurchaseListByProductId" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
from t_purchase
|
|
|
|
|
where del_flag ='0'
|
|
|
|
|
and in_storage_status = 1
|
|
|
|
|
and id in (select purchase_id from t_purchase_detail where del_flag ='0' and product_id =#{productId})
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPurchasingCost" resultType="java.math.BigDecimal">
|
|
|
|
|
select
|
|
|
|
|
IFNULL(sum(should_pay),0.00) as purchasingCost
|
|
|
|
|
from t_purchase
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and shop_id = #{shopId}
|
|
|
|
|
and create_time BETWEEN #{startTime} AND #{endTime}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="updateInStorageStatus" >
|
|
|
|
|
update t_purchase
|
|
|
|
|
set
|
|
|
|
|
in_storage_status = #{inStorageStatus,jdbcType=INTEGER}
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="deleteByPurchaseId" >
|
|
|
|
|
update t_purchase
|
|
|
|
|
set
|
|
|
|
|
del_flag = '1'
|
|
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="purchasingCostDetail" resultType="cc.hiver.mall.pojo.vo.PurchasingCostDetailVo">
|
|
|
|
|
SELECT
|
|
|
|
|
tp.id AS purchase_id,
|
|
|
|
|
tp.create_by,
|
|
|
|
|
tp.create_by_name,
|
|
|
|
|
tp.supplier_id,
|
|
|
|
|
tp.supplier_name,
|
|
|
|
|
tp.create_time AS purchase_date,
|
|
|
|
|
tp.should_pay AS total_cost,
|
|
|
|
|
cb.product_count,
|
|
|
|
|
cb.product_num
|
|
|
|
|
FROM
|
|
|
|
|
t_purchase tp
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
purchase_id,
|
|
|
|
|
del_flag,
|
|
|
|
|
count( product_id ) AS product_num,
|
|
|
|
|
sum( product_count ) AS product_count
|
|
|
|
|
FROM
|
|
|
|
|
t_purchase_detail tpd
|
|
|
|
|
WHERE
|
|
|
|
|
shop_id = #{purchasePageQuery.shopId}
|
|
|
|
|
GROUP BY
|
|
|
|
|
tpd.purchase_id,
|
|
|
|
|
del_flag
|
|
|
|
|
) cb ON tp.id = cb.purchase_id
|
|
|
|
|
WHERE
|
|
|
|
|
cb.del_flag = '0'
|
|
|
|
|
AND in_storage_status = '1'
|
|
|
|
|
AND shop_id = #{purchasePageQuery.shopId}
|
|
|
|
|
<if test='purchasePageQuery.createByName !=null and purchasePageQuery.createByName !=""'>
|
|
|
|
|
and create_by_name like concat('%',#{purchasePageQuery.createByName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test='purchasePageQuery.supplierName !=null and purchasePageQuery.supplierName !=""'>
|
|
|
|
|
and supplier_name like concat('%',#{purchasePageQuery.supplierName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test='purchasePageQuery.startDate !=null and purchasePageQuery.endDate !=null'>
|
|
|
|
|
and create_time BETWEEN #{purchasePageQuery.startDate} AND #{purchasePageQuery.endDate}
|
|
|
|
|
</if>
|
|
|
|
|
order by purchase_date desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getArrearsAndTotalSale" resultType="cc.hiver.mall.bill.vo.ArrearsVo">
|
|
|
|
|
select
|
|
|
|
|
sum(tp.no_pay) as arrears,
|
|
|
|
|
sum(tp.should_pay) as total_sale
|
|
|
|
|
from
|
|
|
|
|
t_purchase tp
|
|
|
|
|
WHERE
|
|
|
|
|
tp.del_flag = '0'
|
|
|
|
|
and tp.supplier_id = #{supplierBillQueryVo.supplierId}
|
|
|
|
|
and tp.shop_id = #{supplierBillQueryVo.shopId}
|
|
|
|
|
<!-- 状态为已入库的 -->
|
|
|
|
|
and tp.in_storage_status = '1'
|
|
|
|
|
<if test='supplierBillQueryVo.startDate !=null and supplierBillQueryVo.endDate !=null'>
|
|
|
|
|
and tp.create_time BETWEEN #{supplierBillQueryVo.startDate} AND #{supplierBillQueryVo.endDate}
|
|
|
|
|
</if>
|
|
|
|
|
order by tp.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPurchaseListBySupplierId" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
from t_purchase
|
|
|
|
|
where del_flag ='0'
|
|
|
|
|
and supplier_id = #{purchasePageQuery.supplierId}
|
|
|
|
|
and in_storage_status = '1'
|
|
|
|
|
<if test='purchasePageQuery.startDate !=null and purchasePageQuery.endDate !=null'>
|
|
|
|
|
and create_time BETWEEN #{purchasePageQuery.startDate} AND #{purchasePageQuery.endDate}
|
|
|
|
|
</if>
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|