<?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="workPoolV1ServiceDaoImpl">
|
|
|
<!-- 保存工作单信息 add by wuxw 2018-07-03 -->
|
<insert id="saveWorkPoolInfo" parameterType="Map">
|
insert into work_pool(
|
work_cycle,create_user_id,create_user_name,store_id,work_name,work_id,wt_id,create_user_tel,start_time,end_time,state,community_id
|
) values (
|
#{workCycle},#{createUserId},#{createUserName},#{storeId},#{workName},#{workId},#{wtId},#{createUserTel},#{startTime},#{endTime},#{state},#{communityId}
|
)
|
</insert>
|
|
|
<!-- 查询工作单信息 add by wuxw 2018-07-03 -->
|
<select id="getWorkPoolInfo" parameterType="Map" resultType="Map">
|
select t.work_cycle,t.work_cycle workCycle,t.create_user_id,t.create_user_id
|
createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
|
statusCd,t.store_id,t.store_id storeId,t.work_name,t.work_name workName,t.work_id,t.work_id
|
workId,t.wt_id,t.wt_id wtId,t.create_user_tel,t.create_user_tel createUserTel,t.start_time,t.start_time
|
startTime,t.end_time,t.end_time endTime,t.state,t.community_id,t.community_id communityId,t.create_time createTime,
|
td.`name` stateName,wt.type_name typeName,wt.deduction
|
from work_pool t
|
left join work_type wt on t.wt_id = wt.wt_id
|
left join t_dict td on t.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="createUserId !=null and createUserId != ''">
|
and t.create_user_id= #{createUserId}
|
</if>
|
<if test="createUserName !=null and createUserName != ''">
|
and t.create_user_name= #{createUserName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
<if test="createUserTel !=null and createUserTel != ''">
|
and t.create_user_tel= #{createUserTel}
|
</if>
|
<if test="startTime !=null and startTime != ''">
|
and t.start_time= #{startTime}
|
</if>
|
<if test="endTime !=null and endTime != ''">
|
and t.end_time= #{endTime}
|
</if>
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and t.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and t.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and t.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
order by t.create_time desc
|
<if test="page != -1 and page != null ">
|
limit #{page}, #{row}
|
</if>
|
|
</select>
|
|
|
<!-- 修改工作单信息 add by wuxw 2018-07-03 -->
|
<update id="updateWorkPoolInfo" parameterType="Map">
|
update work_pool t set t.status_cd = #{statusCd}
|
<if test="newBId != null and newBId != ''">
|
,t.b_id = #{newBId}
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
, t.work_cycle= #{workCycle}
|
</if>
|
<if test="createUserId !=null and createUserId != ''">
|
, t.create_user_id= #{createUserId}
|
</if>
|
<if test="createUserName !=null and createUserName != ''">
|
, t.create_user_name= #{createUserName}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
, t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
, t.work_name= #{workName}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
, t.wt_id= #{wtId}
|
</if>
|
<if test="createUserTel !=null and createUserTel != ''">
|
, t.create_user_tel= #{createUserTel}
|
</if>
|
<if test="startTime !=null and startTime != ''">
|
, t.start_time= #{startTime}
|
</if>
|
<if test="endTime !=null and endTime != ''">
|
, t.end_time= #{endTime}
|
</if>
|
<if test="state !=null and state != ''">
|
, t.state= #{state}
|
</if>
|
where 1=1
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
|
</update>
|
|
<!-- 查询工作单数量 add by wuxw 2018-07-03 -->
|
<select id="queryWorkPoolsCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from work_pool t
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="createUserId !=null and createUserId != ''">
|
and t.create_user_id= #{createUserId}
|
</if>
|
<if test="createUserName !=null and createUserName != ''">
|
and t.create_user_name= #{createUserName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
<if test="createUserTel !=null and createUserTel != ''">
|
and t.create_user_tel= #{createUserTel}
|
</if>
|
<if test="startTime !=null and startTime != ''">
|
and t.start_time= #{startTime}
|
</if>
|
<if test="endTime !=null and endTime != ''">
|
and t.end_time= #{endTime}
|
</if>
|
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and t.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and t.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and t.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
|
|
</select>
|
|
<select id="queryTaskWorkPoolsCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from work_pool t
|
left join work_type wt on t.wt_id = wt.wt_id
|
left join work_task wtk on t.work_id = wtk.work_id and wtk.status_cd = '0'
|
left join t_dict td on wtk.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="staffId !=null and staffId != ''">
|
and wtk.staff_id= #{staffId}
|
</if>
|
<if test="staffName !=null and staffName != ''">
|
and wtk.staff_name = #{staffName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
<if test="states != null">
|
and t.state in
|
<foreach collection="states" item="item" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
</if>
|
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and wtk.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and wtk.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and wtk.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
|
|
</select>
|
|
<select id="queryTaskWorkPools" parameterType="Map" resultType="Map">
|
select t.work_cycle,t.work_cycle workCycle,t.create_user_id
|
createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
|
statusCd,t.store_id storeId,t.work_name workName,t.work_id
|
workId,t.wt_id wtId,t.create_user_tel createUserTel,wtk.start_time
|
startTime,wtk.end_time endTime,wtk.state,t.community_id communityId,t.create_time createTime,
|
td.`name` stateName,wt.type_name typeName,wtk.staff_name curStaffName,wtk.task_id taskId
|
from work_pool t
|
left join work_type wt on t.wt_id = wt.wt_id
|
left join work_task wtk on t.work_id = wtk.work_id and wtk.status_cd = '0'
|
left join t_dict td on wtk.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="staffId !=null and staffId != ''">
|
and wtk.staff_id= #{staffId}
|
</if>
|
<if test="staffName !=null and staffName != ''">
|
and wtk.staff_name = #{staffName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
<if test="states != null">
|
and t.state in
|
<foreach collection="states" item="item" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
</if>
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and wtk.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and wtk.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and wtk.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
order by wtk.create_time desc
|
<if test="page != -1 and page != null ">
|
limit #{page}, #{row}
|
</if>
|
|
</select>
|
|
<select id="queryCopyWorkPoolsCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from work_pool t
|
left join work_type wt on t.wt_id = wt.wt_id
|
left join work_copy wc on t.work_id = wc.work_id and wc.status_cd = '0'
|
left join t_dict td on wc.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="staffId !=null and staffId != ''">
|
and wc.staff_id= #{staffId}
|
</if>
|
<if test="staffName !=null and staffName != ''">
|
and wc.staff_name = #{staffName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and wc.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and wc.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and wc.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
|
|
</select>
|
|
<select id="queryCopyWorkPools" parameterType="Map" resultType="Map">
|
select t.work_cycle,t.work_cycle workCycle,t.create_user_id
|
createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
|
statusCd,t.store_id storeId,t.work_name workName,t.work_id
|
workId,t.wt_id wtId,t.create_user_tel createUserTel,t.start_time
|
startTime,t.end_time endTime,wc.state,t.community_id communityId,t.create_time createTime,
|
td.`name` stateName,wt.type_name typeName,wc.staff_name curCopyName,wc.copy_id copyId,wc.remark
|
from work_pool t
|
left join work_type wt on t.wt_id = wt.wt_id
|
left join work_copy wc on t.work_id = wc.work_id and wc.status_cd = '0'
|
left join t_dict td on wc.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
|
where 1 =1
|
<if test="createUserNameLike !=null and createUserNameLike != ''">
|
and t.create_user_name like concat('%', #{createUserNameLike},'%')
|
</if>
|
<if test="workNameLike !=null and workNameLike != ''">
|
and t.work_name like concat('%', #{workNameLike},'%')
|
</if>
|
<if test="workCycle !=null and workCycle != ''">
|
and t.work_cycle= #{workCycle}
|
</if>
|
<if test="staffId !=null and staffId != ''">
|
and wc.staff_id= #{staffId}
|
</if>
|
<if test="staffName !=null and staffName != ''">
|
and wc.staff_name = #{staffName}
|
</if>
|
<if test="statusCd !=null and statusCd != ''">
|
and t.status_cd= #{statusCd}
|
</if>
|
<if test="storeId !=null and storeId != ''">
|
and t.store_id= #{storeId}
|
</if>
|
<if test="workName !=null and workName != ''">
|
and t.work_name= #{workName}
|
</if>
|
<if test="workId !=null and workId != ''">
|
and t.work_id= #{workId}
|
</if>
|
<if test="wtId !=null and wtId != ''">
|
and t.wt_id= #{wtId}
|
</if>
|
|
<if test="queryStartTime !=null and queryStartTime !=''">
|
and wc.create_time >= #{queryStartTime}
|
</if>
|
<if test="queryEndTime !=null and queryEndTime !=''">
|
and wc.create_time <= #{queryEndTime}
|
</if>
|
<if test="state !=null and state != ''">
|
and wc.state= #{state}
|
</if>
|
<if test="communityId !=null and communityId != ''">
|
and t.community_id= #{communityId}
|
</if>
|
order by wc.create_time desc
|
<if test="page != -1 and page != null ">
|
limit #{page}, #{row}
|
</if>
|
|
</select>
|
|
</mapper>
|