<?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.newfiber.api.pc.dao.RiverManage.PatrolManageProblemMapper"> <!-- 通用映射列 --> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.PatrolManageProblem"> <result column="id" property="id"/> <result column="patrol_type" property="patrolType"/> <result column="patrol_no" property="patrolNo"/> <result column="patrol_name" property="patrolName"/> <result column="problem_name" property="problemName"/> <result column="project_main_id" property="projectMainId"/> <result column="project_main_name" property="projectMainName"/> <result column="bind_no" property="bindNo"/> <result column="project_name" property="projectName"/> <result column="problem_type" property="problemType"/> <result column="problem_type_name" property="problemTypeName"/> <result column="address" property="address"/> <result column="description" property="description"/> <result column="pic_no" property="picNo"/> <result column="pic_after_no" property="picAfterNo"/> <result column="after_description" property="afterDescription"/> <result column="coordinate" property="coordinate"/> <result column="state" property="state"/> <result column="state_desc" property="stateDesc"/> <result column="create_user_no" property="createUserNo"/> <result column="create_user_name" property="createUserName"/> <result column="create_user_phone" property="createUserPhone"/> <result column="super_leader_no" property="superLeaderNo"/> <result column="super_leader_name" property="superLeaderName"/> <result column="super_leader_check" property="superLeaderCheck"/> <result column="lead_no" property="leadNo"/> <result column="lead_name" property="leadName"/> <result column="center_no" property="centerNo"/> <result column="center_name" property="centerName"/> <result column="duty_no" property="dutyNo"/> <result column="duty_name" property="dutyName"/> <result column="handler_lead_no" property="handlerLeadNo"/> <result column="handler_lead_name" property="handlerLeadName"/> <result column="handler_no" property="handlerNo"/> <result column="handler_name" property="handlerName"/> <result column="is_lead_check" property="isLeadCheck"/> <result column="source_type" property="sourceType"/> <result column="sub_source" property="subSource"/> <result column="is_duty_sub" property="isDutySub"/> <result column="alarm_type" property="alarmType"/> <result column="expected_end_time" property="expectedEndTime"/> <result column="completion_time" property="completionTime"/> <result column="site_no" property="siteNo"/> <result column="event_src_id" property="eventSrcId"/> <result column="event_src" property="eventSrc"/> <result column="event_level_iD" property="eventLevelId"/> <result column="event_level" property="eventLevel"/> <result column="event_type_code" property="eventTypeCode"/> <result column="event_type" property="eventType"/> <result column="main_type_code" property="mainTypeCode"/> <result column="main_type" property="mainType"/> <result column="sub_type_code" property="subTypeCode"/> <result column="sub_type" property="subType"/> <result column="third_type_code" property="thirdTypeCode"/> <result column="third_type" property="thirdType"/> <result column="deadline_time" property="deadlineTime"/> <result column="urgent_flag" property="urgentFlag"/> <result column="task_num" property="taskNum"/> <result column="task_state" property="taskState"/> <result column="task_state_desc" property="taskStateDesc"/> <result column="rec_process" property="recProcess"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <!-- 通用数据库列 --> <sql id="Base_Column_List"> id, patrol_type, patrol_no, patrol_name, problem_name, project_main_id, project_main_name, bind_no, project_name, problem_type, problem_type_name, address, description, pic_no, pic_after_no, after_description, coordinate, state, state_desc, create_user_no, create_user_name, create_user_phone, super_leader_no, super_leader_name, super_leader_check, lead_no, lead_name, center_no, center_name, duty_no, duty_name, handler_lead_no, handler_lead_name, handler_no, handler_name, is_lead_check, source_type, sub_source, is_duty_sub, alarm_type, expected_end_time, completion_time, site_no, event_src_id, event_src, event_level_iD, event_level, event_type_code, event_type, main_type_code, main_type, sub_type_code, sub_type, third_type_code, third_type, deadline_time, urgent_flag, task_num, task_state, task_state_desc, rec_process, create_time, update_time </sql> <sql id="Base_Column_ListExt"> pmp.id, pmp.patrol_type, pmp.patrol_no, pmp.patrol_name, pmp.problem_name, pmp.project_main_id, pmp.project_main_name, pmp.bind_no, pmp.project_name, pmp.problem_type, pmp.problem_type_name, pmp.address, pmp.description, pmp.pic_no, pmp.pic_after_no, pmp.after_description, pmp.coordinate, pmp.state, pmp.state_desc, pmp.create_user_no, pmp.create_user_name, pmp.create_user_phone, pmp.super_leader_no, pmp.super_leader_name, pmp.super_leader_check, pmp.lead_no, pmp.lead_name, pmp.center_no, pmp.center_name, pmp.duty_no, pmp.duty_name, pmp.handler_lead_no, pmp.handler_lead_name, pmp.handler_no, pmp.handler_name, pmp.is_lead_check, pmp.source_type, pmp.sub_source, pmp.is_duty_sub, pmp.alarm_type, pmp.expected_end_time, pmp.completion_time, pmp.site_no, pmp.event_src_id, pmp.event_src, pmp.event_level_iD, pmp.event_level, pmp.event_type_code, pmp.event_type, pmp.main_type_code, pmp.main_type, pmp.sub_type_code, pmp.sub_type, pmp.third_type_code, pmp.third_type, pmp.deadline_time, pmp.urgent_flag, pmp.task_num, pmp.task_state, pmp.task_state_desc, pmp.create_time, pmp.update_time </sql> <resultMap id="problemDto" type="com.newfiber.api.pc.model.River.PatrolManageProblemDto"> <result column="id" property="id"/> <result column="patrol_type" property="patrolType"/> <result column="patrol_no" property="patrolNo"/> <result column="patrol_name" property="patrolName"/> <result column="problem_name" property="problemName"/> <result column="project_main_id" property="projectMainId"/> <result column="project_main_name" property="projectMainName"/> <result column="bind_no" property="bindNo"/> <result column="project_name" property="projectName"/> <result column="problem_type" property="problemType"/> <result column="problem_type_name" property="problemTypeName"/> <result column="address" property="address"/> <result column="description" property="description"/> <result column="pic_no" property="picNo"/> <result column="pic_after_no" property="picAfterNo"/> <result column="after_description" property="afterDescription"/> <result column="coordinate" property="coordinate"/> <result column="state" property="state"/> <result column="state_desc" property="stateDesc"/> <result column="create_user_no" property="createUserNo"/> <result column="create_user_name" property="createUserName"/> <result column="create_user_phone" property="createUserPhone"/> <result column="super_leader_no" property="superLeaderNo"/> <result column="super_leader_name" property="superLeaderName"/> <result column="super_leader_check" property="superLeaderCheck"/> <result column="lead_no" property="leadNo"/> <result column="lead_name" property="leadName"/> <result column="center_no" property="centerNo"/> <result column="center_name" property="centerName"/> <result column="duty_no" property="dutyNo"/> <result column="duty_name" property="dutyName"/> <result column="handler_lead_no" property="handlerLeadNo"/> <result column="handler_lead_name" property="handlerLeadName"/> <result column="handler_no" property="handlerNo"/> <result column="handler_name" property="handlerName"/> <result column="is_lead_check" property="isLeadCheck"/> <result column="source_type" property="sourceType"/> <result column="sub_source" property="subSource"/> <result column="is_duty_sub" property="isDutySub"/> <result column="alarm_type" property="alarmType"/> <result column="expected_end_time" property="expectedEndTime"/> <result column="completion_time" property="completionTime"/> <result column="site_no" property="siteNo"/> <result column="expected_end_time" property="expectedEndTime"/> <result column="event_src_id" property="eventSrcId"/> <result column="event_src" property="eventSrc"/> <result column="event_level_iD" property="eventLevelId"/> <result column="event_level" property="eventLevel"/> <result column="event_type_code" property="eventTypeCode"/> <result column="event_type" property="eventType"/> <result column="main_type_code" property="mainTypeCode"/> <result column="main_type" property="mainType"/> <result column="sub_type_code" property="subTypeCode"/> <result column="sub_type" property="subType"/> <result column="third_type_code" property="thirdTypeCode"/> <result column="third_type" property="thirdType"/> <result column="deadline_time" property="deadlineTime"/> <result column="urgent_flag" property="urgentFlag"/> <result column="task_num" property="taskNum"/> <result column="task_state" property="taskState"/> <result column="task_state_desc" property="taskStateDesc"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <result column="userProblemState" property="userProblemState"/> <result column="rec_process" property="recprocess"/> <collection property="partolManagePics" ofType="com.newfiber.api.pc.model.River.PartolManagePic"> <id column="picId" jdbcType="BIGINT" property="id" /> <result column="pNo" jdbcType="VARCHAR" property="picNo" /> <result column="pic_name" jdbcType="VARCHAR" property="picName" /> <result column="pic_address" jdbcType="VARCHAR" property="picAddress" /> <result column="pUser" jdbcType="VARCHAR" property="createUserNo" /> <result column="pTime" jdbcType="TIMESTAMP" property="createTime" /> <result column="pType" jdbcType="TINYINT" property="type" /> </collection> </resultMap> <resultMap id="stateCountDto" type="com.newfiber.api.pc.model.River.ProblemStateCountDto"> <result column="patrol_no" property="patrolNo"/> <result column="total" property="total"/> <result column="complete" property="complete"/> </resultMap> <update id="updateByName"> update patrol_manage_problem set patrol_no = #{patrolNo},patrol_name = #{patrolName} where patrol_type = #{patrolType} and create_user_no = #{createUserNo} <if test="problemIds != null and problemIds.size() > 0"> and id in <foreach collection="problemIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </update> <select id="patrolProblemList" resultType="com.newfiber.api.pc.model.River.PatrolManageProblemDto"> SELECT <include refid="Base_Column_ListExt"/> FROM `patrol_manage_problem` pmp <if test='problemState != null '> <choose> <when test="problemState == 0"> </when> <when test="problemState == 1"> inner join patrol_manage_user_state pmus on pmp.id = pmus.problem_id and pmus.user_no = #{userNo} and pmus.problem_state = 1 </when> <when test="problemState == 2"> inner join patrol_manage_user_state pmus on pmp.id = pmus.problem_id and pmus.user_no = #{userNo} </when> </choose> </if> where 1=1 <if test="userNo != null"> and (pmp.create_user_no = #{userNo} or pmp.duty_no = #{userNo} or pmp.handler_lead_no =#{userNo} or pmp.handler_no = #{userNo} or pmp.super_leader_no = #{userNo} or pmp.lead_no = #{userNo} or pmp.center_no = #{userNo}) </if> <if test='problemState == 1'> and (pmp.state !=14 and pmp.state!=0) </if> <if test='problemState == 2 '> and (pmp.state = 14 or pmp.state = 0) </if> <if test='stateType !=null'> and pmp.state = #{stateType} </if> <if test='patrolType !=null '> and pmp.patrol_type = #{patrolType} </if> <if test='state != null '> and pmp.sub_source = #{state} </if> <if test="projectIds != null and projectIds.size > 0"> and pmp.project_main_id in <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="problemIds != null and problemIds.size > 0"> and pmp.problem_type in <foreach collection="problemIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> <if test="userName != null"> and pmp.create_user_name like concat('%',#{userName},'%') </if> <if test='searchStr !="" and searchStr != null '> and (pmp.create_user_name like concat('%',#{searchStr},'%') or pmp.problem_type_name like concat('%',#{searchStr},'%') or pmp.project_main_name like concat('%',#{searchStr},'%') or pmp.problem_name like concat('%',#{searchStr},'%') or pmp.address like concat('%',#{searchStr},'%')) </if> group by pmp.id order by create_time desc </select> <select id="problemDetail" resultMap="problemDto"> SELECT pmp.*,pmp.create_time as problemTime, sui.user_name as userName,sui.phone_num,pic.id as picId,pic.pic_no as pNo,pic.pic_name,pic.pic_address,pmus.problem_state as userProblemState, pic.create_user_no as pUser,pic.create_time as pTime,pic.type as pType FROM `patrol_manage_problem` pmp left join patrol_manage_user_state pmus on pmp.id = pmus.problem_id left join huludao_main.sys_user_info sui on pmp.create_user_no = sui.user_no left join partol_manage_pic pic on pmp.pic_no = pic.pic_no where pmp.id = #{problemId} <if test='userNo !="" and userNo != null '> and (pmus.user_no = #{userNo} or pmp.create_user_no = #{userNo} or pmp.lead_no = #{userNo} or pmp.center_no = #{userNo} or pmp.duty_no = #{userNo} or pmp.handler_lead_no = #{userNo} or pmp.handler_no = #{userNo} ) </if> group by pmp.id </select> <select id="problemList" resultMap="problemDto"> SELECT pmp.*,pmp.create_time as problemTime, sui.user_name as userName,sui.phone_num,pic.id as picId,pic.pic_no as pNo,pic.pic_name,pic.pic_address,pmus.problem_state as userProblemState, pic.create_user_no as pUser,pic.create_time as pTime,pic.type as pType FROM `patrol_manage_problem` pmp left join patrol_manage_user_state pmus on pmp.id = pmus.problem_id left join huludao_main.sys_user_info sui on pmp.create_user_no = sui.user_no left join partol_manage_pic pic on pmp.pic_no = pic.pic_no where pmp.patrol_no = #{patrolNo} group by pmp.id </select> <select id="selectStateCount" resultMap="stateCountDto"> SELECT pmp.patrol_no, count(patrol_no) AS total, SUM(CASE WHEN pmp.state=14 THEN 1 ELSE 0 END) AS complete FROM `patrol_manage_problem` pmp where 1=1 <if test="collect != null and collect.size > 0"> and pmp.patrol_no in <foreach collection="collect" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> GROUP BY pmp.patrol_no; </select> <select id="rankList" resultType="com.newfiber.api.pc.model.River.ProblemRankDto"> SELECT pmur.handler_name as userName, pmur.patrol_type, count(pmp.id) AS count FROM `patrol_manage_problem` pmp left join patrol_manage_user_relation pmur on pmp.bind_no = pmur.bind_no WHERE pmp.state = 14 and pmp.alarm_type = 1 AND pmp.expected_end_time > pmp.update_time and pmp.create_time > DATE_SUB(now(), INTERVAL 30 DAY) and pmp.create_time < now() group by pmur.handler_no ORDER BY count DESC </select> <select id="selectStateNum" resultType="java.util.HashMap"> SELECT SUM(CASE WHEN pmp.state!=14 and pmp.state!=0 and pmus.problem_state = 1 THEN 1 ELSE 0 END) AS unComplete, SUM(CASE WHEN pmp.state=14 or pmp.state=0 THEN 1 ELSE 0 END) AS complete FROM `patrol_manage_problem` pmp inner join patrol_manage_user_state pmus on pmp.id = pmus.problem_id and pmus.user_no = #{userNo} where 1=1 <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test='state != null '> and pmp.sub_source = #{state} </if> <if test='stateType != null '> and pmp.state = #{stateType} </if> <if test="projectIds != null and projectIds.size > 0"> and pmp.project_main_id in <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="problemIds != null and problemIds.size > 0"> and pmp.problem_type in <foreach collection="problemIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> <if test="userNo != null"> and (pmp.create_user_no = #{userNo} or pmp.duty_no = #{userNo} or pmp.handler_lead_no =#{userNo} or pmp.handler_no = #{userNo} or pmp.lead_no = #{userNo} or pmp.super_leader_no = #{userNo} or pmp.center_no = #{userNo}) </if> <if test='searchStr !="" and searchStr != null '> and (pmp.create_user_name like concat('%',#{searchStr},'%') or pmp.problem_type_name like concat('%',#{searchStr},'%') or pmp.project_main_name like concat('%',#{searchStr},'%') or pmp.problem_name like concat('%',#{searchStr},'%') or pmp.address like concat('%',#{searchStr},'%')) </if> </select> <select id="selectAllNum" resultType="java.util.HashMap"> SELECT count(pmp.id) as allCount FROM `patrol_manage_problem` pmp where 1=1 <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test='state != null '> and pmp.sub_source = #{state} </if> <if test='stateType != null '> and pmp.state = #{stateType} </if> <if test="projectIds != null and projectIds.size > 0"> and pmp.project_main_id in <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="problemIds != null and problemIds.size > 0"> and pmp.problem_type in <foreach collection="problemIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> <if test="userNo != null"> and (pmp.create_user_no = #{userNo} or pmp.duty_no = #{userNo} or pmp.handler_lead_no =#{userNo} or pmp.handler_no = #{userNo} or pmp.lead_no = #{userNo} or pmp.center_no = #{userNo}) </if> <if test='searchStr !="" and searchStr != null '> and (pmp.create_user_name like concat('%',#{searchStr},'%') or pmp.problem_type_name like concat('%',#{searchStr},'%') or pmp.project_main_name like concat('%',#{searchStr},'%') or pmp.problem_name like concat('%',#{searchStr},'%') or pmp.address like concat('%',#{searchStr},'%')) </if> </select> <select id="countByPatrolType" resultType="java.util.HashMap"> SELECT SUM(CASE WHEN pmp.state!=14 THEN 1 ELSE 0 END) AS unComplete, SUM(CASE WHEN pmp.state=14 THEN 1 ELSE 0 END) AS complete, COUNT(id) AS total FROM `patrol_manage_problem` pmp where pmp.state!=0 <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="sourceType != null"> and pmp.source_type = #{sourceType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> </select> <select id="selectByPatrolType" resultType="com.newfiber.api.pc.model.River.ProblemDto"> SELECT pmp.id,pmp.patrol_type,pmp.project_main_name,pmp.problem_type,pmp.problem_type_name, pmp.source_type,pmp.state,pmp.state_desc,pmp.create_time,pmp.update_time,pmut.user_no as dutyUserNo, sui.user_name as dutyUserName,sui.phone_num as phone FROM `patrol_manage_problem` pmp left join patrol_manage_user_type pmut on pmut.user_type = 3 <if test="patrolType != null"> and pmut.patrol_type = #{patrolType} </if> left join huludao_main.sys_user_info sui on pmut.user_no = sui.user_no <if test="patrolType != null"> where pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> order by create_time desc limit 20 </select> <select id="countBySourceType" resultType="java.util.HashMap"> SELECT SUM(CASE WHEN pmp.sub_source =1 THEN 1 ELSE 0 END) AS digit, SUM(CASE WHEN pmp.sub_source =2 THEN 1 ELSE 0 END) AS leader, SUM(CASE WHEN pmp.sub_source =3 THEN 1 ELSE 0 END) AS hotline, SUM(CASE WHEN pmp.sub_source =4 THEN 1 ELSE 0 END) AS platform, SUM(CASE WHEN pmp.sub_source =5 THEN 1 ELSE 0 END) AS alarm, SUM(CASE WHEN pmp.sub_source =6 THEN 1 ELSE 0 END) AS mayorHotline, SUM(CASE WHEN pmp.sub_source =7 THEN 1 ELSE 0 END) AS dataHotline, SUM(CASE WHEN pmp.sub_source =8 THEN 1 ELSE 0 END) AS other FROM `patrol_manage_problem` pmp where pmp.state!=0 <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> </select> <select id="problemType" resultType="com.newfiber.api.pc.model.River.ProblemTypeDto"> SELECT problem_type,problem_type_name,count(id) as `count` FROM `patrol_manage_problem` pmp where pmp.state!=0 <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> group by pmp.problem_type order by count desc </select> <select id="projectCount" resultType="com.newfiber.api.pc.model.River.ProblemProjectDto"> select project_main_id as projectId,count(id) as count from patrol_manage_problem pmp where project_main_id is not null <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> group by project_main_id </select> <select id="selectPatrolManageProblem" resultType="java.lang.Integer"> select count(id) from patrol_manage_problem where source_type in (3,4,5,6) and state!=0 <if test="patrolType != null"> and patrol_type = #{patrolType} </if> <if test="startTime != null"> and create_time > #{startTime} </if> <if test="endTime != null"> and create_time < #{endTime} </if> </select> <select id="selectProjectCount" resultType="com.newfiber.api.pc.model.River.PatrolTypeCountDto"> SELECT SUM(CASE WHEN pmp.sub_source =1 THEN 1 ELSE 0 END) AS digit, SUM(CASE WHEN pmp.sub_source =2 THEN 1 ELSE 0 END) AS leader, SUM(CASE WHEN pmp.sub_source =3 THEN 1 ELSE 0 END) AS hotline, SUM(CASE WHEN pmp.sub_source =4 THEN 1 ELSE 0 END) AS platform, SUM(CASE WHEN pmp.sub_source =5 THEN 1 ELSE 0 END) AS alarm, SUM(CASE WHEN pmp.sub_source =6 THEN 1 ELSE 0 END) AS mayorHotline, SUM(CASE WHEN pmp.sub_source =7 THEN 1 ELSE 0 END) AS dataHotline, SUM(CASE WHEN pmp.sub_source =0 THEN 1 ELSE 0 END) AS other, count(id) as total FROM `patrol_manage_problem` pmp where pmp.state!=0 <if test="ids != null and ids.size > 0"> and pmp.project_main_id in <foreach collection="ids" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> </select> <select id="selectRank" resultType="com.newfiber.api.pc.model.River.PatrolProblemRankDto"> SELECT pmur.handler_no as userNo,pmur.handler_name as userName,pmp.patrol_type,pmb.project_name, count(pmp.id) as countNum FROM `patrol_manage_problem` pmp right join patrol_manage_user_relation pmur on pmp.create_user_no = pmur.handler_no and pmp.project_main_id = pmur.bind_no left join patrol_manage_base pmb on pmur.bind_no = pmb.id where 1=1 and pmp.source_type in(4,5) <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> group by pmp.create_user_no HAVING countNum >= #{rankCount} </select> <select id="selectProblemTypeCount" resultType="com.newfiber.api.pc.model.River.PatrolProblemTypeCountDto"> select problem_type as problemType,pdc.`name` as problemName,count(pmp.id) as `count` from patrol_manage_problem pmp left join patrol_manage_dic pdc on pmp.problem_type = pdc.patrol_type_id and pdc.source = "problem" where 1=1 and state!=0 <if test="ids != null and ids.size > 0"> and pmp.project_main_id in <foreach collection="ids" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="patrolType != null"> and pmp.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pmp.create_time > #{startTime} </if> <if test="endTime != null"> and pmp.create_time < #{endTime} </if> group by pdc.id,pmp.problem_type,pdc.`name` </select> <select id="selectByTaskNum" resultType="com.newfiber.api.pc.model.River.PatrolManageProblem"> select <include refid="Base_Column_List"/> from patrol_manage_problem pmp where 1=1 <if test="taskNum != null "> and pmp.task_num = #{taskNum} </if> limit 1 </select> </mapper>