@ -3,8 +3,49 @@
<mapper namespace= "com.xm.core.entity.XmTask" >
<mapper namespace= "com.xm.core.entity.XmTask" >
<!-- 开始 自定sql函数区域 -->
<!-- 请在此区域添加自定义函数 -->
<!-- 开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 -->
<sql id= "whereForMap" >
<if test= " ids != null" > and (res.id) in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item})
</foreach>
</if> <if test= " createTimeStart !=null " > and res.create_time > #{createTimeStart} </if>
<if test= " createTimeEnd !=null " > and res.create_time < #{createTimeEnd} </if>
<include refid= "where" />
<if test= "parent != null and parent != ''" > and (res.parent_taskid = '' or res.parent_taskid IS NULL)</if>
<!-- 我参与的 -->
<if test= " (myExecuserStatus != null and myExecuserStatus) != '' or ( isMy !=null and isMy !='' )" >
and exists ( select 1 from xm_task_execuser exe where exe.task_id=res.id and exe.userid=#{userid}
<if test= ' myExecuserStatus != "all" and myExecuserStatus!=null and myExecuserStatus !="" ' >
and exe.status=#{myExecuserStatus}
</if>
)
</if>
<!-- 我关注的 -->
<if test= "myFocus != null and myFocus != ''" >
and exists ( select 1 from xm_my_focus f where f.userid=#{userid} and f.project_id=res.project_id and f.task_id=res.id )
</if>
<if test= "skillIds != null and skillIds != ''" >
and exists ( select 1 from xm_task_skill f where f.task_id=res.id and f.task_skill_id in
<foreach collection= "skillIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
)
</if>
<if test= "compete !=null and compete!=''" >
and ( exists ( select 1 from xm_project_group_user gu where gu.userid=#{compete} and gu.project_id=res.project_id )
or exists ( select 1 from xm_task_execuser exe where exe.project_id=res.project_id and exe.userid=#{compete})
)
</if>
<if test= "iterationId!=null and iterationId!=''" >
and exists ( select 1 from xm_iteration_menu im where im.menu_id=res.menu_id and im.iteration_id=#{iterationId})
</if>
<if test= "key != null and key !='' " > and res.name like #{key} </if>
<if test= "work != null and work != ''" > and res.rate != '100' </if>
</sql>
<select id= "getAvgRate" parameterType= "String" resultType= "long" >
<select id= "getAvgRate" parameterType= "String" resultType= "long" >
select avg(res.rate) from xm_task res where res.parent_taskid = #{parentTaskid}
select avg(res.rate) from xm_task res where res.parent_taskid = #{parentTaskid}
</select>
</select>
@ -104,6 +145,7 @@
</foreach>
</foreach>
</select>
</select>
<!-- 结束 自定义sql函数区域 -->
<!-- 结束 自定义sql函数区域 -->
@ -114,49 +156,10 @@
from xm_task res left join xm_task_process_approva pa on res.id=pa.xm_task_id and res.biz_proc_inst_id=pa.proc_inst_id
from xm_task res left join xm_task_process_approva pa on res.id=pa.xm_task_id and res.biz_proc_inst_id=pa.proc_inst_id
left join xm_project p on p.id=res.project_id
left join xm_project p on p.id=res.project_id
<where >
<where >
<if test= "ids != null" > and
id in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " createTimeStart !=null " > and res.create_time > #{createTimeStart} </if>
<if test= " createTimeEnd !=null " > and res.create_time < #{createTimeEnd} </if>
<include refid= "whereForMap" />
<include refid= "where" />
<include refid= "where" />
<if test= "parent != null and parent != ''" > and (res.parent_taskid = '' or res.parent_taskid IS NULL)</if>
<!-- 我参与的 -->
<if test= " (myExecuserStatus != null and myExecuserStatus) != '' or ( isMy !=null and isMy !='' )" >
and exists ( select 1 from xm_task_execuser exe where exe.task_id=res.id and exe.userid=#{userid}
<if test= ' myExecuserStatus != "all" and myExecuserStatus!=null and myExecuserStatus !="" ' >
and exe.status=#{myExecuserStatus}
</if>
)
</if>
<!-- 我关注的 -->
<if test= "myFocus != null and myFocus != ''" >
and exists ( select 1 from xm_my_focus f where f.userid=#{userid} and f.project_id=res.project_id and f.task_id=res.id )
</if>
<if test= "skillIds != null and skillIds != ''" >
and exists ( select 1 from xm_task_skill f where f.task_id=res.id and f.task_skill_id in
<foreach collection= "skillIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
)
</if>
<if test= "compete !=null and compete!=''" >
and ( exists ( select 1 from xm_project_group_user gu where gu.userid=#{compete} and gu.project_id=res.project_id )
or exists ( select 1 from xm_task_execuser exe where exe.project_id=res.project_id and exe.userid=#{compete})
)
</if>
<if test= "iterationId!=null and iterationId!=''" >
and exists ( select 1 from xm_iteration_menu im where im.menu_id=res.menu_id and im.iteration_id=#{iterationId})
</if>
<if test= "key != null and key !='' " > and res.name like #{key} </if>
<if test= "work != null and work != ''" > and res.rate != '100' </if>
</where>
</where>
order by res.sort_level asc
order by res.sort_level asc
</select>
</select>
@ -193,15 +196,15 @@
insert into xm_task(
insert into xm_task(
<include refid= "columns" />
<include refid= "columns" />
) values (
) values (
#{id},#{name},#{parentTaskid},#{parentTaskname},#{projectId},#{projectName},#{level},#{sortLevel},#{executorUserid},#{executorUsername},#{preTaskid},#{preTaskname},#{startTime},#{endTime},#{milestone},#{description},#{remarks},#{createUserid},#{createUsername},#{createTime},#{rate},#{budgetCost},#{budgetWorkload},#{actCost},#{actWorkload},#{taskState},#{taskType},#{taskClass},#{toTaskCenter},#{actStartTime},#{actEndTime},#{bizProcInstId},#{bizFlowState},#{projectPhaseId},#{projectPhaseName},#{taskSkillNames},#{exeUsernames},#{taskSkillIds},#{exeUserids},#{taskOut},#{planType},#{settleSchemel},#{menuId},#{menuName},#{productId},#{productName},#{cbranchId},#{cdeptid}
#{id},#{name},#{parentTaskid},#{parentTaskname},#{projectId},#{projectName},#{level},#{sortLevel},#{executorUserid},#{executorUsername},#{preTaskid},#{preTaskname},#{startTime},#{endTime},#{milestone},#{description},#{remarks},#{createUserid},#{createUsername},#{createTime},#{rate},#{budgetCost},#{budgetWorkload},#{actCost},#{actWorkload},#{taskState},#{taskType},#{taskClass},#{toTaskCenter},#{actStartTime},#{actEndTime},#{bizProcInstId},#{bizFlowState},#{projectPhaseId},#{projectPhaseName},#{taskSkillNames},#{exeUsernames},#{taskSkillIds},#{exeUserids},#{taskOut},#{planType},#{settleSchemel},#{menuId},#{menuName},#{productId},#{productName},#{cbranchId},#{cdeptid},#{tagIds},#{tagNames},#{ntype},#{childrenCnt},#{ltime}
)
)
</insert>
</insert>
<!-- 按条件删除若干条记录 -->
<!-- 按条件删除若干条记录 -->
<delete id= "deleteByWhere" parameterType= "com.xm.core.entity.XmTask" >
<delete id= "deleteByWhere" parameterType= "com.xm.core.entity.XmTask" >
delete from xm_task
delete from xm_task res
<where >
<where >
1=2
<include refid= "where" />
</where>
</where>
</delete>
</delete>
@ -247,18 +250,16 @@
<delete id= "batchDelete" parameterType= "List" >
<delete id= "batchDelete" parameterType= "List" >
delete from xm_task
delete from xm_task
where
where
(id)
in
(id) in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item.id}
)
( #{item.id} )
</foreach>
</foreach>
</delete>
</delete>
<!-- sql片段 列 -->
<!-- sql片段 列 -->
<sql id= "columns" >
<sql id= "columns" >
id,name,parent_taskid,parent_taskname,project_id,project_name,level,sort_level,executor_userid,executor_username,pre_taskid,pre_taskname,start_time,end_time,milestone,description,remarks,create_userid,create_username,create_time,rate,budget_cost,budget_workload,act_cost,act_workload,task_state,task_type,task_class,to_task_center,act_start_time,act_end_time,biz_proc_inst_id,biz_flow_state,project_phase_id,project_phase_name,task_skill_names,exe_usernames,task_skill_ids,exe_userids,task_out,plan_type,settle_schemel,menu_id,menu_name,product_id,product_name,cbranch_id,cdeptid
id,name,parent_taskid,parent_taskname,project_id,project_name,level,sort_level,executor_userid,executor_username,pre_taskid,pre_taskname,start_time,end_time,milestone,description,remarks,create_userid,create_username,create_time,rate,budget_cost,budget_workload,act_cost,act_workload,task_state,task_type,task_class,to_task_center,act_start_time,act_end_time,biz_proc_inst_id,biz_flow_state,project_phase_id,project_phase_name,task_skill_names,exe_usernames,task_skill_ids,exe_userids,task_out,plan_type,settle_schemel,menu_id,menu_name,product_id,product_name,cbranch_id,cdeptid,tag_ids,tag_names,ntype,children_cnt,ltime
</sql>
</sql>
<!-- sql片段 动态条件 YYYY - MM - DD HH24:MI:SS -->
<!-- sql片段 动态条件 YYYY - MM - DD HH24:MI:SS -->
@ -311,6 +312,11 @@
<if test= "productName != null and productName != ''" > and res.product_name = #{productName} </if>
<if test= "productName != null and productName != ''" > and res.product_name = #{productName} </if>
<if test= "cbranchId != null and cbranchId != ''" > and res.cbranch_id = #{cbranchId} </if>
<if test= "cbranchId != null and cbranchId != ''" > and res.cbranch_id = #{cbranchId} </if>
<if test= "cdeptid != null and cdeptid != ''" > and res.cdeptid = #{cdeptid} </if>
<if test= "cdeptid != null and cdeptid != ''" > and res.cdeptid = #{cdeptid} </if>
<if test= "tagIds != null and tagIds != ''" > and res.tag_ids = #{tagIds} </if>
<if test= "tagNames != null and tagNames != ''" > and res.tag_names = #{tagNames} </if>
<if test= "ntype != null and ntype != ''" > and res.ntype = #{ntype} </if>
<if test= "childrenCnt != null and childrenCnt != ''" > and res.children_cnt = #{childrenCnt} </if>
<if test= "ltime != null" > and date_format(res.ltime,'%Y-%m-%d') = date_format(#{ltime},'%Y-%m-%d') </if>
</sql>
</sql>
<!-- sql片段 更新字段 -->
<!-- sql片段 更新字段 -->
<sql id= "set" >
<sql id= "set" >
@ -360,7 +366,12 @@
product_id = #{productId},
product_id = #{productId},
product_name = #{productName},
product_name = #{productName},
cbranch_id = #{cbranchId},
cbranch_id = #{cbranchId},
cdeptid = #{cdeptid}
cdeptid = #{cdeptid},
tag_ids = #{tagIds},
tag_names = #{tagNames},
ntype = #{ntype},
children_cnt = #{childrenCnt},
ltime = #{ltime}
</sql>
</sql>
<sql id= "someFieldSet" >
<sql id= "someFieldSet" >
<if test= "name != null and name != ''" > name = #{name}, </if>
<if test= "name != null and name != ''" > name = #{name}, </if>
@ -410,6 +421,11 @@
<if test= "productName != null and productName != ''" > product_name = #{productName}, </if>
<if test= "productName != null and productName != ''" > product_name = #{productName}, </if>
<if test= "cbranchId != null and cbranchId != ''" > cbranch_id = #{cbranchId}, </if>
<if test= "cbranchId != null and cbranchId != ''" > cbranch_id = #{cbranchId}, </if>
<if test= "cdeptid != null and cdeptid != ''" > cdeptid = #{cdeptid}, </if>
<if test= "cdeptid != null and cdeptid != ''" > cdeptid = #{cdeptid}, </if>
<if test= "tagIds != null and tagIds != ''" > tag_ids = #{tagIds}, </if>
<if test= "tagNames != null and tagNames != ''" > tag_names = #{tagNames}, </if>
<if test= "ntype != null and ntype != ''" > ntype = #{ntype}, </if>
<if test= "childrenCnt != null and childrenCnt != ''" > children_cnt = #{childrenCnt}, </if>
<if test= "ltime != null" > ltime = #{ltime}, </if>
</sql>
</sql>
<!-- sql片段 批量更新 -->
<!-- sql片段 批量更新 -->
<sql id= "batchSet" >
<sql id= "batchSet" >
@ -459,6 +475,11 @@
product_id = #{item.productId},
product_id = #{item.productId},
product_name = #{item.productName},
product_name = #{item.productName},
cbranch_id = #{item.cbranchId},
cbranch_id = #{item.cbranchId},
cdeptid = #{item.cdeptid}
cdeptid = #{item.cdeptid},
tag_ids = #{item.tagIds},
tag_names = #{item.tagNames},
ntype = #{item.ntype},
children_cnt = #{item.childrenCnt},
ltime = #{item.ltime}
</sql>
</sql>
</mapper>
</mapper>