ganzi-api/inventory-dao/src/main/resources/mapper/OADistributionMapper.xml
2022-11-23 13:40:07 +08:00

341 lines
14 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.rzyc.mapper.OADistributionMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.OADistribution">
<id column="OADistributionId" jdbcType="VARCHAR" property="oadistributionid" />
<result column="OATaskId" jdbcType="VARCHAR" property="oataskid" />
<result column="SysUserId" jdbcType="VARCHAR" property="sysuserid" />
<result column="SysChinaName" jdbcType="VARCHAR" property="syschinaname" />
<result column="SysTelephone" jdbcType="VARCHAR" property="systelephone" />
<result column="title" property="title" />
<result column="subject" property="subject" />
<result column="flow_time" property="flowState" />
<result column="flow_state" property="flowState" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
</resultMap>
<sql id="Base_Column_List">
OADistributionId, OATaskId,sned_id, SysUserId, SysChinaName, SysTelephone, title,
subject,flow_time,flow_state,start_time,end_time,AppStatus, CreatedOn,
CreatedBy, ModifiedOn, ModifiedBy
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from OADistribution
where OADistributionId = #{oadistributionid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from OADistribution
where OADistributionId = #{oadistributionid,jdbcType=VARCHAR}
</delete>
<insert id="insertOAdistribution" parameterType="com.rzyc.model.OADistribution">
insert into OADistribution (OADistributionId, OATaskId, sned_id,SysUserId,
SysChinaName, SysTelephone, AppStatus,title,subject,start_time,end_time,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy)
values (#{oadistributionid,jdbcType=VARCHAR}, #{oataskid,jdbcType=VARCHAR}, #{snedId},#{sysuserid,jdbcType=VARCHAR},
#{syschinaname,jdbcType=VARCHAR}, #{systelephone,jdbcType=VARCHAR}, #{appstatus,jdbcType=VARCHAR},#{title},#{subject},#{startTime},#{endTime},
#{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.OADistribution">
insert into OADistribution
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="oadistributionid != null">
OADistributionId,
</if>
<if test="oataskid != null">
OATaskId,
</if>
<if test="sysuserid != null">
SysUserId,
</if>
<if test="syschinaname != null">
SysChinaName,
</if>
<if test="systelephone != null">
SysTelephone,
</if>
<if test="appstatus != null">
AppStatus,
</if>
<if test="createdon != null">
CreatedOn,
</if>
<if test="createdby != null">
CreatedBy,
</if>
<if test="modifiedon != null">
ModifiedOn,
</if>
<if test="modifiedby != null">
ModifiedBy,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="oadistributionid != null">
#{oadistributionid,jdbcType=VARCHAR},
</if>
<if test="oataskid != null">
#{oataskid,jdbcType=VARCHAR},
</if>
<if test="sysuserid != null">
#{sysuserid,jdbcType=VARCHAR},
</if>
<if test="syschinaname != null">
#{syschinaname,jdbcType=VARCHAR},
</if>
<if test="systelephone != null">
#{systelephone,jdbcType=VARCHAR},
</if>
<if test="appstatus != null">
#{appstatus,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
#{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
#{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
#{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
#{modifiedby,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.OADistribution">
update OADistribution
<set>
<if test="oataskid != null">
OATaskId = #{oataskid,jdbcType=VARCHAR},
</if>
<if test="sysuserid != null">
SysUserId = #{sysuserid,jdbcType=VARCHAR},
</if>
<if test="syschinaname != null">
SysChinaName = #{syschinaname,jdbcType=VARCHAR},
</if>
<if test="systelephone != null">
SysTelephone = #{systelephone,jdbcType=VARCHAR},
</if>
<if test="appstatus != null">
AppStatus = #{appstatus,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
CreatedBy = #{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
</set>
where OADistributionId = #{oadistributionid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.OADistribution">
update OADistribution
set OATaskId = #{oataskid,jdbcType=VARCHAR},
SysUserId = #{sysuserid,jdbcType=VARCHAR},
SysChinaName = #{syschinaname,jdbcType=VARCHAR},
SysTelephone = #{systelephone,jdbcType=VARCHAR},
AppStatus = #{appstatus,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where OADistributionId = #{oadistributionid,jdbcType=VARCHAR}
</update>
<!--批量添加-->
<insert id="insertList" parameterType="com.rzyc.model.check.ChkGovBillDetailWithBLOBs">
insert into OADistribution (OADistributionId, OATaskId, SysUserId,
SysChinaName, SysTelephone, title,subject,flow_time,flow_state,start_time,end_time,AppStatus,file
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy)
values
<foreach collection ="records" item="record" index= "index" separator =",">
(#{record.oadistributionid,jdbcType=VARCHAR}, #{record.oataskid,jdbcType=VARCHAR},
#{record.sysuserid,jdbcType=VARCHAR},
#{record.syschinaname,jdbcType=VARCHAR}, #{record.systelephone,jdbcType=VARCHAR}, #{record.title},#{record,subject},
#{record.flowTime},#{record.flowState},#{record.startTime},#{record.endTime},#{record.appstatus,jdbcType=VARCHAR},#{record.file},
#{record.createdon,jdbcType=TIMESTAMP}, #{record.createdby,jdbcType=VARCHAR},
#{record.modifiedon,jdbcType=TIMESTAMP},
#{record.modifiedby,jdbcType=VARCHAR})
</foreach>
</insert>
<resultMap id="ReceiveResultMap" type="com.rzyc.model.OADistribution">
<id column="OADistributionId" jdbcType="VARCHAR" property="oadistributionid" />
<result column="OATaskId" jdbcType="VARCHAR" property="oataskid" />
<result column="SysUserId" jdbcType="VARCHAR" property="sysuserid" />
<result column="SysChinaName" jdbcType="VARCHAR" property="syschinaname" />
<result column="receiveName" jdbcType="VARCHAR" property="receiveName" />
<result column="SysTelephone" jdbcType="VARCHAR" property="systelephone" />
<result column="AppStatus" jdbcType="VARCHAR" property="appstatus" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
</resultMap>
<!--任务接收人-->
<select id="receiveUser" resultMap="ReceiveResultMap">
SELECT su.`ChinaName` receiveName,ob.* FROM OADistribution ob
LEFT JOIN SysUser su ON ob.`SysUserId` = su.`SysUserId`
WHERE ob.`OATaskId` = #{taskId}
</select>
<!--任务接收部门-->
<select id="receiveUnit" resultMap="ReceiveResultMap">
SELECT lp.`PerformClassName` receiveName,ob.* FROM OADistribution ob
LEFT JOIN ListPerform lp ON ob.`SysUserId` = lp.ListPerformId
WHERE ob.`OATaskId` = #{taskId}
</select>
<!--修改读取状态-->
<update id="changeStatus">
UPDATE OADistribution SET AppStatus = "已读" WHERE OATaskId = #{taskId}
AND SysUserId = #{sysUserId}
</update>
<select id="deliverTaskList" resultType="com.rzyc.model.OADistribution">
select ob.* from OADistribution ob
where ob.subject like #{condition}
and ob.sned_id = #{snedId}
order by ob.end_time asc
</select>
<select id="getTaskList" resultType="com.rzyc.model.OADistribution">
select ob.* from OADistribution ob
where ob.subject like #{condition}
and ob.SysUserId = #{snedId}
order by ob.end_time asc
</select>
<update id="updateDistriubtion" parameterType="com.rzyc.model.OADistribution">
update OADistribution
set OATaskId = #{oaDistribution.oataskid,jdbcType=VARCHAR},
sned_id = #{oaDistribution.snedId,jdbcType=VARCHAR},
SysUserId = #{oaDistribution.sysuserid,jdbcType=VARCHAR},
SysChinaName = #{oaDistribution.syschinaname,jdbcType=VARCHAR},
SysTelephone = #{oaDistribution.systelephone,jdbcType=VARCHAR},
title = #{oaDistribution.title},
subject = #{oaDistribution.subject},
flow_time = #{oaDistribution.flowTime},
flow_state = #{oaDistribution.flowState},
start_time = #{oaDistribution.startTime},
end_time = #{oaDistribution.endTime},
AppStatus = #{oaDistribution.appstatus,jdbcType=VARCHAR},
CreatedOn = #{oaDistribution.createdon,jdbcType=TIMESTAMP},
CreatedBy = #{oaDistribution.createdby,jdbcType=VARCHAR},
ModifiedOn = #{oaDistribution.modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{oaDistribution.modifiedby,jdbcType=VARCHAR}
where OADistributionId = #{oaDistribution.oadistributionid}
</update>
<!--专项工作详情-->
<!--<select id="singleWorkDetail" resultType="com.rzyc.bean.task.vo.SingleWorkVo">
select ot.OATaskId,ot.send_id,ot.StartDate,ot.EndDate,ot.Subject,ot.send_id,ot.AppStatus,ot.title,ot.CreatedOn
from oatask ot
join OADistribution od on ot.OATaskId = od.OATaskId
where od.OADistributionId = #{idDto.id}
</select>-->
<!--专项工作详情-->
<select id="singleWorkDetail" resultType="com.rzyc.bean.task.vo.SingleWorkVo">
select ot.OATaskId,ot.send_id,ot.StartDate,ot.EndDate,ot.Subject,ot.send_id,ot.AppStatus,ot.title,ot.CreatedOn
from oatask ot
join OADistribution od on ot.OATaskId = od.OATaskId
where od.OADistributionId = #{idDto.id}
</select>
<select id="selectName" resultType="com.rzyc.bean.task.vo.NameVo">
select od.SysChinaName as name
from OADistribution od
join oatask ot
on ot.OATaskId = od.OATaskId
where od.OATaskId = #{nameDto.taskId}
and ot.TaskType = #{nameDto.taskTypeId}
</select>
<!--分配任务-->
<insert id="deliverTask" parameterType="java.util.List">
insert into
OADistribution (OADistributionId, OATaskId, sned_id,SysUserId,
SysChinaName, SysTelephone, AppStatus,title,subject,flow_time,flow_state,start_time,end_time,
CreatedOn, CreatedBy, ModifiedOn,ModifiedBy)
values
<foreach collection="distributions" item="item" index="index" separator="," >
(#{item.oadistributionid}, #{item.oataskid}, #{item.snedId},#{item.sysuserid},
#{item.syschinaname}, #{item.systelephone}, #{item.appstatus},#{item.title},#{item.subject},#{item.flowTime},#{item.flowState},#{item.startTime},#{item.endTime},
#{item.createdon}, #{item.createdby}, #{item.modifiedon},
#{item.modifiedby})
</foreach>
</insert>
<!--任务流转人-->
<select id="selectFlowUser" resultType="com.rzyc.bean.task.vo.FlowUserVo">
select od.OADistributionId,od.SysUserId,s.SysDeptName ,s.ChinaName
from OADistribution od
join sysuser s
on od.SysUserId = s.SysUserId
where od.OATaskId = #{flowUserDto.OATaskId} and od.sned_id = #{flowUserDto.send_id}
</select>
<!--任务流转人任务详情-->
<select id="FlowUserDetail" resultType="com.rzyc.bean.task.vo.FlowDetailVo">
select od.OADistributionId,od.OATaskId,od.title,od.subject,od.start_time,od.end_time,od.AppStatus
from OADistribution od
where od.OADistributionId = #{idDto.id}
</select>
<select id="selectDistribution" resultType="com.rzyc.model.OADistribution">
select od.* from OADistribution od where od.OADistributionId = #{oaDistributionId}
</select>
<!--查看接收任务状态-->
<select id="selectImplementation" resultType="com.rzyc.bean.task.vo.ImplementationVo">
select od.OADistributionId,od.OATaskId,od.CreatedOn as creatTime,od.ModifiedOn as finishTime,od.SysUserId,
su.SysDeptName ,su.ChinaName,od.title,od.subject,od.AppStatus
from OADistribution od
join sysuser su
on od.SysUserId = su.SysUserId
where od.OATaskId = #{deliverDto.OATaskId}
</select>
<!--查询任务参与人姓名-->
<select id="selectJoinUser" resultType="com.rzyc.bean.task.vo.NameVo">
select su.SysDeptName,su.ChinaName as name
from OADistribution od
join sysuser su
on od.SysUserId = su.SysUserId
where od.OATaskId = #{addWorkDto.oaTaskId}
</select>
<select id="checkExist" resultType="int" parameterType="string">
select count(*) from OADistribution where OADistribution.OATaskId = #{oataskid} and OADistribution.sysUserId = #{sysUserId}
</select>
</mapper>