239 lines
17 KiB
XML
239 lines
17 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.yanzhu.jh.flow.mapper.FlowLabourInfoMapper">
|
|
|
|
<resultMap type="FlowLabourInfo" id="FlowLabourInfoResult">
|
|
<result property="id" column="id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="deptName" column="dept_name" />
|
|
<result property="subDeptId" column="sub_dept_id" />
|
|
<result property="subDeptName" column="sub_dept_name" />
|
|
<result property="laborName" column="labor_name" />
|
|
<result property="laborCardId" column="labor_cardId" />
|
|
<result property="laborPhone" column="labor_phone" />
|
|
<result property="laborNumber" column="labor_number" />
|
|
<result property="laborAmount" column="labor_amount" />
|
|
<result property="laborReason" column="labor_reason" />
|
|
<result property="files" column="files" />
|
|
<result property="approveStatus" column="approve_status" />
|
|
<result property="isDel" column="is_del" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectFlowLabourInfoVo">
|
|
select fl.id, fl.project_id, fl.project_name, fl.dept_id, fl.dept_name, fl.sub_dept_id, fl.sub_dept_name, fl.labor_name, fl.labor_cardId, fl.labor_phone, fl.labor_number, fl.labor_amount, fl.labor_reason, fl.files, fl.approve_status, fl.is_del, fl.create_by, fl.create_time, fl.update_by, fl.update_time, fl.remark from flow_labour_info fl
|
|
left join sur_project sp on sp.id = fl.project_id
|
|
</sql>
|
|
|
|
<select id="selectFlowLabourInfoList" parameterType="FlowLabourInfo" resultMap="FlowLabourInfoResult">
|
|
<include refid="selectFlowLabourInfoVo"/>
|
|
<where>
|
|
fl.is_del=0
|
|
<if test="projectId != null "> and fl.project_id = #{projectId}</if>
|
|
<if test="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
|
|
<if test="deptId != null "> and fl.dept_id = #{deptId}</if>
|
|
<if test="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
|
|
<if test="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
|
|
<if test="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
|
|
<if test="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
|
|
<if test="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
|
|
<if test="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
|
|
<if test="approveStatus != null and approveStatus != ''"> and fl.approve_status = #{approveStatus}</if>
|
|
<if test='activeName != null and activeName == "MyAwait"'> and fl.approve_status != 100</if>
|
|
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
|
|
<!-- 查询条件-项目部门 -->
|
|
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
|
|
<!--子部门数据-->
|
|
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'>
|
|
and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )
|
|
</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
|
|
<if test='activeName == "jxz"'>
|
|
<if test='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21')</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21')</if>
|
|
and fl.approve_status != '100'
|
|
</if>
|
|
<if test='activeName == "ywc"'>
|
|
<if test='nowRole == "4"'> and fl.approve_status in ('21','30','100')</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('11','20','100')</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('11','20','100')</if>
|
|
</if>
|
|
</where>
|
|
order by fl.approve_status desc, fl.id asc
|
|
</select>
|
|
|
|
<select id="findGroupCountByApprove" parameterType="FlowLabourInfo" resultType="Map">
|
|
select fl.approve_status as approveStatus, count(1) as total from flow_labour_info fl
|
|
left join sur_project sp on sp.id = fl.project_id
|
|
<where>
|
|
fl.is_del=0
|
|
<if test="projectId != null "> and fl.project_id = #{projectId}</if>
|
|
<if test="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
|
|
<if test="deptId != null "> and fl.dept_id = #{deptId}</if>
|
|
<if test="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
|
|
<if test="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
|
|
<if test="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
|
|
<if test="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
|
|
<if test="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
|
|
<if test="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
|
|
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
|
|
<!-- 查询条件-项目部门 -->
|
|
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
|
|
<!--子部门数据-->
|
|
<if test='nowRole == "4"'> and fl.approve_status in ('20','31','30','100') and sp.deptId = #{nowDept}</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
|
|
</where>
|
|
group by fl.approve_status
|
|
</select>
|
|
|
|
<select id="findGroupCountByApproveTask" parameterType="FlowLabourInfo" resultType="Map">
|
|
select fl.approve_status as approveStatus, count(1) as total from flow_labour_info fl
|
|
left join sur_project sp on sp.id = fl.project_id
|
|
<where>
|
|
fl.is_del=0
|
|
<if test="projectId != null "> and fl.project_id = #{projectId}</if>
|
|
<if test="projectName != null and projectName != ''"> and fl.project_name like concat('%', #{projectName}, '%')</if>
|
|
<if test="deptId != null "> and fl.dept_id = #{deptId}</if>
|
|
<if test="deptName != null and deptName != ''"> and fl.dept_name like concat('%', #{deptName}, '%')</if>
|
|
<if test="subDeptId != null "> and fl.sub_dept_id = #{subDeptId}</if>
|
|
<if test="subDeptName != null and subDeptName != ''"> and fl.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
|
|
<if test="laborName != null and laborName != ''"> and fl.labor_name like concat('%', #{laborName}, '%')</if>
|
|
<if test="laborCardId != null "> and fl.labor_cardId like concat('%', #{laborCardId}, '%')</if>
|
|
<if test="laborPhone != null and laborPhone != ''"> and fl.labor_phone = #{laborPhone}</if>
|
|
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fl.create_time) between #{params.beginDate} and #{params.endDate}</if>
|
|
<!-- 查询条件-项目部门 -->
|
|
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
|
|
<if test='nowRole == "1" or nowRole == "2" or nowRole == "3"'> and fl.approve_status in ('30')</if>
|
|
<!--子部门数据-->
|
|
<if test='nowRole == "4"'> and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='21' and spui.del_flag=0 )</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.del_flag=0 )</if>
|
|
<if test='activeName == "jxz"'>
|
|
<if test='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('10','21') </if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('10','21') </if>
|
|
and fl.approve_status != '100'
|
|
</if>
|
|
<if test='activeName == "ywc"'>
|
|
<if test='nowRole == "4"'> and fl.approve_status in ('21','30','100')</if>
|
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fl.approve_status in ('11','20','100')</if>
|
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> and fl.approve_status in ('11','20','100')</if>
|
|
</if>
|
|
</where>
|
|
group by fl.approve_status
|
|
</select>
|
|
|
|
<select id="selectFlowLabourInfoById" parameterType="Long" resultMap="FlowLabourInfoResult">
|
|
<include refid="selectFlowLabourInfoVo"/>
|
|
where fl.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectFlowLabourInfoByCardId" parameterType="String" resultMap="FlowLabourInfoResult">
|
|
<include refid="selectFlowLabourInfoVo"/>
|
|
where fl.labor_cardId = #{cardId}
|
|
</select>
|
|
|
|
<insert id="insertFlowLabourInfo" parameterType="FlowLabourInfo" useGeneratedKeys="true" keyProperty="id">
|
|
insert into flow_labour_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="projectName != null">project_name,</if>
|
|
<if test="deptId != null">dept_id,</if>
|
|
<if test="deptName != null">dept_name,</if>
|
|
<if test="subDeptId != null">sub_dept_id,</if>
|
|
<if test="subDeptName != null">sub_dept_name,</if>
|
|
<if test="laborName != null">labor_name,</if>
|
|
<if test="laborCardId != null">labor_cardId,</if>
|
|
<if test="laborPhone != null">labor_phone,</if>
|
|
<if test="laborNumber != null">labor_number,</if>
|
|
<if test="laborAmount != null">labor_amount,</if>
|
|
<if test="laborReason != null">labor_reason,</if>
|
|
<if test="files != null">files,</if>
|
|
<if test="approveStatus != null">approve_status,</if>
|
|
<if test="isDel != null">is_del,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="projectName != null">#{projectName},</if>
|
|
<if test="deptId != null">#{deptId},</if>
|
|
<if test="deptName != null">#{deptName},</if>
|
|
<if test="subDeptId != null">#{subDeptId},</if>
|
|
<if test="subDeptName != null">#{subDeptName},</if>
|
|
<if test="laborName != null">#{laborName},</if>
|
|
<if test="laborCardId != null">#{laborCardId},</if>
|
|
<if test="laborPhone != null">#{laborPhone},</if>
|
|
<if test="laborNumber != null">#{laborNumber},</if>
|
|
<if test="laborAmount != null">#{laborAmount},</if>
|
|
<if test="laborReason != null">#{laborReason},</if>
|
|
<if test="files != null">#{files},</if>
|
|
<if test="approveStatus != null">#{approveStatus},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateFlowLabourInfo" parameterType="FlowLabourInfo">
|
|
update flow_labour_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="projectName != null">project_name = #{projectName},</if>
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
<if test="deptName != null">dept_name = #{deptName},</if>
|
|
<if test="subDeptId != null">sub_dept_id = #{subDeptId},</if>
|
|
<if test="subDeptName != null">sub_dept_name = #{subDeptName},</if>
|
|
<if test="laborName != null">labor_name = #{laborName},</if>
|
|
<if test="laborCardId != null">labor_cardId = #{laborCardId},</if>
|
|
<if test="laborPhone != null">labor_phone = #{laborPhone},</if>
|
|
<if test="laborNumber != null">labor_number = #{laborNumber},</if>
|
|
<if test="laborAmount != null">labor_amount = #{laborAmount},</if>
|
|
<if test="laborReason != null">labor_reason = #{laborReason},</if>
|
|
<if test="files != null">files = #{files},</if>
|
|
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteFlowLabourInfoById" parameterType="Long">
|
|
delete from flow_labour_info where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteFlowLabourInfoByIds" parameterType="String">
|
|
delete from flow_labour_info where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |