<?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.EventsManage.ComplaintTaskMapper"> <!-- 通用映射列 --> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.EventsManage.ComplaintTask"> <result column="id" property="id"/> <result column="complaint_type" property="complaintType"/> <result column="complaint_name" property="complaintName"/> <result column="problem_type" property="problemType"/> <result column="problem_name" property="problemName"/> <result column="level" property="level"/> <result column="descrption" property="descrption"/> <result column="is_visit" property="isVisit"/> <result column="phone" property="phone"/> <result column="address" property="address"/> <result column="pic_no" property="picNo"/> <result column="lon" property="lon"/> <result column="lat" property="lat"/> <result column="state" property="state"/> <result column="state_desc" property="stateDesc"/> <result column="is_handle" property="isHandle"/> <result column="is_check" property="isCheck"/> <result column="create_user_phone" property="createUserPhone"/> <result column="create_user_name" property="createUserName"/> <result column="handler_no" property="handlerNo"/> <result column="handler_name" property="handlerName"/> <result column="leader_no" property="leaderNo"/> <result column="leader_name" property="leaderName"/> <result column="check_complaint_no" property="checkComplaintNo"/> <result column="check_complaint_name" property="checkComplaintName"/> <result column="check_handle_no" property="checkHandleNo"/> <result column="check_handle_name" property="checkHandleName"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <!-- 通用数据库列 --> <sql id="Base_Column_List"> id, complaint_type, complaint_name, problem_type, problem_name, `level`, descrption, pic_no, is_visit, phone, address, lon, lat, state, state_desc, is_handle, is_check, create_user_phone, create_user_name, handler_no, handler_name, leader_no, leader_name, check_complaint_no, check_complaint_name, check_handle_no, check_handle_name, create_time, update_time </sql> <resultMap id="complaintDto" type="com.newfiber.api.pc.model.EventsManage.ComplaintTaskDto"> <result column="id" property="id"/> <result column="complaint_type" property="complaintType"/> <result column="complaint_name" property="complaintName"/> <result column="problem_type" property="problemType"/> <result column="problem_name" property="problemName"/> <result column="level" property="level"/> <result column="descrption" property="descrption"/> <result column="is_visit" property="isVisit"/> <result column="phone" property="phone"/> <result column="address" property="address"/> <result column="pic_no" property="picNo"/> <result column="lon" property="lon"/> <result column="lat" property="lat"/> <result column="state" property="state"/> <result column="state_desc" property="stateDesc"/> <result column="is_handle" property="isHandle"/> <result column="is_check" property="isCheck"/> <result column="create_user_phone" property="createUserPhone"/> <result column="create_user_name" property="createUserName"/> <result column="handler_no" property="handlerNo"/> <result column="handler_name" property="handlerName"/> <result column="leader_no" property="leaderNo"/> <result column="leader_name" property="leaderName"/> <result column="check_complaint_no" property="checkComplaintNo"/> <result column="check_complaint_name" property="checkComplaintName"/> <result column="check_handle_no" property="checkHandleNo"/> <result column="check_handle_name" property="checkHandleName"/> <result column="update_time" property="updateTime"/> <result column="ctCreateTime" property="createTime"/> <result column="userState" property="userState"/> <collection property="complainPics" ofType="com.newfiber.api.pc.model.EventsManage.ComplainPic"> <id column="Serial" property="serial" /> <result column="Events_No" property="eventsNo" /> <result column="Pic_Type" property="picType" /> <result column="Pic_Type_Name" property="picTypeName" /> <result column="Pic_Name" property="picName" /> <result column="Pic_Path" property="picPath"/> </collection> </resultMap> <select id="wxTaskList" resultType="com.newfiber.api.pc.model.EventsManage.ComplaintTaskDto"> SELECT ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state as userState FROM `complaint_task` ct left JOIN complaint_user_state cus on ct.id = cus.complaint_task_id where 1=1 <if test="userName != null"> and (ct.create_user_name = #{userName} or ct.handler_no = #{userName} or ct.leader_no = #{userName} or ct.check_complaint_no = #{userName} or ct.check_handle_no = #{userName}) and cus.user_no = #{userName} </if> <if test='type != null '> and ct.complaint_type = #{type} </if> <if test='state != null '> and ct.state = #{state} </if> group by ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state order by ct.create_time desc </select> <select id="pcTaskList" resultType="com.newfiber.api.pc.model.EventsManage.ComplaintTaskDto"> SELECT ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state as userState FROM `complaint_task` ct left JOIN complaint_user_state cus on ct.id = cus.complaint_task_id where 1=1 <if test="userName != null"> and (ct.create_user_name = #{userName} or ct.handler_no = #{userName} or ct.leader_no = #{userName} or ct.check_complaint_no = #{userName} or ct.check_handle_no = #{userName}) and cus.user_no = #{userName} </if> <if test='complaintType != null '> and ct.complaint_type = #{complaintType} </if> <if test='problemType != null '> and ct.problem_type = #{problemType} </if> <if test='level != null '> and ct.level = #{level} </if> <if test='isVisit != null '> and ct.is_visit = #{isVisit} </if> <if test='state != null '> <choose> <when test="state == 1"> and ct.state = 1 </when> <when test="state == 2"> and (ct.state = 2 or ct.state = 3 or ct.state = 4) </when> <when test="state == 3"> and (ct.state = 5 or ct.state = 6 or ct.state = 7) </when> <when test="state == 4"> and ct.state = 8 </when> </choose> </if> group by ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state order by ct.update_time desc,ct.create_time desc,ct.state desc </select> <select id="wxTaskDetail" resultMap="complaintDto"> SELECT ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.update_time,ct.create_time as ctCreateTime,cus.state as userState,cp.Serial, cp.Events_No,cp.Pic_Type,cp.Pic_Type_Name,cp.Pic_Name,cp.Pic_Path FROM `complaint_task` ct left JOIN complaint_user_state cus on ct.id = cus.complaint_task_id left join complain_pic cp on ct.pic_no = cp.Events_No where 1=1 <if test="userName != null"> and (ct.create_user_name = #{userName} or ct.handler_no = #{userName} or ct.leader_no = #{userName} or ct.check_complaint_no = #{userName} or ct.check_handle_no = #{userName}) and cus.user_no = #{userName} </if> and ct.id = #{taskId} </select> <select id="getData" resultType="map"> SELECT SUM(CASE WHEN ct.state=1 and ct.create_time > #{dayBegin} and ct.create_time <= #{dayEnd} THEN 1 ELSE 0 END) AS todayCount, SUM(CASE WHEN ct.state>1 and ct.create_time > #{dayBegin} and ct.create_time <= #{dayEnd} THEN 1 ELSE 0 END) AS todayDisposeCount, count(ct.id) as allEvnetCount FROM `complaint_task` ct; </select> <select id="unCompleteList" resultType="com.newfiber.api.pc.model.EventsManage.ComplaintTaskDto"> SELECT ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state as userState FROM `complaint_task` ct left JOIN complaint_user_state cus on ct.id = cus.complaint_task_id where 1=1 <if test="userName != null"> and (ct.create_user_name = #{userName} or ct.handler_no = #{userName} or ct.leader_no = #{userName} or ct.check_complaint_no = #{userName} or ct.check_handle_no = #{userName}) and cus.user_no = #{userName} </if> <if test='complaintType != null '> and ct.complaint_type = #{complaintType} </if> <if test='problemType != null '> and ct.problem_type = #{problemType} </if> <if test='level != null '> and ct.level = #{level} </if> <if test='isVisit != null '> and ct.is_visit = #{isVisit} </if> <if test='state != null '> <choose> <when test="state == 1"> and ct.state = 1 </when> <when test="state == 2"> and (ct.state = 2 or ct.state = 3 or ct.state = 4) </when> <when test="state == 3"> and (ct.state = 5 or ct.state = 6 or ct.state = 7) </when> <when test="state == 4"> and ct.state = 8 </when> </choose> </if> and ct.state != 8 group by ct.id,ct.complaint_type,ct.complaint_name,ct.problem_type,ct.problem_name, ct.`level`,ct.descrption,ct.is_visit,ct.phone,ct.address,ct.pic_no,ct.lon,ct.lat, ct.state,ct.state_desc,ct.is_handle,ct.is_check,ct.create_user_name,ct.create_user_phone, ct.handler_no,ct.handler_name,ct.leader_no,ct.leader_name,ct.check_complaint_no,ct.check_complaint_name, ct.check_handle_no,ct.check_handle_name,ct.create_time,ct.update_time,cus.state order by ct.update_time desc,ct.create_time desc,ct.state desc </select> </mapper>