<?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.matrix.system.hive.dao.SysCheckInfoDao">
|
|
<resultMap type="SysCheckInfo" id="SysCheckInfoMap">
|
<id property="id" column="ID" />
|
<result property="checkNo" column="CHECK_NO" />
|
<result property="checkType" column="CHECK_TYPE" />
|
<result property="checkStoreid" column="CHECK_STORE_ID" />
|
<result property="createDate" column="create_Date" />
|
<result property="makingManId" column="MAKINGMAN_ID" />
|
<result property="appManId" column="APPMAN_ID" />
|
<result property="checkDate" column="CHECK_DATE" />
|
<result property="appRemark" column="APP_REMARK" />
|
<result property="checkStatus" column="CHECK_STATUS" />
|
<result property="remark" column="REMARK" />
|
<result property="shopId" column="shop_id"/>
|
<result property="companyId" column="company_id"/>
|
|
<!-- 扩展属性 -->
|
<result property="checkStoreName" column="CHECK_STORE_NAME" />
|
<result property="makingManName" column="MAKING_MAN_NAME" />
|
<result property="appManName" column="APP_MAN_NAME" />
|
|
</resultMap>
|
|
<!-- 获得调拨单明细 -->
|
<select id="getCheckDetailInfo" resultMap="com.matrix.system.hive.dao.SysCheckDetailDao.SysCheckDetailMap">
|
select
|
id,
|
check_id,
|
sku_id,
|
begin_balance,
|
income_num,
|
outcome_num,
|
end_balance,
|
price,
|
priceSum,
|
actuallySum,
|
remark
|
from
|
sys_check_detail
|
where
|
check_id=#{checkId}
|
</select>
|
|
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="SysCheckInfo"
|
useGeneratedKeys="true" keyProperty="id">
|
INSERT INTO sys_check_info (
|
ID,
|
CHECK_NO,
|
CHECK_TYPE,
|
CHECK_STORE_ID,
|
create_Date,
|
MAKINGMAN_ID,
|
APPMAN_ID,
|
CHECK_DATE,
|
APP_REMARK,
|
CHECK_STATUS,
|
REMARK,
|
shop_id,
|
company_id
|
)
|
VALUES (
|
#{id},
|
#{checkNo},
|
#{checkType},
|
#{checkStoreid},
|
#{createDate},
|
#{makingManId},
|
#{appManId},
|
#{checkDate},
|
#{appRemark},
|
#{checkStatus},
|
#{remark},
|
#{shopId},
|
#{companyId}
|
)
|
</insert>
|
|
|
<!-- 根据id更新 部分更新 -->
|
<update id="update" >
|
UPDATE sys_check_info
|
<set>
|
<if test="checkNo != null and checkNo !='' ">
|
CHECK_NO = #{checkNo},
|
</if>
|
<if test="checkType != null and checkType !='' ">
|
CHECK_TYPE = #{checkType},
|
</if>
|
<if test="checkStoreid != null and checkStoreid !='' ">
|
CHECK_STORE_ID = #{checkStoreid},
|
</if>
|
<if test="createDate != null ">
|
create_Date = #{createDate},
|
</if>
|
<if test="makingManId != null and makingManId !='' ">
|
MAKINGMAN_ID = #{makingManId},
|
</if>
|
<if test="appManId != null and appManId !='' ">
|
APPMAN_ID = #{appManId},
|
</if>
|
<if test="checkDate != null and checkDate !='' ">
|
CHECK_DATE = #{checkDate},
|
</if>
|
<if test="appRemark != null and appRemark !='' ">
|
APP_REMARK = #{appRemark},
|
</if>
|
<if test="checkStatus != null and checkStatus !='' ">
|
CHECK_STATUS = #{checkStatus},
|
</if>
|
<if test="remark != null and remark !='' ">
|
REMARK = #{remark},
|
</if>
|
|
</set>
|
WHERE ID=#{id}
|
</update>
|
|
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from sys_check_info where ID in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" >
|
DELETE FROM sys_check_info
|
where ID=#{id}
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="SysCheckInfoMap">
|
select
|
ID,
|
CHECK_NO,
|
CHECK_TYPE,
|
CHECK_STORE_ID,
|
(select NAME from warehouse t where t.id=CHECK_STORE_ID) CHECK_STORE_NAME,
|
create_Date,
|
MAKINGMAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKINGMAN_ID) MAKING_MAN_NAME,
|
APPMAN_ID,
|
(select su_name from sys_users t where t.su_id= APPMAN_ID) APP_MAN_NAME,
|
CHECK_DATE,
|
APP_REMARK,
|
CHECK_STATUS,
|
REMARK,
|
shop_id,
|
company_id
|
from sys_check_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.checkNo != null and record.checkNo !='' ">
|
and CHECK_NO = #{record.checkNo}
|
</if>
|
<if test="record.checkType != null and record.checkType !='' ">
|
and CHECK_TYPE = #{record.checkType}
|
</if>
|
<if test="record.checkStoreid != null and record.checkStoreid !='' ">
|
and CHECK_STORE_ID = #{record.checkStoreid}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKINGMAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APPMAN_ID = #{record.appManId}
|
</if>
|
<if test="record.startTime != null ">
|
<![CDATA[
|
and create_Date >= #{record.startTime}
|
]]>
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[
|
and create_Date <= #{record.endTime}
|
]]>
|
</if>
|
<if test="record.checkDate != null and record.checkDate !='' ">
|
and CHECK_DATE = #{record.checkDate}
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</if>
|
<if test="record.remark != null and record.remark !='' ">
|
and REMARK = #{record.remark}
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
and shop_id = #{record.shopId}
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
</if>
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by
|
${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit
|
#{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
</select>
|
|
<!-- 查询总条 -->
|
<select id="selectTotalRecord" resultType="java.lang.Integer">
|
select count(*)
|
from sys_check_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.checkNo != null and record.checkNo !='' ">
|
and CHECK_NO = #{record.checkNo}
|
</if>
|
<if test="record.checkType != null and record.checkType !='' ">
|
and CHECK_TYPE = #{record.checkType}
|
</if>
|
<if test="record.checkStoreid != null and record.checkStoreid !='' ">
|
and CHECK_STORE_ID = #{record.checkStoreid}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKINGMAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APPMAN_ID = #{record.appManId}
|
</if>
|
<if test="record.startTime != null ">
|
<![CDATA[
|
and create_Date >= #{record.startTime}
|
]]>
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[
|
and create_Date <= #{record.endTime}
|
]]>
|
</if>
|
<if test="record.checkDate != null and record.checkDate !='' ">
|
and CHECK_DATE = #{record.checkDate}
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</if>
|
<if test="record.remark != null and record.remark !='' ">
|
and REMARK = #{record.remark}
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
and shop_id = #{record.shopId}
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
</if>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="SysCheckInfoMap">
|
select
|
ID,
|
CHECK_NO,
|
CHECK_TYPE,
|
CHECK_STORE_ID,
|
(select NAME from warehouse t where t.id=CHECK_STORE_ID) CHECK_STORE_NAME,
|
create_Date,
|
MAKINGMAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKINGMAN_ID) MAKING_MAN_NAME,
|
APPMAN_ID,
|
(select su_name from sys_users t where t.su_id= APPMAN_ID) APP_MAN_NAME,
|
CHECK_DATE,
|
APP_REMARK,
|
CHECK_STATUS,
|
REMARK,
|
shop_id,
|
company_id
|
from sys_check_info
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="SysCheckInfoMap">
|
select
|
ID,
|
CHECK_NO,
|
CHECK_TYPE,
|
CHECK_STORE_ID,
|
(select NAME from warehouse t where t.id=CHECK_STORE_ID) CHECK_STORE_NAME,
|
create_Date,
|
MAKINGMAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKINGMAN_ID) MAKING_MAN_NAME,
|
APPMAN_ID,
|
(select su_name from sys_users t where t.su_id= APPMAN_ID) APP_MAN_NAME,
|
CHECK_DATE,
|
APP_REMARK,
|
CHECK_STATUS,
|
REMARK,
|
shop_id,
|
company_id
|
from sys_check_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.checkNo != null and record.checkNo !='' ">
|
and CHECK_NO = #{record.checkNo}
|
</if>
|
<if test="record.checkType != null and record.checkType !='' ">
|
and CHECK_TYPE = #{record.checkType}
|
</if>
|
<if test="record.checkStoreid != null and record.checkStoreid !='' ">
|
and CHECK_STORE_ID = #{record.checkStoreid}
|
</if>
|
<if test="record.createDate != null ">
|
and create_Date = #{record.createDate}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKINGMAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APPMAN_ID = #{record.appManId}
|
</if>
|
<if test="record.startTime != null ">
|
and CHECK_DATE >= #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[
|
and CHECK_DATE = #{record.endTime}
|
]]>
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</if>
|
<if test="record.remark != null and record.remark !='' ">
|
and REMARK = #{record.remark}
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
and shop_id = #{record.shopId}
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
</if>
|
</select>
|
|
|
<select id="insertDetail">
|
call pro_check(#{storeId},#{checkId});
|
</select>
|
</mapper>
|