<?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.SysAllottedInfoDao">
|
|
<resultMap type="SysAllottedInfo" id="SysAllottedInfoMap">
|
<id property="id" column="ID" />
|
<result property="allottedId" column="ALLOTTED_ID" />
|
<result property="allottedType" column="ALLOTTED_TYPE" />
|
<result property="allottedInstoreId" column="ALLOTTED_INSTORE_ID" />
|
<result property="allottedOutstoreId" column="ALLOTTED_OUTSTORE_ID" />
|
<result property="makingManId" column="MAKING_MAN_ID" />
|
<result property="appManId" column="APP_MAN_ID" />
|
<result property="allottedDate" column="ALLOTTED_DATE" />
|
<result property="allottedRemark" column="ALLOTTED_REMARK" />
|
<result property="appRemark" column="APP_REMARK" />
|
<result property="allottedTotal" column="ALLOTTED_TOTAL" />
|
<result property="checkStatus" column="CHECK_STATUS" />
|
|
<result property="amountPrice" column="amount_price" />
|
<result property="receivedPrice" column="received_price" />
|
|
|
<!-- 扩展属性 -->
|
<result property="allottedInstoreName" column="ALLOTTED_INSTORE_NAME" />
|
<result property="allottedOutstoreName" column="ALLOTTED_OUTSTORE_NAME" />
|
<result property="makingManName" column="MAKING_MAN_NAME" />
|
<result property="appManName" column="APP_MAN_NAME" />
|
<result property="companyId" column="company_id"/>
|
|
|
</resultMap>
|
|
|
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="SysAllottedInfo"
|
useGeneratedKeys="true" keyProperty="id">
|
INSERT INTO sys_allotted_info (
|
ID,
|
ALLOTTED_ID,
|
ALLOTTED_TYPE,
|
ALLOTTED_INSTORE_ID,
|
ALLOTTED_OUTSTORE_ID,
|
MAKING_MAN_ID,
|
APP_MAN_ID,
|
ALLOTTED_DATE,
|
ALLOTTED_REMARK,
|
APP_REMARK,
|
ALLOTTED_TOTAL,
|
CHECK_STATUS,
|
amount_price,
|
received_price,
|
company_id
|
)
|
VALUES (
|
#{id},
|
#{allottedId},
|
#{allottedType},
|
#{allottedInstoreId},
|
#{allottedOutstoreId},
|
#{makingManId},
|
#{appManId},
|
#{allottedDate},
|
#{allottedRemark},
|
#{appRemark},
|
#{allottedTotal},
|
#{checkStatus},
|
#{amountPrice},
|
#{receivedPrice},
|
#{companyId}
|
)
|
</insert>
|
|
|
<!-- 根据id更新 部分更新 -->
|
<update id="update" >
|
UPDATE sys_allotted_info
|
<set>
|
<if test="allottedId != null and allottedId !='' ">
|
ALLOTTED_ID = #{allottedId},
|
</if>
|
<if test="allottedType != null and allottedType !='' ">
|
ALLOTTED_TYPE = #{allottedType},
|
</if>
|
<if test="allottedInstoreId != null and allottedInstoreId !='' ">
|
ALLOTTED_INSTORE_ID = #{allottedInstoreId},
|
</if>
|
<if test="allottedOutstoreId != null and allottedOutstoreId !='' ">
|
ALLOTTED_OUTSTORE_ID = #{allottedOutstoreId},
|
</if>
|
<if test="makingManId != null and makingManId !='' ">
|
MAKING_MAN_ID = #{makingManId},
|
</if>
|
<if test="appManId != null and appManId !='' ">
|
APP_MAN_ID = #{appManId},
|
</if>
|
<if test="allottedDate != null ">
|
ALLOTTED_DATE = #{allottedDate},
|
</if>
|
<if test="allottedRemark != null and allottedRemark !='' ">
|
ALLOTTED_REMARK = #{allottedRemark},
|
</if>
|
<if test="appRemark != null and appRemark !='' ">
|
APP_REMARK = #{appRemark},
|
</if>
|
<if test="allottedTotal != null and allottedTotal !='' ">
|
ALLOTTED_TOTAL = #{allottedTotal},
|
</if>
|
<if test="checkStatus != null and checkStatus !='' ">
|
CHECK_STATUS = #{checkStatus},
|
</if>
|
<if test="amountPrice != null and amountPrice !='' ">
|
amount_price = #{amountPrice},
|
</if>
|
<if test="receivedPrice != null and receivedPrice !='' ">
|
received_price = #{receivedPrice},
|
</if>
|
|
</set>
|
WHERE ID=#{id}
|
</update>
|
|
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from sys_allotted_info where ID in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" >
|
DELETE FROM sys_allotted_info
|
where ID=#{id}
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="SysAllottedInfoMap">
|
select
|
ID,
|
ALLOTTED_ID,
|
ALLOTTED_TYPE,
|
ALLOTTED_INSTORE_ID,
|
amount_price,
|
received_price,
|
(select name from warehouse t where t.id = ALLOTTED_INSTORE_ID) ALLOTTED_INSTORE_NAME,
|
ALLOTTED_OUTSTORE_ID,
|
(select name from warehouse t where t.id = ALLOTTED_OUTSTORE_ID) ALLOTTED_OUTSTORE_NAME,
|
MAKING_MAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKING_MAN_ID) MAKING_MAN_NAME,
|
APP_MAN_ID,
|
(select su_name from sys_users t where t.su_id= APP_MAN_ID) APP_MAN_NAME,
|
ALLOTTED_DATE,
|
ALLOTTED_REMARK,
|
APP_REMARK,
|
ALLOTTED_TOTAL,
|
CHECK_STATUS
|
from sys_allotted_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.companyId != null and record.companyId !='' ">
|
company_id = #{record.companyId},
|
</if>
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.allottedId != null and record.allottedId !='' ">
|
and ALLOTTED_ID = #{record.allottedId}
|
</if>
|
<if test="record.allottedType != null and record.allottedType !='' ">
|
and ALLOTTED_TYPE = #{record.allottedType}
|
</if>
|
<if test="record.allottedInstoreId != null and record.allottedInstoreId !='' ">
|
and ALLOTTED_INSTORE_ID = #{record.allottedInstoreId}
|
</if>
|
<if test="record.allottedOutstoreId != null and record.allottedOutstoreId !='' ">
|
and ALLOTTED_OUTSTORE_ID = #{record.allottedOutstoreId}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKING_MAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APP_MAN_ID = #{record.appManId}
|
</if>
|
|
<if test="record.allottedDate != null and record.allottedDate !='' ">
|
and ALLOTTED_DATE = #{record.allottedDate}
|
</if>
|
|
<if test="record.startTime != null ">
|
and ALLOTTED_DATE >= #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[and ALLOTTED_DATE <= #{record.endTime}]]>
|
</if>
|
<if test="record.allottedRemark != null and record.allottedRemark !='' ">
|
and ALLOTTED_REMARK = #{record.allottedRemark}
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.allottedTotal != null and record.allottedTotal !='' ">
|
and ALLOTTED_TOTAL = #{record.allottedTotal}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</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_allotted_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.companyId != null and record.companyId !='' ">
|
company_id = #{record.companyId},
|
</if>
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.allottedId != null and record.allottedId !='' ">
|
and ALLOTTED_ID = #{record.allottedId}
|
</if>
|
<if test="record.allottedType != null and record.allottedType !='' ">
|
and ALLOTTED_TYPE = #{record.allottedType}
|
</if>
|
<if test="record.allottedInstoreId != null and record.allottedInstoreId !='' ">
|
and ALLOTTED_INSTORE_ID = #{record.allottedInstoreId}
|
</if>
|
<if test="record.allottedOutstoreId != null and record.allottedOutstoreId !='' ">
|
and ALLOTTED_OUTSTORE_ID = #{record.allottedOutstoreId}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKING_MAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APP_MAN_ID = #{record.appManId}
|
</if>
|
<if test="record.startTime != null ">
|
and ALLOTTED_DATE >= #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[and ALLOTTED_DATE <= #{record.endTime}]]>
|
</if>
|
<if test="record.allottedRemark != null and record.allottedRemark !='' ">
|
and ALLOTTED_REMARK = #{record.allottedRemark}
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.allottedTotal != null and record.allottedTotal !='' ">
|
and ALLOTTED_TOTAL = #{record.allottedTotal}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</if>
|
</if>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="SysAllottedInfoMap">
|
select
|
ID,
|
ALLOTTED_ID,
|
ALLOTTED_TYPE,
|
ALLOTTED_INSTORE_ID,
|
received_price,
|
amount_price,
|
(select name from warehouse t where t.id = ALLOTTED_INSTORE_ID) ALLOTTED_INSTORE_NAME,
|
ALLOTTED_OUTSTORE_ID,
|
(select name from warehouse t where t.id = ALLOTTED_OUTSTORE_ID) ALLOTTED_OUTSTORE_NAME,
|
MAKING_MAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKING_MAN_ID) MAKING_MAN_NAME,
|
APP_MAN_ID,
|
(select su_name from sys_users t where t.su_id= APP_MAN_ID) APP_MAN_NAME,
|
ALLOTTED_DATE,
|
ALLOTTED_REMARK,
|
APP_REMARK,
|
ALLOTTED_TOTAL,
|
CHECK_STATUS
|
from sys_allotted_info
|
where ID=#{id}
|
</select>
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="SysAllottedInfoMap">
|
select
|
ID,
|
ALLOTTED_ID,
|
ALLOTTED_TYPE,
|
ALLOTTED_INSTORE_ID,
|
received_price,
|
amount_price,
|
(select name from warehouse t where t.id = ALLOTTED_INSTORE_ID) ALLOTTED_INSTORE_NAME,
|
ALLOTTED_OUTSTORE_ID,
|
(select name from warehouse t where t.id = ALLOTTED_OUTSTORE_ID) ALLOTTED_OUTSTORE_NAME,
|
MAKING_MAN_ID,
|
(select su_name from sys_users t where t.su_id= MAKING_MAN_ID) MAKING_MAN_NAME,
|
APP_MAN_ID,
|
(select su_name from sys_users t where t.su_id= APP_MAN_ID) APP_MAN_NAME,
|
ALLOTTED_DATE,
|
ALLOTTED_REMARK,
|
APP_REMARK,
|
ALLOTTED_TOTAL,
|
CHECK_STATUS
|
from sys_allotted_info
|
where 1=1
|
<if test="record!=null">
|
<if test="record.companyId != null and record.companyId !='' ">
|
company_id = #{record.companyId},
|
</if>
|
<if test="record.id != null and record.id !='' ">
|
and ID = #{record.id}
|
</if>
|
<if test="record.allottedId != null and record.allottedId !='' ">
|
and ALLOTTED_ID = #{record.allottedId}
|
</if>
|
<if test="record.allottedType != null and record.allottedType !='' ">
|
and ALLOTTED_TYPE = #{record.allottedType}
|
</if>
|
<if test="record.allottedInstoreId != null and record.allottedInstoreId !='' ">
|
and ALLOTTED_INSTORE_ID = #{record.allottedInstoreId}
|
</if>
|
<if test="record.allottedOutstoreId != null and record.allottedOutstoreId !='' ">
|
and ALLOTTED_OUTSTORE_ID = #{record.allottedOutstoreId}
|
</if>
|
<if test="record.makingManId != null and record.makingManId !='' ">
|
and MAKING_MAN_ID = #{record.makingManId}
|
</if>
|
<if test="record.appManId != null and record.appManId !='' ">
|
and APP_MAN_ID = #{record.appManId}
|
</if>
|
<if test="record.startTime != null ">
|
and ALLOTTED_DATE >= #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
<![CDATA[and ALLOTTED_DATE <= #{record.endTime}]]>
|
</if>
|
<if test="record.allottedRemark != null and record.allottedRemark !='' ">
|
and ALLOTTED_REMARK = #{record.allottedRemark}
|
</if>
|
<if test="record.appRemark != null and record.appRemark !='' ">
|
and APP_REMARK = #{record.appRemark}
|
</if>
|
<if test="record.allottedTotal != null and record.allottedTotal !='' ">
|
and ALLOTTED_TOTAL = #{record.allottedTotal}
|
</if>
|
<if test="record.checkStatus != null and record.checkStatus !='' ">
|
and CHECK_STATUS = #{record.checkStatus}
|
</if>
|
</if>
|
</select>
|
</mapper>
|