<?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.casic.missiles.mapper.business.BusinessOutsourceProjectMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.casic.missiles.model.business.BusinessOutsourceProject"> <id column="id" property="id" /> <result column="project_no" property="projectNo" /> <result column="project_name" property="projectName" /> <result column="applicant_id" property="applicantId" /> <result column="checker_id" property="checkerId" /> <result column="applicant_name" property="applicantName" /> <result column="checker_name" property="checkerName" /> <result column="applicant_time" property="applicantTime" /> <result column="pre_cost" property="preCost" /> <result column="outsourcer_id" property="outsourcerId" /> <result column="outsource_reason" property="outsourceReason" /> <result column="pre_start_time" property="preStartTime" /> <result column="pre_end_time" property="preEndTime" /> <result column="apply_minio_file_name" property="applyMinioFileName" /> <result column="check_minio_file_name" property="checkMinioFileName" /> <result column="apply_approval_status" property="applyApprovalStatus" /> <result column="apply_process_id" property="applyProcessId" /> <result column="check_approval_status" property="checkApprovalStatus" /> <result column="check_process_id" property="checkProcessId" /> <result column="check_conclusion" property="checkConclusion" /> <result column="check_time" property="checkTime" /> <result column="apply_remark" property="applyRemark" /> <result column="check_remark" property="checkRemark" /> <result column="create_user" property="createUser" /> <result column="create_time" property="createTime" /> <result column="update_time" property="updateTime" /> </resultMap> <select id="selectDraftListForApproval" resultType="com.casic.missiles.model.business.BusinessOutsourceProject"> SELECT bop.*, boi.outsourcer_name FROM business_outsource_project bop LEFT JOIN business_outsourcer_info boi ON bop.outsourcer_id = boi.id WHERE 1=1 <if test="request.typeFlag == 1"> and bop.apply_approval_status = #{request.approvalStatus} <if test="request.createUserId != null and request.createUserId !=''"> and bop.applicant_id = #{request.createUserId} </if> </if> <if test="request.typeFlag == 2"> and bop.check_approval_status = #{request.approvalStatus} <if test="request.createUserId != null and request.createUserId !=''"> and bop.checker_id = #{request.createUserId} </if> </if> <if test="request.projectNo != null and request.projectNo !=''"> and bop.project_no like concat('%',#{request.projectNo},'%') </if> <if test="request.projectName != null and request.projectName !=''"> and bop.project_name like concat('%',#{request.projectName},'%') </if> <if test="request.applicantName != null and request.applicantName !=''"> and bop.applicant_name like concat('%',#{request.applicantName},'%') </if> <if test="request.outsourcerName != null and request.outsourcerName !=''"> and boi.outsourcer_name like concat('%',#{request.outsourcerName},'%') </if> <if test="request.applicantStartTime != null and request.applicantStartTime !=''"> and bop.applicant_time >= #{request.applicantStartTime} </if> <if test="request.applicantEndTime != null and request.applicantEndTime !=''"> and bop.applicant_time <= #{request.applicantEndTime} </if> <if test="request.checkStartTime != null and request.checkStartTime !=''"> and bop.check_time >= #{request.checkStartTime} </if> <if test="request.checkEndTime != null and request.checkEndTime !=''"> and bop.check_time <= #{request.checkEndTime} </if> </select> <select id="selectBatchForApproval" resultType="com.casic.missiles.model.business.BusinessOutsourceProject"> SELECT bop.*, boi.outsourcer_name FROM business_outsource_project bop LEFT JOIN business_outsourcer_info boi ON bop.outsourcer_id = boi.id WHERE 1=1 <if test="request.typeFlag == 1 and request.applicantId != null and request.applicantId !=''"> and bop.applicant_id = #{request.applicantId} </if> <if test="request.typeFlag == 2 and request.checkerId != null and request.checkerId !=''"> and bop.checker_id = #{request.checkerId} </if> <if test="request.projectNo != null and request.projectNo !=''"> and bop.project_no like concat('%',#{request.projectNo},'%') </if> <if test="request.projectName != null and request.projectName !=''"> and bop.project_name like concat('%',#{request.projectName},'%') </if> <if test="request.applicantName != null and request.applicantName !=''"> and bop.applicant_name like concat('%',#{request.applicantName},'%') </if> <if test="request.outsourcerName != null and request.outsourcerName !=''"> and boi.outsourcer_name like concat('%',#{request.outsourcerName},'%') </if> <if test="request.applicantStartTime != null and request.applicantStartTime !=''"> and bop.applicant_time >= #{request.applicantStartTime} </if> <if test="request.applicantEndTime != null and request.applicantEndTime !=''"> and bop.applicant_time <= #{request.applicantEndTime} </if> <if test="request.checkStartTime != null and request.checkStartTime !=''"> and bop.check_time >= #{request.checkStartTime} </if> <if test="request.checkEndTime != null and request.checkEndTime !=''"> and bop.check_time <= #{request.checkEndTime} </if> and bop.id in <foreach collection="businessKey" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </select> <select id="selectMaxOutsourcerNo" resultType="java.lang.Long"> SELECT IFNULL(max(RIGHT(project_no, 12)), 0) FROM business_outsource_project </select> <select id="selectProjectById" resultType="com.casic.missiles.model.business.BusinessOutsourceProject"> SELECT bop.*, boi.outsourcer_no, boi.outsourcer_name FROM business_outsource_project bop LEFT JOIN business_outsourcer_info boi ON bop.outsourcer_id = boi.id WHERE bop.id = #{id} </select> <update id="updateForProjectCheck"> UPDATE business_outsource_project SET checker_id = null, checker_name = null, check_conclusion = null, check_minio_file_name = null, check_remark = null, check_approval_status = null WHERE id = #{id} </update> </mapper>