You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-java/src/main/resources/mybatis/mapper/basic/EntrustReceDao.xml

224 lines
8.2 KiB
XML

<?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.glxp.api.dao.basic.EntrustReceDao">
<select id="filterEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.entity.basic.EntrustReceEntity">
select *
from basic_entrust_accept
<where>
<if test="id != '' and id != null">
and id = #{id}
</if>
<if test="action != null">
and `action` = #{action}
</if>
<if test="entrustInv != null">
and entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser != null">
and entrustUser = #{entrustUser}
</if>
<if test="userId != null">
and userId = #{userId}
</if>
<if test="curInv != null">
and curInv = #{curInv}
</if>
<if test="entrustDept != null">
and entrustDept = #{entrustDept}
</if>
<if test="curDept != null">
and curDept = #{curDept}
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime
, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}
, '%Y-%m-%d %H:%i:%S')
]]>
</if>
</where>
order by updateTime desc
</select>
<select id="findByUnique" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.entity.basic.EntrustReceEntity">
select *
from basic_entrust_accept
where `action` = #{action}
and `entrustUser` = #{entrustUser}
limit 1
</select>
<select id="downloadEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.entity.basic.DlEntrustReceEntity">
select basic_entrust_accept.id,
b.name,
b.action,
b.mainAction
from basic_entrust_accept
INNER JOIN basic_bussiness_type b on basic_entrust_accept.action = b.action
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
<where>
<if test="id != '' and id != null">
and id = #{id}
</if>
<if test="action != null">
and basic_entrust_accept.action = #{action}
</if>
<if test="entrustInv != null">
and basic_entrust_accept.entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser != null">
and basic_entrust_accept.entrustUser = #{entrustUser}
</if>
<if test="userId != null">
and basic_entrust_accept.userId = #{userId}
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
</where>
</select>
<select id="filterJoinEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.res.basic.EntrustReceResponse">
select basic_entrust_accept.*,
a.name as curName,
b.name as entrustName,
auth_user.employeeName,
c.name as entrustInvName,
d.name as curInvName
from basic_entrust_accept
LEFT JOIN basic_bussiness_type a on basic_entrust_accept.action = a.action
LEFT JOIN basic_bussiness_type b on basic_entrust_accept.entrustAction = b.action
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
LEFT JOIN auth_warehouse c on basic_entrust_accept.entrustInv = c.`code`
LEFT JOIN auth_warehouse d on basic_entrust_accept.curInv = d.`code`
<where>
<if test="id != '' and id != null">
and id = #{id}
</if>
<if test="action != null">
and action = #{action}
</if>
<if test="entrustInv != null">
and entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser != null">
and entrustUser = #{entrustUser}
</if>
<if test="userId != null">
and userId = #{userId}
</if>
<if test="curInv != null">
and curInv = #{curInv}
</if>
<if test="name != null and name != ''">
and a.name like concat('%'
, #{name}
, '%')
</if>
</where>
group by basic_entrust_accept.id
order by updateTime desc
</select>
<insert id="insertEntrustRec" keyProperty="id"
parameterType="com.glxp.api.entity.basic.EntrustReceEntity">
replace
INTO basic_entrust_accept(`action`, curDept, entrustInv, `entrustUser`, userId,
updateTime, remark, entrustAction, finishRece, curInv, entrustDept, entrustInv,
entrustEnd)
values (#{action},
#{entrustInv},
#{entrustUser},
#{userId},
#{updateTime},
#{remark},
#{entrustAction},
#{finishRece},
#{curInv},
#{entrustDept},
#{entrustInv},
#{entrustEnd})
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM basic_entrust_accept
WHERE id = #{id}
</delete>
<delete id="deleteAll" parameterType="Map">
DELETE
FROM basic_entrust_accept
</delete>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.basic.EntrustReceEntity" useGeneratedKeys="true">
insert into basic_entrust_accept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
`action`,
curDept,
curInv,
userId,
entrustDept,
entrustInv,
entrustAction,
entrustUser,
finishRece,
updateTime,
remark,
entrustEnd,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{action,jdbcType=VARCHAR},
#{curDept,jdbcType=VARCHAR},
#{curInv,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR},
#{entrustDept,jdbcType=VARCHAR},
#{entrustInv,jdbcType=VARCHAR},
#{entrustAction,jdbcType=VARCHAR},
#{entrustUser,jdbcType=VARCHAR},
#{finishRece,jdbcType=TINYINT},
#{updateTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR},
#{entrustEnd,jdbcType=TINYINT},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
`action` = #{action,jdbcType=VARCHAR},
curDept = #{curDept,jdbcType=VARCHAR},
curInv = #{curInv,jdbcType=VARCHAR},
userId = #{userId,jdbcType=VARCHAR},
entrustDept = #{entrustDept,jdbcType=VARCHAR},
entrustInv = #{entrustInv,jdbcType=VARCHAR},
entrustAction = #{entrustAction,jdbcType=VARCHAR},
entrustUser = #{entrustUser,jdbcType=VARCHAR},
finishRece = #{finishRece,jdbcType=TINYINT},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR},
entrustEnd = #{entrustEnd,jdbcType=TINYINT},
</trim>
</insert>
</mapper>