@ -4,7 +4,7 @@
<!-- 开始 自定sql函数区域 -->
<!-- 请在此区域添加自定义函数 -->
<!-- 请在此区域添加自定义函数 -->
<!-- 插入流程审批表数据 -->
<insert id= "insertProcessApprova"
@ -16,16 +16,16 @@
#{id},#{projectId},#{flowBranchId},#{agree},#{actId},#{taskName},#{procInstId},#{mainTitle},#{commentMsg},#{flowLastTime},#{eventName},#{bizKey},#{modelKey},#{assignee},#{startUserid},#{procDefId}
)
</insert>
<!-- 同时修改业务表及流程审批表数据状态 -->
<update id= "updateProcessApprova"
parameterType="HashMap">
update XM.xm_project b ,XM.xm_project_process_approva pa
update XM.xm_project b ,XM.xm_project_process_approva pa
<set >
<if test= ' agree != null and agree !="" ' > pa.agree = #{agree},</if>
<if test= ' actId != null and actId !="" ' > pa.act_id = #{actId},</if>
<if test= ' assignee != null and assignee !="" ' > pa.assignee = #{assignee},</if>
<if test= ' assigneeName != null and assigneeName !="" ' > pa.assignee_name = #{assigneeName},</if>
<if test= ' assignee != null and assignee !="" ' > pa.assignee = #{assignee},</if>
<if test= ' assigneeName != null and assigneeName !="" ' > pa.assignee_name = #{assigneeName},</if>
<if test= ' taskName != null and taskName !="" ' > pa.task_name = #{taskName},</if>
<if test= ' commentMsg != null and commentMsg !="" ' > pa.comment_msg = #{commentMsg},</if>
pa.flow_last_time = now(),
@ -35,22 +35,22 @@
<if test= ' bizProcInstId != null and bizProcInstId !="" ' > b.biz_proc_inst_id=#{bizProcInstId},</if>
</set>
where pa.proc_inst_id = #{procInstId} and pa.flow_branch_id=#{flowBranchId}
and b.id=pa.project_id
</update>
and b.id=pa.project_id
</update>
<update id= "updateFlowStateByProcInstForDeleteSuccess"
parameterType="HashMap">
update XM.xm_project_process_approva pa set pa.flow_state='2'
where pa.proc_inst_id = #{procInstId} and pa.flow_branch_id=#{flowBranchId}
</update>
</update>
<!-- 按条件删除若干条记录 -->
<delete id= "deleteByProcInstId" parameterType= "HashMap" >
delete from XM.xm_project
delete from XM.xm_project
where biz_proc_inst_id=#{procInstId}
</delete>
<!-- 结束 自定义sql函数区域 -->
<!-- 结束 自定义sql函数区域 -->
@ -63,10 +63,10 @@
s.total_progress,s.total_active_bug_cnt,s.total_confirmed_bug_cnt,s.project_status,s.total_act_workload,s.total_act_out_workload,s.total_act_inner_workload,
s.total_task_budget_cost_at,s.total_task_out_cnt,s.total_need_pay_cnt,s.total_finish_pay_cnt,s.total_finish_pay_user_cnt,s.total_need_pay_user_cnt,s.total_plan_inner_user_workload,
s.total_plan_out_user_workload,s.test_cases,s.exec_cases,s.design_cases,s.finish_cases,s.iteration_cnt,s.product_cnt,s.menu_cnt,
pa.proc_inst_id,pa.assignee,pa.assignee_name,pa.main_title,pa.flow_branch_id,pa.task_name,pa.agree,pa.flow_last_time,pa.comment_msg,pa.proc_def_id,pa.flow_state from XM.xm_project res
left join XM.xm_project_state s on s.project_id=res.id
left join XM.xm_project_process_approva pa on res.id=pa.project_id and res.biz_proc_inst_id=pa.proc_inst_id
pa.proc_inst_id,pa.assignee,pa.assignee_name,pa.main_title,pa.flow_branch_id,pa.task_name,pa.agree,pa.flow_last_time,pa.comment_msg,pa.proc_def_id,pa.flow_state from XM.xm_project res
left join XM.xm_project_state s on s.project_id=res.id
left join XM.xm_project_process_approva pa on res.id=pa.project_id and res.biz_proc_inst_id=pa.proc_inst_id
<where >
<if test= "ids != null" > and
id in
@ -74,9 +74,6 @@
#{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" />
<!-- 筛选属于当前年份的项目 -->
@ -92,31 +89,31 @@
</if>
<!-- 我参与的 包括我创建的,我监控的,我审核的 -->
<if test= " compete !=null and compete !='' " >
and ( exists ( select 1 from XM.xm_project_group g,XM.xm_project_group_user gu where gu.group_id=g.id and gu.userid=#{userid} and g.project_id=res.id )
and ( exists ( select 1 from XM.xm_project_group g,XM.xm_project_group_user gu where gu.group_id=g.id and gu.userid=#{userid} and g.project_id=res.id )
or res.create_userid=#{compete}
or exists ( select 1 from XM.xm_task_execuser exe where exe.project_id=res.id and exe.userid=#{compete} )
)
</if>
</if>
<!-- 按参与角色查询等 -->
<if test= "pgTypeIds != null " >
and exists ( select 1 from XM.xm_project_group g,XM.xm_project_group_user gu where gu.group_id=g.id and gu.userid=#{userid} and g.project_id=res.id
and exists ( select 1 from XM.xm_project_group g,XM.xm_project_group_user gu where gu.group_id=g.id and gu.userid=#{userid} and g.project_id=res.id
and g.pg_type_id in
<foreach collection= "pgTypeIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
<foreach collection= "pgTypeIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
)
</foreach>
)
</if>
<if test= " myExecuserStatus != null and myExecuserStatus != ''" >
and exists ( select 1 from XM.xm_task_execuser exe where exe.project_id=res.id and exe.userid=#{userid}
and exists ( select 1 from XM.xm_task_execuser exe where exe.project_id=res.id and exe.userid=#{userid}
<if test= ' myExecuserStatus != "all" ' >
and exe.status=#{myExecuserStatus}
</if>
)
</if>
<if test= "myFocus != null and myFocus != ''" >
and exists ( select 1 from XM.xm_my_focus f where f.userid=#{userid} and f.project_id=res.id )
and exists ( select 1 from XM.xm_my_focus f where f.userid=#{userid} and f.project_id=res.id )
</if>
<if test= "productId != null and productId !='' " >
and exists ( select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and m.product_id=#{productId}
@ -162,19 +159,19 @@
</where>
</select>
<!-- 新增一条记录 主键id, -->
<insert id= "insert" parameterType= "com.xm.core.entity.XmProject" useGeneratedKeys= "false" keyProperty= "id" >
<insert id= "insert" parameterType= "com.xm.core.entity.XmProject" useGeneratedKeys= "false" keyProperty= "id" >
insert into XM.xm_project(
<include refid= "columns" />
) values (
#{id},#{code},#{name},#{xmType},#{startTime},#{endTime},#{urgent},#{priority},#{description},#{createUserid},#{createUsername},#{createTime},#{assess},#{assessRemarks},#{status},#{branchId},#{planTotalCost},#{bizProcInstId},#{bizFlowState},#{planNouserAt},#{planInnerUserAt},#{planOutUserAt},#{locked},#{baseTime},#{baseRemark},#{baselineId},#{planWorkload},#{totalReceivables},#{budgetMarginRate},#{contractAmt},#{planInnerUserPrice},#{planOutUserPrice},#{planOutUserCnt},#{planInnerUserCnt},#{planWorkingHours},#{taxRate},#{planInnerUserWorkload},#{planOutUserWorkload},#{fromTplId},#{budgetCtrl}
#{id},#{code},#{name},#{xmType},#{startTime},#{endTime},#{urgent},#{priority},#{description},#{createUserid},#{createUsername},#{createTime},#{assess},#{assessRemarks},#{status},#{branchId},#{planTotalCost},#{bizProcInstId},#{bizFlowState},#{planNouserAt},#{planInnerUserAt},#{planOutUserAt},#{locked},#{baseTime},#{baseRemark},#{baselineId},#{planWorkload},#{totalReceivables},#{budgetMarginRate},#{contractAmt},#{planInnerUserPrice},#{planOutUserPrice},#{planOutUserCnt},#{planInnerUserCnt},#{planWorkingHours},#{taxRate},#{planInnerUserWorkload},#{planOutUserWorkload},#{fromTplId},#{budgetCtrl},#{deptid},#{showOut}
)
</insert>
<!-- 按条件删除若干条记录 -->
<delete id= "deleteByWhere" parameterType= "com.xm.core.entity.XmProject" >
delete from XM.xm_project res
delete from XM.xm_project
<where >
<include refid= "where" />
1=2
</where>
</delete>
@ -219,32 +216,35 @@
<!-- 批量删除 -->
<delete id= "batchDelete" parameterType= "List" >
delete from XM.xm_project
where id in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item.id }
</foreach>
where
(id)
in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item.id}
)
</foreach>
</delete>
<!-- sql片段 列 -->
<sql id= "columns" >
id,code,name,xm_type,start_time,end_time,urgent,priority,description,create_userid,create_username,create_time,assess,assess_remarks,status,branch_id,plan_total_cost,biz_proc_inst_id,biz_flow_state,plan_nouser_at,plan_inner_user_at,plan_out_user_at,locked,base_time,base_remark,baseline_id,plan_workload,total_receivables,budget_margin_rate,contract_amt,plan_inner_user_price,plan_out_user_price,plan_out_user_cnt,plan_inner_user_cnt,plan_working_hours,tax_rate,plan_inner_user_workload,plan_out_user_workload,from_tpl_id,budget_ctrl
id,code,name,xm_type,start_time,end_time,urgent,priority,description,create_userid,create_username,create_time,assess,assess_remarks,status,branch_id,plan_total_cost,biz_proc_inst_id,biz_flow_state,plan_nouser_at,plan_inner_user_at,plan_out_user_at,locked,base_time,base_remark,baseline_id,plan_workload,total_receivables,budget_margin_rate,contract_amt,plan_inner_user_price,plan_out_user_price,plan_out_user_cnt,plan_inner_user_cnt,plan_working_hours,tax_rate,plan_inner_user_workload,plan_out_user_workload,from_tpl_id,budget_ctrl,deptid,show_out
</sql>
<!-- sql片段 动态条件 YYYY - MM - DD HH24:MI:SS -->
<sql id= "where" >
<if test= "id != null and id != ''" > and res.id = #{id} </if>
<if test= "code != null and code != ''" > and res.code = #{code} </if>
<if test= "name != null and name != ''" > and res.name = #{name} </if>
<if test= "xmType != null and xmType != ''" > and res.xm_type = #{xmType} </if>
<if test= "startTime != null" > and TO_CHAR(res.start_time,'YYYY-MM-DD') = TO_CHAR(#{startTime},'YYYY-MM-DD ') </if>
<if test= "endTime != null" > and TO_CHAR(res.end_time,'YYYY-MM-DD') = TO_CHAR(#{endTime},'YYYY-MM-DD ') </if>
<if test= "startTime != null" > and date_format(res.start_time,'%Y-%m-%d') = date_format(#{startTime},'%Y-%m-%d ') </if>
<if test= "endTime != null" > and date_format(res.end_time,'%Y-%m-%d') = date_format(#{endTime},'%Y-%m-%d ') </if>
<if test= "urgent != null and urgent != ''" > and res.urgent = #{urgent} </if>
<if test= "priority != null and priority != ''" > and res.priority = #{priority} </if>
<if test= "description != null and description != ''" > and res.description = #{description} </if>
<if test= "createUserid != null and createUserid != ''" > and res.create_userid = #{createUserid} </if>
<if test= "createUsername != null and createUsername != ''" > and res.create_username = #{createUsername} </if>
<if test= "createTime != null" > and TO_CHAR(res.create_time,'YYYY-MM-DD') = TO_CHAR(#{createTime},'YYYY-MM-DD ') </if>
<if test= "createTime != null" > and date_format(res.create_time,'%Y-%m-%d') = date_format(#{createTime},'%Y-%m-%d ') </if>
<if test= "assess != null and assess != ''" > and res.assess = #{assess} </if>
<if test= "assessRemarks != null and assessRemarks != ''" > and res.assess_remarks = #{assessRemarks} </if>
<if test= "status != null and status != ''" > and res.status = #{status} </if>
@ -256,7 +256,7 @@
<if test= "planInnerUserAt != null and planInnerUserAt != ''" > and res.plan_inner_user_at = #{planInnerUserAt} </if>
<if test= "planOutUserAt != null and planOutUserAt != ''" > and res.plan_out_user_at = #{planOutUserAt} </if>
<if test= "locked != null and locked != ''" > and res.locked = #{locked} </if>
<if test= "baseTime != null" > and TO_CHAR(res.base_time,'YYYY-MM-DD') = TO_CHAR(#{baseTime},'YYYY-MM-DD ') </if>
<if test= "baseTime != null" > and date_format(res.base_time,'%Y-%m-%d') = date_format(#{baseTime},'%Y-%m-%d ') </if>
<if test= "baseRemark != null and baseRemark != ''" > and res.base_remark = #{baseRemark} </if>
<if test= "baselineId != null and baselineId != ''" > and res.baseline_id = #{baselineId} </if>
<if test= "planWorkload != null and planWorkload != ''" > and res.plan_workload = #{planWorkload} </if>
@ -273,6 +273,8 @@
<if test= "planOutUserWorkload != null and planOutUserWorkload != ''" > and res.plan_out_user_workload = #{planOutUserWorkload} </if>
<if test= "fromTplId != null and fromTplId != ''" > and res.from_tpl_id = #{fromTplId} </if>
<if test= "budgetCtrl != null and budgetCtrl != ''" > and res.budget_ctrl = #{budgetCtrl} </if>
<if test= "deptid != null and deptid != ''" > and res.deptid = #{deptid} </if>
<if test= "showOut != null and showOut != ''" > and res.show_out = #{showOut} </if>
</sql>
<!-- sql片段 更新字段 -->
<sql id= "set" >
@ -314,7 +316,9 @@
plan_inner_user_workload = #{planInnerUserWorkload},
plan_out_user_workload = #{planOutUserWorkload},
from_tpl_id = #{fromTplId},
budget_ctrl = #{budgetCtrl}
budget_ctrl = #{budgetCtrl},
deptid = #{deptid},
show_out = #{showOut}
</sql>
<sql id= "someFieldSet" >
<if test= "code != null and code != ''" > code = #{code}, </if>
@ -356,6 +360,8 @@
<if test= "planOutUserWorkload != null and planOutUserWorkload != ''" > plan_out_user_workload = #{planOutUserWorkload}, </if>
<if test= "fromTplId != null and fromTplId != ''" > from_tpl_id = #{fromTplId}, </if>
<if test= "budgetCtrl != null and budgetCtrl != ''" > budget_ctrl = #{budgetCtrl}, </if>
<if test= "deptid != null and deptid != ''" > deptid = #{deptid}, </if>
<if test= "showOut != null and showOut != ''" > show_out = #{showOut}, </if>
</sql>
<!-- sql片段 批量更新 -->
<sql id= "batchSet" >
@ -397,6 +403,8 @@
plan_inner_user_workload = #{item.planInnerUserWorkload},
plan_out_user_workload = #{item.planOutUserWorkload},
from_tpl_id = #{item.fromTplId},
budget_ctrl = #{item.budgetCtrl}
budget_ctrl = #{item.budgetCtrl},
deptid = #{item.deptid},
show_out = #{item.showOut}
</sql>
</mapper>