YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectCheckedMapper.xml

198 lines
13 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.manage.mapper.ProProjectCheckedMapper">
<resultMap type="ProProjectChecked" id="ProProjectCheckedResult">
<result property="id" column="id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="checkType" column="check_type" />
<result property="mainImage" column="main_image" />
<result property="imageUrls" column="image_urls" />
<result property="workingPosition" column="working_position" />
<result property="workingPositionType" column="working_position_type" />
<result property="checkingNum" column="checking_num" />
<result property="checkResult" column="check_result" />
<result property="intro" column="intro" />
<result property="technicianUser" column="technician_user" />
<result property="technicianUserName" column="technician_user_name" />
<result property="superviseUser" column="supervise_user" />
<result property="superviseUserName" column="supervise_user_name" />
<result property="groupDeptUser" column="group_dept_user" />
<result property="groupDeptUserName" column="group_dept_user_name" />
<result property="checkingDate" column="checking_date" />
<result property="checkingFiles" column="checking_files" />
<result property="isDel" column="is_del" />
<result property="approveStatus" column="approve_status" />
<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="selectProProjectCheckedVo">
select ppc.id, ppc.com_id, sd.dept_name as com_name, ppc.project_id, pi.project_name, ppc.check_type, ppc.main_image, ppc.image_urls, ppc.working_position, ppc.working_position_type, ppc.checking_num, ppc.check_result, ppc.intro, ppc.technician_user, ppc.technician_user_name, ppc.supervise_user, ppc.supervise_user_name, ppc.group_dept_user, ppc.group_dept_user_name, ppc.checking_date, ppc.checking_files, ppc.is_del, ppc.approve_status, ppc.create_by, ppc.create_time, ppc.update_by, ppc.update_time, ppc.remark
from pro_project_checked ppc
left join pro_project_info pi on pi.id = ppc.project_id
left join sys_dept sd on sd.dept_id = ppc.com_id
</sql>
<select id="selectProProjectCheckedList" parameterType="ProProjectChecked" resultMap="ProProjectCheckedResult">
<include refid="selectProProjectCheckedVo"/>
<where>
<if test="comId != null "> and ppc.com_id = #{comId}</if>
<if test="projectId != null "> and ppc.project_id = #{projectId}</if>
<if test="activeComId != null "> and ppc.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and ppc.project_id = #{activeProjectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="checkType != null and checkType != ''"> and ppc.check_type = #{checkType}</if>
<if test="workingPosition != null and workingPosition != ''"> and ppc.working_position = #{workingPosition}</if>
<if test="workingPositionType != null and workingPositionType != ''"> and ppc.working_position_type = #{workingPositionType}</if>
<if test="checkResult != null and checkResult != ''"> and ppc.check_result = #{checkResult}</if>
<if test="technicianUser != null and technicianUser != ''"> and ppc.technician_user = #{technicianUser}</if>
<if test="superviseUser != null and superviseUser != ''"> and ppc.supervise_user = #{superviseUser}</if>
<if test="groupDeptUser != null and groupDeptUser != ''"> and ppc.group_dept_user = #{groupDeptUser}</if>
<if test="checkingDate != null "> and ppc.checking_date = #{checkingDate}</if>
<if test="isDel != null "> and ppc.is_del = #{isDel}</if>
<if test="approveStatus != null and approveStatus != ''"> and ppc.approve_status = #{approveStatus}</if>
<if test="activeTags != null">
<if test='activeTags == "jxz"'> and (ppc.approve_status != '100' or ppc.check_result is null or ppc.check_result != '1')</if>
<if test='activeTags == "jwc"'> and ppc.approve_status = '100' and ppc.check_result = '1'</if>
</if>
and ppc.is_del = '0'
</where>
order by ppc.id
</select>
<select id="selectProProjectCheckedListCount" parameterType="ProProjectChecked" resultType="map">
select ppc.approve_status, ppc.check_result, count(1) as total from pro_project_checked ppc
<where>
<if test="comId != null "> and ppc.com_id = #{comId}</if>
<if test="projectId != null "> and ppc.project_id = #{projectId}</if>
<if test="activeComId != null "> and ppc.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and ppc.project_id = #{activeProjectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="checkType != null and checkType != ''"> and ppc.check_type = #{checkType}</if>
<if test="workingPosition != null and workingPosition != ''"> and ppc.working_position = #{workingPosition}</if>
<if test="workingPositionType != null and workingPositionType != ''"> and ppc.working_position_type = #{workingPositionType}</if>
<if test="technicianUser != null and technicianUser != ''"> and ppc.technician_user = #{technicianUser}</if>
<if test="superviseUser != null and superviseUser != ''"> and ppc.supervise_user = #{superviseUser}</if>
<if test="groupDeptUser != null and groupDeptUser != ''"> and ppc.group_dept_user = #{groupDeptUser}</if>
<if test="checkingDate != null "> and ppc.checking_date = #{checkingDate}</if>
<if test="isDel != null "> and ppc.is_del = #{isDel}</if>
and ppc.is_del = '0'
</where>
group by ppc.approve_status, ppc.check_result
</select>
<select id="selectProProjectCheckedById" parameterType="Long" resultMap="ProProjectCheckedResult">
<include refid="selectProProjectCheckedVo"/>
where ppc.id = #{id}
</select>
<insert id="insertProProjectChecked" parameterType="ProProjectChecked" useGeneratedKeys="true" keyProperty="id">
insert into pro_project_checked
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="checkType != null">check_type,</if>
<if test="mainImage != null">main_image,</if>
<if test="imageUrls != null">image_urls,</if>
<if test="workingPosition != null">working_position,</if>
<if test="workingPositionType != null">working_position_type,</if>
<if test="checkingNum != null">checking_num,</if>
<if test="checkResult != null">check_result,</if>
<if test="intro != null">intro,</if>
<if test="technicianUser != null">technician_user,</if>
<if test="technicianUserName != null">technician_user_name,</if>
<if test="superviseUser != null">supervise_user,</if>
<if test="superviseUserName != null">supervise_user_name,</if>
<if test="groupDeptUser != null">group_dept_user,</if>
<if test="groupDeptUserName != null">group_dept_user_name,</if>
<if test="checkingDate != null">checking_date,</if>
<if test="checkingFiles != null">checking_files,</if>
<if test="isDel != null">is_del,</if>
<if test="approveStatus != null">approve_status,</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="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="checkType != null">#{checkType},</if>
<if test="mainImage != null">#{mainImage},</if>
<if test="imageUrls != null">#{imageUrls},</if>
<if test="workingPosition != null">#{workingPosition},</if>
<if test="workingPositionType != null">#{workingPositionType},</if>
<if test="checkingNum != null">#{checkingNum},</if>
<if test="checkResult != null">#{checkResult},</if>
<if test="intro != null">#{intro},</if>
<if test="technicianUser != null">#{technicianUser},</if>
<if test="technicianUserName != null">#{technicianUserName},</if>
<if test="superviseUser != null">#{superviseUser},</if>
<if test="superviseUserName != null">#{superviseUserName},</if>
<if test="groupDeptUser != null">#{groupDeptUser},</if>
<if test="groupDeptUserName != null">#{groupDeptUserName},</if>
<if test="checkingDate != null">#{checkingDate},</if>
<if test="checkingFiles != null">#{checkingFiles},</if>
<if test="isDel != null">#{isDel},</if>
<if test="approveStatus != null">#{approveStatus},</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="updateProProjectChecked" parameterType="ProProjectChecked">
update pro_project_checked
<trim prefix="SET" suffixOverrides=",">
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="checkType != null">check_type = #{checkType},</if>
<if test="mainImage != null">main_image = #{mainImage},</if>
<if test="imageUrls != null">image_urls = #{imageUrls},</if>
<if test="workingPosition != null">working_position = #{workingPosition},</if>
<if test="workingPositionType != null">working_position_type = #{workingPositionType},</if>
<if test="checkingNum != null">checking_num = #{checkingNum},</if>
<if test="checkResult != null">check_result = #{checkResult},</if>
<if test="intro != null">intro = #{intro},</if>
<if test="technicianUser != null">technician_user = #{technicianUser},</if>
<if test="technicianUserName != null">technician_user_name = #{technicianUserName},</if>
<if test="superviseUser != null">supervise_user = #{superviseUser},</if>
<if test="superviseUserName != null">supervise_user_name = #{superviseUserName},</if>
<if test="groupDeptUser != null">group_dept_user = #{groupDeptUser},</if>
<if test="groupDeptUserName != null">group_dept_user_name = #{groupDeptUserName},</if>
<if test="checkingDate != null">checking_date = #{checkingDate},</if>
<if test="checkingFiles != null">checking_files = #{checkingFiles},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="approveStatus != null">approve_status = #{approveStatus},</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="deleteProProjectCheckedById" parameterType="Long">
delete from pro_project_checked where id = #{id}
</delete>
<delete id="deleteProProjectCheckedByIds" parameterType="String">
delete from pro_project_checked where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>