3 changed files with 39 additions and 613 deletions
-
39xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmBudgetNlaborMapper.xml
-
281xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMCostNouserMapper.xml
-
332xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMCostUserMapper.xml
@ -1,281 +0,0 @@ |
|||||
<?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.xm.core.entity.XmProjectMCostNouser"> |
|
||||
|
|
||||
|
|
||||
<!--开始 自定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="key != null and key !='' "> </if> |
|
||||
</sql> |
|
||||
<!-- 查询非人力的支出及对应的项目的预算,非人力支出不能大于项目非人力总预算 --> |
|
||||
<select id="selectTotalProjectAndNouserActCost" parameterType="HashMap" resultType="HashMap"> |
|
||||
SELECT |
|
||||
sum( ifnull(res.act_cost_amount,0) ) AS act_cost_nouser_amount, |
|
||||
p.plan_nouser_at, |
|
||||
p.plan_iuser_at, |
|
||||
p.plan_ouser_at, |
|
||||
p.locked, |
|
||||
p.plan_workload, |
|
||||
p.total_receivables, |
|
||||
p.budget_margin_rate, |
|
||||
p.contract_amt, |
|
||||
p.plan_iuser_price, |
|
||||
p.plan_ouser_price, |
|
||||
p.plan_ouser_cnt, |
|
||||
p.plan_iuser_cnt, |
|
||||
p.plan_working_hours |
|
||||
FROM |
|
||||
XM.xm_project p |
|
||||
LEFT JOIN xm_project_m_cost_nouser res ON p.id = res.project_id |
|
||||
<where> |
|
||||
p.id = #{projectId} |
|
||||
<if test=" excludeIds !=null "> and res.id not in |
|
||||
<foreach collection="excludeIds" item="item" index="index" open="(" separator="," close=")" > |
|
||||
#{item} |
|
||||
</foreach> |
|
||||
</if> |
|
||||
</where> |
|
||||
</select> |
|
||||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|
||||
<select id="listSum" parameterType="HashMap" resultType="HashMap"> |
|
||||
select res.project_id,res.subject_id,res.subject_name,biz_month,sum(res.act_cost_amount) as act_cost_amount from xm_project_m_cost_nouser res |
|
||||
<where> |
|
||||
and res.project_id=#{projectId} |
|
||||
<if test="subjectId != null and subjectId !='' "> and res.subject_id =#{subjectId} </if> |
|
||||
<if test="costType != null and costType !='' "> and res.cost_type =#{costType} </if> |
|
||||
</where> |
|
||||
group by res.project_id ,res.subject_id,res.subject_name,res.biz_month |
|
||||
</select> |
|
||||
<!--结束 自定义sql函数区域--> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|
||||
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|
||||
select * from xm_project_m_cost_nouser res |
|
||||
<where> |
|
||||
<include refid="whereForMap"/> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
|
|
||||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|
||||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmProjectMCostNouser" resultType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
select * from xm_project_m_cost_nouser res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
|
|
||||
<!-- 通过主键查询获取数据对象 返回object --> |
|
||||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmProjectMCostNouser" resultType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
select * from xm_project_m_cost_nouser res |
|
||||
where |
|
||||
res.id = #{id} |
|
||||
</select> |
|
||||
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
select * from xm_project_m_cost_nouser res |
|
||||
where (res.id) in |
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
||||
( #{item}) |
|
||||
</foreach> |
|
||||
</select> |
|
||||
<!-- 通过主键查询获取数据对象 返回map--> |
|
||||
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
|
||||
select * from xm_project_m_cost_nouser res |
|
||||
where |
|
||||
res.id = #{id} |
|
||||
</select> |
|
||||
<!-- 获取数据条目 返回long --> |
|
||||
<select id="countByWhere" parameterType="com.xm.core.entity.XmProjectMCostNouser" resultType="long"> |
|
||||
select count(*) from xm_project_m_cost_nouser res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
<!-- 新增一条记录 主键id,--> |
|
||||
<insert id="insert" parameterType="com.xm.core.entity.XmProjectMCostNouser" useGeneratedKeys="false" keyProperty="id"> |
|
||||
insert into xm_project_m_cost_nouser( |
|
||||
<include refid="columns"/> |
|
||||
) values ( |
|
||||
#{projectId},#{userid},#{createTime},#{sendCostTime},#{username},#{projectName},#{remark},#{id},#{taskId},#{taskName},#{subjectId},#{bizzStartDate},#{bizzEndDate},#{bizProcInstId},#{bizFlowState},#{projectPhaseId},#{actCostAmount},#{costType},#{bizMonth},#{bizDate},#{subjectName},#{projectPhaseName} |
|
||||
) |
|
||||
</insert> |
|
||||
|
|
||||
<!-- 按条件删除若干条记录--> |
|
||||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
delete from xm_project_m_cost_nouser res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</delete> |
|
||||
|
|
||||
<!-- 按主键删除一条记录--> |
|
||||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
delete from xm_project_m_cost_nouser |
|
||||
where id = #{id} |
|
||||
</delete> |
|
||||
|
|
||||
<!-- 根据条件修改若干条记录 --> |
|
||||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
update xm_project_m_cost_nouser |
|
||||
<set> |
|
||||
<include refid="someFieldSet"/> |
|
||||
</set> |
|
||||
where id = #{id} |
|
||||
</update> |
|
||||
|
|
||||
<!-- 根据主键修改一条记录 --> |
|
||||
<update id="updateByPk" parameterType="com.xm.core.entity.XmProjectMCostNouser"> |
|
||||
update xm_project_m_cost_nouser |
|
||||
<set> |
|
||||
<include refid="set"/> |
|
||||
</set> |
|
||||
where id = #{id} |
|
||||
</update> |
|
||||
|
|
||||
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
|
||||
<insert id="batchInsert" parameterType="List"> |
|
||||
</insert> |
|
||||
--> |
|
||||
|
|
||||
<!-- 批量更新 --> |
|
||||
<update id="batchUpdate" parameterType="List"> |
|
||||
<foreach collection="list" item="item" index="index" separator=";" > |
|
||||
update xm_project_m_cost_nouser |
|
||||
set |
|
||||
<include refid="batchSet"/> |
|
||||
where id = #{item.id} |
|
||||
</foreach> |
|
||||
</update> |
|
||||
|
|
||||
<!-- 批量修改某几个字段 --> |
|
||||
<delete id="editSomeFields" parameterType="HashMap"> |
|
||||
update xm_project_m_cost_nouser |
|
||||
<set> |
|
||||
<include refid="someFieldSet"/> |
|
||||
</set> |
|
||||
where (id) in |
|
||||
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
|
||||
( #{item}) |
|
||||
</foreach> |
|
||||
</delete> |
|
||||
<!-- 批量删除 --> |
|
||||
<delete id="batchDelete" parameterType="List"> |
|
||||
delete from xm_project_m_cost_nouser |
|
||||
where |
|
||||
(id) in |
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
||||
( #{item.id} ) |
|
||||
</foreach> |
|
||||
</delete> |
|
||||
|
|
||||
|
|
||||
<!--sql片段 列--> |
|
||||
<sql id="columns"> |
|
||||
project_id,userid,create_time,send_cost_time,username,project_name,remark,id,task_id,task_name,subject_id,bizz_start_date,bizz_end_date,biz_proc_inst_id,biz_flow_state,project_phase_id,act_cost_amount,cost_type,biz_month,biz_date,subject_name,project_phase_name |
|
||||
</sql> |
|
||||
|
|
||||
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
|
||||
<sql id="where"> |
|
||||
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
|
||||
<if test="userid != null and userid != ''"> and res.userid = #{userid} </if> |
|
||||
<if test="createTime != null"> and date_format(res.create_time,'%Y-%m-%d') = date_format(#{createTime},'%Y-%m-%d') </if> |
|
||||
<if test="sendCostTime != null"> and date_format(res.send_cost_time,'%Y-%m-%d') = date_format(#{sendCostTime},'%Y-%m-%d') </if> |
|
||||
<if test="username != null and username != ''"> and res.username = #{username} </if> |
|
||||
<if test="projectName != null and projectName != ''"> and res.project_name = #{projectName} </if> |
|
||||
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if> |
|
||||
<if test="id != null and id != ''"> and res.id = #{id} </if> |
|
||||
<if test="taskId != null and taskId != ''"> and res.task_id = #{taskId} </if> |
|
||||
<if test="taskName != null and taskName != ''"> and res.task_name = #{taskName} </if> |
|
||||
<if test="subjectId != null and subjectId != ''"> and res.subject_id = #{subjectId} </if> |
|
||||
<if test="bizzStartDate != null"> and date_format(res.bizz_start_date,'%Y-%m-%d') = date_format(#{bizzStartDate},'%Y-%m-%d') </if> |
|
||||
<if test="bizzEndDate != null"> and date_format(res.bizz_end_date,'%Y-%m-%d') = date_format(#{bizzEndDate},'%Y-%m-%d') </if> |
|
||||
<if test="bizProcInstId != null and bizProcInstId != ''"> and res.biz_proc_inst_id = #{bizProcInstId} </if> |
|
||||
<if test="bizFlowState != null and bizFlowState != ''"> and res.biz_flow_state = #{bizFlowState} </if> |
|
||||
<if test="projectPhaseId != null and projectPhaseId != ''"> and res.project_phase_id = #{projectPhaseId} </if> |
|
||||
<if test="actCostAmount != null and actCostAmount != ''"> and res.act_cost_amount = #{actCostAmount} </if> |
|
||||
<if test="costType != null and costType != ''"> and res.cost_type = #{costType} </if> |
|
||||
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if> |
|
||||
<if test="bizDate != null and bizDate != ''"> and res.biz_date = #{bizDate} </if> |
|
||||
<if test="subjectName != null and subjectName != ''"> and res.subject_name = #{subjectName} </if> |
|
||||
<if test="projectPhaseName != null and projectPhaseName != ''"> and res.project_phase_name = #{projectPhaseName} </if> |
|
||||
</sql> |
|
||||
<!--sql片段 更新字段 --> |
|
||||
<sql id="set"> |
|
||||
project_id = #{projectId}, |
|
||||
userid = #{userid}, |
|
||||
create_time = #{createTime}, |
|
||||
send_cost_time = #{sendCostTime}, |
|
||||
username = #{username}, |
|
||||
project_name = #{projectName}, |
|
||||
remark = #{remark}, |
|
||||
task_id = #{taskId}, |
|
||||
task_name = #{taskName}, |
|
||||
subject_id = #{subjectId}, |
|
||||
bizz_start_date = #{bizzStartDate}, |
|
||||
bizz_end_date = #{bizzEndDate}, |
|
||||
biz_proc_inst_id = #{bizProcInstId}, |
|
||||
biz_flow_state = #{bizFlowState}, |
|
||||
project_phase_id = #{projectPhaseId}, |
|
||||
act_cost_amount = #{actCostAmount}, |
|
||||
cost_type = #{costType}, |
|
||||
biz_month = #{bizMonth}, |
|
||||
biz_date = #{bizDate}, |
|
||||
subject_name = #{subjectName}, |
|
||||
project_phase_name = #{projectPhaseName} |
|
||||
</sql> |
|
||||
<sql id="someFieldSet"> |
|
||||
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
|
||||
<if test="userid != null and userid != ''"> userid = #{userid}, </if> |
|
||||
<if test="createTime != null"> create_time = #{createTime}, </if> |
|
||||
<if test="sendCostTime != null"> send_cost_time = #{sendCostTime}, </if> |
|
||||
<if test="username != null and username != ''"> username = #{username}, </if> |
|
||||
<if test="projectName != null and projectName != ''"> project_name = #{projectName}, </if> |
|
||||
<if test="remark != null and remark != ''"> remark = #{remark}, </if> |
|
||||
<if test="taskId != null and taskId != ''"> task_id = #{taskId}, </if> |
|
||||
<if test="taskName != null and taskName != ''"> task_name = #{taskName}, </if> |
|
||||
<if test="subjectId != null and subjectId != ''"> subject_id = #{subjectId}, </if> |
|
||||
<if test="bizzStartDate != null"> bizz_start_date = #{bizzStartDate}, </if> |
|
||||
<if test="bizzEndDate != null"> bizz_end_date = #{bizzEndDate}, </if> |
|
||||
<if test="bizProcInstId != null and bizProcInstId != ''"> biz_proc_inst_id = #{bizProcInstId}, </if> |
|
||||
<if test="bizFlowState != null and bizFlowState != ''"> biz_flow_state = #{bizFlowState}, </if> |
|
||||
<if test="projectPhaseId != null and projectPhaseId != ''"> project_phase_id = #{projectPhaseId}, </if> |
|
||||
<if test="actCostAmount != null and actCostAmount != ''"> act_cost_amount = #{actCostAmount}, </if> |
|
||||
<if test="costType != null and costType != ''"> cost_type = #{costType}, </if> |
|
||||
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if> |
|
||||
<if test="bizDate != null and bizDate != ''"> biz_date = #{bizDate}, </if> |
|
||||
<if test="subjectName != null and subjectName != ''"> subject_name = #{subjectName}, </if> |
|
||||
<if test="projectPhaseName != null and projectPhaseName != ''"> project_phase_name = #{projectPhaseName}, </if> |
|
||||
</sql> |
|
||||
<!--sql片段 批量更新 --> |
|
||||
<sql id="batchSet"> |
|
||||
project_id = #{item.projectId}, |
|
||||
userid = #{item.userid}, |
|
||||
create_time = #{item.createTime}, |
|
||||
send_cost_time = #{item.sendCostTime}, |
|
||||
username = #{item.username}, |
|
||||
project_name = #{item.projectName}, |
|
||||
remark = #{item.remark}, |
|
||||
task_id = #{item.taskId}, |
|
||||
task_name = #{item.taskName}, |
|
||||
subject_id = #{item.subjectId}, |
|
||||
bizz_start_date = #{item.bizzStartDate}, |
|
||||
bizz_end_date = #{item.bizzEndDate}, |
|
||||
biz_proc_inst_id = #{item.bizProcInstId}, |
|
||||
biz_flow_state = #{item.bizFlowState}, |
|
||||
project_phase_id = #{item.projectPhaseId}, |
|
||||
act_cost_amount = #{item.actCostAmount}, |
|
||||
cost_type = #{item.costType}, |
|
||||
biz_month = #{item.bizMonth}, |
|
||||
biz_date = #{item.bizDate}, |
|
||||
subject_name = #{item.subjectName}, |
|
||||
project_phase_name = #{item.projectPhaseName} |
|
||||
</sql> |
|
||||
</mapper> |
|
||||
@ -1,332 +0,0 @@ |
|||||
<?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.xm.core.entity.XmProjectMCostUser"> |
|
||||
|
|
||||
|
|
||||
<!--开始 自定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="key != null and key !='' "> </if> |
|
||||
</sql> |
|
||||
|
|
||||
<update id="updateExecuserStatusByExecuserProcInstId" |
|
||||
parameterType="HashMap"> |
|
||||
update xm_project_m_cost_user pa set pa.execuser_status=#{execuserStatus} |
|
||||
where pa.execuser_proc_inst_id = #{execuserProcInstId} |
|
||||
</update> |
|
||||
|
|
||||
<!-- 按条件删除若干条记录--> |
|
||||
<delete id="deleteByExecuserProcInstId" parameterType="HashMap"> |
|
||||
delete from xm_project_m_cost_user |
|
||||
where execuser_proc_inst_id=#{execuserProcInstId} |
|
||||
</delete> |
|
||||
<!-- 查询人力的总支出及对应的项目的总预算,人力总支出不能大于项目人力总预算 --> |
|
||||
<select id="selectTotalProjectAndUserActCost" parameterType="HashMap" resultType="HashMap"> |
|
||||
SELECT |
|
||||
sum( case when res.cost_type='1' then ifnull(res.act_cost_amount,0) else 0 end ) AS act_cost_iuser_amount, |
|
||||
sum( case when res.cost_type='2' then ifnull(res.act_cost_amount,0) else 0 end ) AS act_cost_ouser_amount, |
|
||||
sum( ifnull(res.act_cost_amount,0) ) AS act_cost_user_amount, |
|
||||
p.plan_nouser_at, |
|
||||
p.plan_iuser_at, |
|
||||
p.plan_ouser_at, |
|
||||
p.locked, |
|
||||
p.plan_workload, |
|
||||
p.total_receivables, |
|
||||
p.budget_margin_rate, |
|
||||
p.contract_amt, |
|
||||
p.plan_iuser_price, |
|
||||
p.plan_ouser_price, |
|
||||
p.plan_ouser_cnt, |
|
||||
p.plan_iuser_cnt, |
|
||||
p.plan_working_hours |
|
||||
FROM |
|
||||
XM.xm_project p |
|
||||
LEFT JOIN xm_project_m_cost_user res ON p.id = res.project_id |
|
||||
<where> |
|
||||
p.id = #{projectId} |
|
||||
<if test=" excludeIds !=null "> and res.id not in |
|
||||
<foreach collection="excludeIds" item="item" index="index" open="(" separator="," close=")" > |
|
||||
#{item} |
|
||||
</foreach> |
|
||||
</if> |
|
||||
</where> |
|
||||
</select> |
|
||||
|
|
||||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|
||||
<select id="listSum" parameterType="HashMap" resultType="HashMap"> |
|
||||
select res.project_id,res.userid,max(res.username) as username,subject_id,max(subject_name) as subject_name,biz_month,sum(res.act_cost_amount) as act_cost_amount from xm_project_m_cost_user res |
|
||||
<where> |
|
||||
and res.project_id=#{projectId} |
|
||||
<if test="subjectId != null and subjectId !='' "> and res.subject_id =#{subjectId} </if> |
|
||||
<if test="costType != null and costType !='' "> and res.cost_type =#{costType} </if> |
|
||||
</where> |
|
||||
group by res.project_id,res.userid,subject_id,biz_month |
|
||||
</select> |
|
||||
<select id="listSumForSettleGroupByTaskIdAndUserid" parameterType="HashMap" resultType="HashMap"> |
|
||||
SELECT |
|
||||
res.project_id, |
|
||||
res.task_id, |
|
||||
res.userid, |
|
||||
max( res.username ) as username, |
|
||||
sum( ifnull(res.act_cost_amount,0) ) AS act_cost_amount, |
|
||||
max( ifnull(t.budget_cost,0) ) AS task_budget_cost, |
|
||||
max( t.project_name ) AS project_name |
|
||||
FROM xm_task t |
|
||||
LEFT JOIN |
|
||||
XM.xm_project_m_cost_user res ON res.task_id = t.id AND res.project_id = t.project_id |
|
||||
<where> |
|
||||
<if test="projectId != null and projectId !='' "> and t.project_id =#{projectId} </if> |
|
||||
<if test="subjectId != null and subjectId !='' "> and res.subject_id =#{subjectId} </if> |
|
||||
<if test="costType != null and costType !='' "> and res.cost_type =#{costType} </if> |
|
||||
<if test="taskId != null and taskId !='' "> and res.task_id =#{taskId} </if> |
|
||||
<if test="userid != null and userid !='' "> and res.userid =#{userid} </if> |
|
||||
</where> |
|
||||
GROUP BY |
|
||||
res.project_id, |
|
||||
res.task_id, |
|
||||
res.userid |
|
||||
</select> |
|
||||
<!--结束 自定义sql函数区域--> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|
||||
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|
||||
select res.* from xm_project_m_cost_user res |
|
||||
<where> |
|
||||
<include refid="whereForMap"/> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
|
|
||||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|
||||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmProjectMCostUser" resultType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
select * from xm_project_m_cost_user res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
|
|
||||
<!-- 通过主键查询获取数据对象 返回object --> |
|
||||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmProjectMCostUser" resultType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
select * from xm_project_m_cost_user res |
|
||||
where |
|
||||
res.id = #{id} |
|
||||
</select> |
|
||||
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
select * from xm_project_m_cost_user res |
|
||||
where (res.id) in |
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
||||
( #{item}) |
|
||||
</foreach> |
|
||||
</select> |
|
||||
<!-- 通过主键查询获取数据对象 返回map--> |
|
||||
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
|
||||
select * from xm_project_m_cost_user res |
|
||||
where |
|
||||
res.id = #{id} |
|
||||
</select> |
|
||||
<!-- 获取数据条目 返回long --> |
|
||||
<select id="countByWhere" parameterType="com.xm.core.entity.XmProjectMCostUser" resultType="long"> |
|
||||
select count(1) from xm_project_m_cost_user res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</select> |
|
||||
<!-- 新增一条记录 主键id,--> |
|
||||
<insert id="insert" parameterType="com.xm.core.entity.XmProjectMCostUser" useGeneratedKeys="false" keyProperty="id"> |
|
||||
insert into xm_project_m_cost_user( |
|
||||
<include refid="columns"/> |
|
||||
) values ( |
|
||||
#{subjectId},#{projectId},#{userid},#{createTime},#{sendCostTime},#{username},#{projectName},#{remark},#{id},#{taskId},#{taskName},#{actWorkload},#{bizzStartDate},#{bizzEndDate},#{bizProcInstId},#{bizFlowState},#{phaseId},#{actCostAmount},#{costType},#{bizMonth},#{bizDate},#{subjectName},#{phaseName},#{execuserProcInstId},#{execuserStatus},#{payStatus},#{payOpUserid},#{payOpUsername} |
|
||||
) |
|
||||
</insert> |
|
||||
|
|
||||
<!-- 按条件删除若干条记录--> |
|
||||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
delete from xm_project_m_cost_user res |
|
||||
<where> |
|
||||
<include refid="where"/> |
|
||||
</where> |
|
||||
</delete> |
|
||||
|
|
||||
<!-- 按主键删除一条记录--> |
|
||||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
delete from xm_project_m_cost_user |
|
||||
where id = #{id} |
|
||||
</delete> |
|
||||
|
|
||||
<!-- 根据条件修改若干条记录 --> |
|
||||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
update xm_project_m_cost_user |
|
||||
<set> |
|
||||
<include refid="someFieldSet"/> |
|
||||
</set> |
|
||||
where id = #{id} |
|
||||
</update> |
|
||||
|
|
||||
<!-- 根据主键修改一条记录 --> |
|
||||
<update id="updateByPk" parameterType="com.xm.core.entity.XmProjectMCostUser"> |
|
||||
update xm_project_m_cost_user |
|
||||
<set> |
|
||||
<include refid="set"/> |
|
||||
</set> |
|
||||
where id = #{id} |
|
||||
</update> |
|
||||
|
|
||||
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
|
||||
<insert id="batchInsert" parameterType="List"> |
|
||||
</insert> |
|
||||
--> |
|
||||
|
|
||||
<!-- 批量更新 --> |
|
||||
<update id="batchUpdate" parameterType="List"> |
|
||||
<foreach collection="list" item="item" index="index" separator=";" > |
|
||||
update xm_project_m_cost_user |
|
||||
set |
|
||||
<include refid="batchSet"/> |
|
||||
where id = #{item.id} |
|
||||
</foreach> |
|
||||
</update> |
|
||||
<!-- 批量删除 --> |
|
||||
<delete id="batchDelete" parameterType="List"> |
|
||||
delete from xm_project_m_cost_user |
|
||||
where |
|
||||
(id) in |
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
||||
( #{item.id} ) |
|
||||
</foreach> |
|
||||
</delete> |
|
||||
|
|
||||
|
|
||||
<!--sql片段 列--> |
|
||||
<sql id="columns"> |
|
||||
subject_id,project_id,userid,create_time,send_cost_time,username,project_name,remark,id,task_id,task_name,act_workload,bizz_start_date,bizz_end_date,biz_proc_inst_id,biz_flow_state,phase_id,act_cost_amount,cost_type,biz_month,biz_date,subject_name,phase_name,execuser_proc_inst_id,execuser_status,pay_status,pay_op_userid,pay_op_username |
|
||||
</sql> |
|
||||
|
|
||||
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
|
||||
<sql id="where"> |
|
||||
<if test="subjectId != null and subjectId != ''"> and res.subject_id = #{subjectId} </if> |
|
||||
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
|
||||
<if test="userid != null and userid != ''"> and res.userid = #{userid} </if> |
|
||||
<if test="createTime != null"> and date_format(res.create_time,'%Y-%m-%d') = date_format(#{createTime},'%Y-%m-%d') </if> |
|
||||
<if test="sendCostTime != null"> and date_format(res.send_cost_time,'%Y-%m-%d') = date_format(#{sendCostTime},'%Y-%m-%d') </if> |
|
||||
<if test="username != null and username != ''"> and res.username = #{username} </if> |
|
||||
<if test="projectName != null and projectName != ''"> and res.project_name = #{projectName} </if> |
|
||||
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if> |
|
||||
<if test="id != null and id != ''"> and res.id = #{id} </if> |
|
||||
<if test="taskId != null and taskId != ''"> and res.task_id = #{taskId} </if> |
|
||||
<if test="taskName != null and taskName != ''"> and res.task_name = #{taskName} </if> |
|
||||
<if test="actWorkload != null and actWorkload != ''"> and res.act_workload = #{actWorkload} </if> |
|
||||
<if test="bizzStartDate != null"> and date_format(res.bizz_start_date,'%Y-%m-%d') = date_format(#{bizzStartDate},'%Y-%m-%d') </if> |
|
||||
<if test="bizzEndDate != null"> and date_format(res.bizz_end_date,'%Y-%m-%d') = date_format(#{bizzEndDate},'%Y-%m-%d') </if> |
|
||||
<if test="bizProcInstId != null and bizProcInstId != ''"> and res.biz_proc_inst_id = #{bizProcInstId} </if> |
|
||||
<if test="bizFlowState != null and bizFlowState != ''"> and res.biz_flow_state = #{bizFlowState} </if> |
|
||||
<if test="phaseId != null and phaseId != ''"> and res.phase_id = #{phaseId} </if> |
|
||||
<if test="actCostAmount != null and actCostAmount != ''"> and res.act_cost_amount = #{actCostAmount} </if> |
|
||||
<if test="costType != null and costType != ''"> and res.cost_type = #{costType} </if> |
|
||||
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if> |
|
||||
<if test="bizDate != null and bizDate != ''"> and res.biz_date = #{bizDate} </if> |
|
||||
<if test="subjectName != null and subjectName != ''"> and res.subject_name = #{subjectName} </if> |
|
||||
<if test="phaseName != null and phaseName != ''"> and res.phase_name = #{phaseName} </if> |
|
||||
<if test="execuserProcInstId != null and execuserProcInstId != ''"> and res.execuser_proc_inst_id = #{execuserProcInstId} </if> |
|
||||
<if test="execuserStatus != null and execuserStatus != ''"> and res.execuser_status = #{execuserStatus} </if> |
|
||||
<if test="payStatus != null and payStatus != ''"> and res.pay_status = #{payStatus} </if> |
|
||||
<if test="payOpUserid != null and payOpUserid != ''"> and res.pay_op_userid = #{payOpUserid} </if> |
|
||||
<if test="payOpUsername != null and payOpUsername != ''"> and res.pay_op_username = #{payOpUsername} </if> |
|
||||
</sql> |
|
||||
<!--sql片段 更新字段 --> |
|
||||
<sql id="set"> |
|
||||
subject_id = #{subjectId}, |
|
||||
project_id = #{projectId}, |
|
||||
userid = #{userid}, |
|
||||
create_time = #{createTime}, |
|
||||
send_cost_time = #{sendCostTime}, |
|
||||
username = #{username}, |
|
||||
project_name = #{projectName}, |
|
||||
remark = #{remark}, |
|
||||
task_id = #{taskId}, |
|
||||
task_name = #{taskName}, |
|
||||
act_workload = #{actWorkload}, |
|
||||
bizz_start_date = #{bizzStartDate}, |
|
||||
bizz_end_date = #{bizzEndDate}, |
|
||||
biz_proc_inst_id = #{bizProcInstId}, |
|
||||
biz_flow_state = #{bizFlowState}, |
|
||||
phase_id = #{phaseId}, |
|
||||
act_cost_amount = #{actCostAmount}, |
|
||||
cost_type = #{costType}, |
|
||||
biz_month = #{bizMonth}, |
|
||||
biz_date = #{bizDate}, |
|
||||
subject_name = #{subjectName}, |
|
||||
phase_name = #{phaseName}, |
|
||||
execuser_proc_inst_id = #{execuserProcInstId}, |
|
||||
execuser_status = #{execuserStatus}, |
|
||||
pay_status = #{payStatus}, |
|
||||
pay_op_userid = #{payOpUserid}, |
|
||||
pay_op_username = #{payOpUsername} |
|
||||
</sql> |
|
||||
<sql id="someFieldSet"> |
|
||||
<if test="subjectId != null and subjectId != ''"> subject_id = #{subjectId}, </if> |
|
||||
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
|
||||
<if test="userid != null and userid != ''"> userid = #{userid}, </if> |
|
||||
<if test="createTime != null"> create_time = #{createTime}, </if> |
|
||||
<if test="sendCostTime != null"> send_cost_time = #{sendCostTime}, </if> |
|
||||
<if test="username != null and username != ''"> username = #{username}, </if> |
|
||||
<if test="projectName != null and projectName != ''"> project_name = #{projectName}, </if> |
|
||||
<if test="remark != null and remark != ''"> remark = #{remark}, </if> |
|
||||
<if test="taskId != null and taskId != ''"> task_id = #{taskId}, </if> |
|
||||
<if test="taskName != null and taskName != ''"> task_name = #{taskName}, </if> |
|
||||
<if test="actWorkload != null and actWorkload != ''"> act_workload = #{actWorkload}, </if> |
|
||||
<if test="bizzStartDate != null"> bizz_start_date = #{bizzStartDate}, </if> |
|
||||
<if test="bizzEndDate != null"> bizz_end_date = #{bizzEndDate}, </if> |
|
||||
<if test="bizProcInstId != null and bizProcInstId != ''"> biz_proc_inst_id = #{bizProcInstId}, </if> |
|
||||
<if test="bizFlowState != null and bizFlowState != ''"> biz_flow_state = #{bizFlowState}, </if> |
|
||||
<if test="phaseId != null and phaseId != ''"> phase_id = #{phaseId}, </if> |
|
||||
<if test="actCostAmount != null and actCostAmount != ''"> act_cost_amount = #{actCostAmount}, </if> |
|
||||
<if test="costType != null and costType != ''"> cost_type = #{costType}, </if> |
|
||||
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if> |
|
||||
<if test="bizDate != null and bizDate != ''"> biz_date = #{bizDate}, </if> |
|
||||
<if test="subjectName != null and subjectName != ''"> subject_name = #{subjectName}, </if> |
|
||||
<if test="phaseName != null and phaseName != ''"> phase_name = #{phaseName}, </if> |
|
||||
<if test="execuserProcInstId != null and execuserProcInstId != ''"> execuser_proc_inst_id = #{execuserProcInstId}, </if> |
|
||||
<if test="execuserStatus != null and execuserStatus != ''"> execuser_status = #{execuserStatus}, </if> |
|
||||
<if test="payStatus != null and payStatus != ''"> pay_status = #{payStatus}, </if> |
|
||||
<if test="payOpUserid != null and payOpUserid != ''"> pay_op_userid = #{payOpUserid}, </if> |
|
||||
<if test="payOpUsername != null and payOpUsername != ''"> pay_op_username = #{payOpUsername}, </if> |
|
||||
</sql> |
|
||||
<!--sql片段 批量更新 --> |
|
||||
<sql id="batchSet"> |
|
||||
subject_id = #{item.subjectId}, |
|
||||
project_id = #{item.projectId}, |
|
||||
userid = #{item.userid}, |
|
||||
create_time = #{item.createTime}, |
|
||||
send_cost_time = #{item.sendCostTime}, |
|
||||
username = #{item.username}, |
|
||||
project_name = #{item.projectName}, |
|
||||
remark = #{item.remark}, |
|
||||
task_id = #{item.taskId}, |
|
||||
task_name = #{item.taskName}, |
|
||||
act_workload = #{item.actWorkload}, |
|
||||
bizz_start_date = #{item.bizzStartDate}, |
|
||||
bizz_end_date = #{item.bizzEndDate}, |
|
||||
biz_proc_inst_id = #{item.bizProcInstId}, |
|
||||
biz_flow_state = #{item.bizFlowState}, |
|
||||
phase_id = #{item.phaseId}, |
|
||||
act_cost_amount = #{item.actCostAmount}, |
|
||||
cost_type = #{item.costType}, |
|
||||
biz_month = #{item.bizMonth}, |
|
||||
biz_date = #{item.bizDate}, |
|
||||
subject_name = #{item.subjectName}, |
|
||||
phase_name = #{item.phaseName}, |
|
||||
execuser_proc_inst_id = #{item.execuserProcInstId}, |
|
||||
execuser_status = #{item.execuserStatus}, |
|
||||
pay_status = #{item.payStatus}, |
|
||||
pay_op_userid = #{item.payOpUserid}, |
|
||||
pay_op_username = #{item.payOpUsername} |
|
||||
</sql> |
|
||||
</mapper> |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue