<?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.ComplaintDao" > <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.EventsManage.Complaint" > <id column="Serial" property="serial" jdbcType="BIGINT" /> <result column="Event_No" property="eventNo" jdbcType="VARCHAR" /> <result column="Complain_Type" property="complainType" jdbcType="VARCHAR" /> <result column="Complain_Type_Name" property="complainTypeName" jdbcType="VARCHAR" /> <result column="Complain_Address" property="complainAddress" jdbcType="NVARCHAR" /> <result column="Complain_User_Name" property="complainUserName" jdbcType="VARCHAR" /> <result column="Complain_Person_Tel" property="complainPersonTel" jdbcType="VARCHAR" /> <result column="Event_Content" property="eventContent" jdbcType="NVARCHAR" /> <result column="Division_No" property="divisionNo" jdbcType="VARCHAR" /> <result column="Complain_Time" property="complainTime" jdbcType="TIMESTAMP" /> <result column="formatTime" property="formatTime" jdbcType="TIMESTAMP" /> <result column="Complain_Urgency" property="complainUrgency" jdbcType="INTEGER" /> <result column="Complain_Urgency_Name" property="complainUrgencyName" jdbcType="NVARCHAR" /> <result column="Event_Source" property="eventSource" jdbcType="INTEGER" /> <result column="Event_Souce_Name" property="eventSouceName" jdbcType="NVARCHAR" /> <result column="River_No" property="riverNo" jdbcType="VARCHAR" /> <result column="Event_Status_Id" property="eventStatusId" jdbcType="INTEGER" /> <result column="Event_Status_Name" property="eventStatusName" jdbcType="NVARCHAR" /> <result column="Complain_User_No" property="complainUserNo" jdbcType="VARCHAR" /> <association property="riverInfoBasis" javaType="com.newfiber.api.pc.model.River.RiverInfoBasis"> <id property="riverNo" column="River_No"/> <result property="riverName" column="River_Name"/> <result property="riverGrade" column="River_Grade"/> <result property="riverGradeZn" column="River_Grade_Zn"/> <result property="parentRiverNo" column="Parent_River_No"/> <result property="riverLength" column="River_Length"/> <result property="riverStartAddress" column="River_Start_Address"/> <result property="riverEndAddress" column="River_End_Address"/> <result property="flowThroughRegion" column="Flow_Through_Region"/> <result property="createTime" column="Create_Time"/> <result property="createUserNo" column="Create_User_No"/> <result property="divisionNo" column="Division_No"/> <result property="riverInformation" column="River_Information"/> <result property="riverPicsNo" column="River_Pics_No"/> <result property="pointXY" column="Point_XY"/> </association> <association property="complainTypeBasis" javaType="com.newfiber.api.pc.model.EventsManage.ComplainTypeBasis"> <id property="complainTypeNo" column="Complain_Type_No"/> <result property="complainTypeName" column="Complain_Type_Name"/> <result property="parentTypeNo" column="Parent_Type_No"/> <result property="createTime" column="Create_Time"/> </association> <collection property="picList" ofType="com.newfiber.api.pc.model.EventsManage.ComplainPic"> <id property="serial" column="Serial"/> <result property="eventsNo" column="Events_No"/> <result property="picType" column="Pic_Type"/> <result property="picTypeName" column="Pic_Type_Name"/> <result property="picName" column="Pic_Name"/> <result property="picPath" column="Pic_Path"/> <result property="createTime" column="Create_Time"/> </collection> </resultMap> <resultMap id="BaseResultMapExt" type="com.newfiber.api.pc.model.EventsManage.Complaint" > <id column="Serial1" property="serial" jdbcType="BIGINT" /> <result column="Event_No1" property="eventNo" jdbcType="VARCHAR" /> <result column="Complain_Type" property="complainType" jdbcType="VARCHAR" /> <result column="Complain_Type_Name" property="complainTypeName" jdbcType="VARCHAR" /> <result column="Complain_Address" property="complainAddress" jdbcType="NVARCHAR" /> <result column="Complain_User_Name" property="complainUserName" jdbcType="VARCHAR" /> <result column="Complain_Person_Tel" property="complainPersonTel" jdbcType="VARCHAR" /> <result column="Event_Content" property="eventContent" jdbcType="NVARCHAR" /> <result column="Division_No" property="divisionNo" jdbcType="VARCHAR" /> <result column="Complain_Time" property="complainTime" jdbcType="TIMESTAMP" /> <result column="formatTime" property="formatTime" jdbcType="TIMESTAMP" /> <result column="Complain_Urgency" property="complainUrgency" jdbcType="INTEGER" /> <result column="Complain_Urgency_Name" property="complainUrgencyName" jdbcType="NVARCHAR" /> <result column="Event_Source" property="eventSource" jdbcType="INTEGER" /> <result column="Event_Souce_Name" property="eventSouceName" jdbcType="NVARCHAR" /> <result column="River_No" property="riverNo" jdbcType="VARCHAR" /> <result column="Event_Status_Id" property="eventStatusId" jdbcType="INTEGER" /> <result column="Event_Status_Name" property="eventStatusName" jdbcType="NVARCHAR" /> <result column="Complain_User_No" property="complainUserNo" jdbcType="VARCHAR" /> <result column="Latitude1" property="latitude" jdbcType="VARCHAR" /> <association property="riverInfoBasis" javaType="com.newfiber.api.pc.model.River.RiverInfoBasis"> <id property="riverNo" column="River_No"/> <result property="riverName" column="River_Name"/> <result property="riverGrade" column="River_Grade"/> <result property="riverGradeZn" column="River_Grade_Zn"/> <result property="parentRiverNo" column="Parent_River_No"/> <result property="riverLength" column="River_Length"/> <result property="riverStartAddress" column="River_Start_Address"/> <result property="riverEndAddress" column="River_End_Address"/> <result property="flowThroughRegion" column="Flow_Through_Region"/> <result property="createTime" column="Create_Time"/> <result property="createUserNo" column="Create_User_No"/> <result property="divisionNo" column="Division_No"/> <result property="riverInformation" column="River_Information"/> <result property="riverPicsNo" column="River_Pics_No"/> <result property="pointXY" column="Point_XY"/> </association> <association property="complainTypeBasis" javaType="com.newfiber.api.pc.model.EventsManage.ComplainTypeBasis"> <id property="complainTypeNo" column="Complain_Type_No"/> <result property="complainTypeName" column="Complain_Type_Name"/> <result property="parentTypeNo" column="Parent_Type_No"/> <result property="createTime" column="Create_Time"/> </association> <collection property="picList" ofType="com.newfiber.api.pc.model.EventsManage.ComplainPic"> <id property="serial" column="Serial"/> <result property="eventsNo" column="Events_No"/> <result property="picType" column="Pic_Type"/> <result property="picTypeName" column="Pic_Type_Name"/> <result property="picName" column="Pic_Name"/> <result property="picPath" column="Pic_Path"/> <result property="createTime" column="Create_Time"/> </collection> </resultMap> <resultMap id="staticMap" type="com.newfiber.api.pc.model.EventsManage.InspectStatistical"> <id property="serial" column="num"/> <result property="name" column="name"/> <collection property="staticList" ofType="com.newfiber.api.pc.model.EventsManage.ComplaintStatic"> <result property="sourceName" column="Event_Souce_Name"/> <result property="toBeReport" column="toBeReport"/> <result property="efficient" column="efficient"/> <result property="disposeING" column="disposeING"/> <result property="disposed" column="disposed"/> <result property="hasChecked" column="hasChecked"/> <result property="finished" column="finished"/> <result property="total" column="total"/> <result property="finishRate" column="finishRate"/> </collection> </resultMap> <sql id="Example_Where_Clause" > <where > <foreach collection="oredCriteria" item="criteria" separator="or" > <if test="criteria.valid" > <trim prefix="(" suffix=")" prefixOverrides="and" > <foreach collection="criteria.criteria" item="criterion" > <choose > <when test="criterion.noValue" > and ${criterion.condition} </when> <when test="criterion.singleValue" > and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue" > and ${criterion.condition} <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Update_By_Example_Where_Clause" > <where > <foreach collection="example.oredCriteria" item="criteria" separator="or" > <if test="criteria.valid" > <trim prefix="(" suffix=")" prefixOverrides="and" > <foreach collection="criteria.criteria" item="criterion" > <choose > <when test="criterion.noValue" > and ${criterion.condition} </when> <when test="criterion.singleValue" > and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue" > and ${criterion.condition} <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Base_Column_List" > <if test="fields == null" > Serial, Event_No, Complain_Type, Complain_Address, Complain_User_Name, Complain_Person_Tel, Event_Content, Division_No, Complain_Time, Complain_Urgency, Complain_Urgency_Name, Event_Source, Event_Souce_Name, River_No, Event_Status_Id, Event_Status_Name, Complain_User_No </if> <if test="fields != null" > ${fields} </if> </sql> <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.newfiber.api.pc.model.EventsManage.ComplaintQuery" > select c.Serial, c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name , d.Division_Name divisionName, u.user_name personName, t.Complain_Type_Name from complaint c INNER JOIN river_info_basis r ON r.River_No=c.River_No LEFT JOIN river_chief ch ON ch.River_No=c.River_No LEFT JOIN huludao_main.sys_user_info u ON ch.Chief_User_No=u.User_No INNER JOIN administrative_division d ON c.Division_No = d.Division_No INNER JOIN complain_type_basis t ON t.Complain_Type_No = c.Complain_Type <choose> <when test="_parameter != null" > <include refid="Example_Where_Clause" /> </when> <otherwise> WHERE 1=1 </otherwise> </choose> <if test="startRow != null" > ORDER BY c.Serial desc limit #{startRow},#{pageSize} </if> </select> <select id="selectPendingComplaint" parameterType="com.newfiber.api.pc.model.EventsManage.Complaint" resultMap="BaseResultMap"> SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , c.Latitude, p.Pic_Name, p.Pic_Path FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 , complain_type_basis t, river_info_basis river WHERE c.Complain_Type = t.Complain_Type_No AND river.River_No = c.River_No AND c.Event_Status_Id != 6 <!-- <choose>--> <!-- <when test="orgType == 1">--> <!-- AND (c.Event_Status_Id = 1 OR c.Event_Status_Id = 3 or c.Event_Status_Id = 5)--> <!-- </when>--> <!-- <when test="orgType == 2">--> <!-- AND c.Event_Status_Id = 2--> <!-- </when>--> <!-- <otherwise>--> <!-- AND c.Event_Status_Id = 4--> <!-- AND EXISTS (--> <!-- SELECT r.River_No FROM division_org_manage d INNER JOIN river_info_basis r ON d.Division_No =--> <!-- r.Division_No--> <!-- WHERE d.Org_No = #{orgNo} AND c.River_No = r.River_No--> <!-- )--> <!-- </otherwise>--> <!-- </choose>--> <if test="eventSource != null"> AND c.Event_Source = #{eventSource} </if> <if test="complainUrgency != null"> AND c.Complain_Urgency = #{complainUrgency} </if> <if test="startTime != null and endTime != null"> AND c.Complain_Time BETWEEN #{startTime} AND #{endTime} </if> <if test="complainType != null"> AND c.Complain_Type = #{eventType} </if> <if test="divisionNo != null"> AND C.Division_No = #{divisionNo} </if> <if test="eventContent != null"> AND c.Event_Content = #{eventContent} </if> ORDER BY c.Serial desc <if test="startRow != null"> limit ${startRow},${pageSize} </if> </select> <select id="countPendingList" parameterType="com.newfiber.api.pc.model.EventsManage.Complaint" resultType="int"> SELECT count(a.Event_No) FROM ( SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , c.Latitude, p.Pic_Name, p.Pic_Path FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 , complain_type_basis t, river_info_basis river WHERE c.Complain_Type = t.Complain_Type_No AND river.River_No = c.River_No AND c.Event_Status_Id != 6 <!-- <choose>--> <!-- <when test="orgType == 1">--> <!-- AND (c.Event_Status_Id = 1 OR c.Event_Status_Id = 3 or c.Event_Status_Id = 5)--> <!-- </when>--> <!-- <when test="orgType == 2">--> <!-- AND c.Event_Status_Id = 2--> <!-- </when>--> <!-- <otherwise>--> <!-- AND c.Event_Status_Id = 4--> <!-- AND EXISTS (--> <!-- SELECT r.River_No FROM division_org_manage d INNER JOIN river_info_basis r ON d.Division_No =--> <!-- r.Division_No--> <!-- WHERE d.Org_No = #{orgNo} AND c.River_No = r.River_No--> <!-- )--> <!-- </otherwise>--> <!-- </choose>--> <!-- --> <if test="eventSource != null"> AND c.Event_Source = #{eventSource} </if> <if test="complainUrgency != null"> AND c.Complain_Urgency = #{complainUrgency} </if> <if test="startTime != null and endTime != null"> AND c.Complain_Time BETWEEN #{startTime} AND #{endTime} </if> <if test="complainType != null"> AND c.Complain_Type = #{eventType} </if> <if test="divisionNo != null"> AND C.Division_No = #{divisionNo} </if> <if test="eventContent != null"> AND c.Event_Content = #{eventContent} </if> ) a </select> <insert id="insertSelective" parameterType="com.newfiber.api.pc.model.EventsManage.Complaint" > insert into complaint <trim prefix="(" suffix=")" suffixOverrides="," > <if test="serial != null" > Serial, </if> <if test="eventNo != null" > Event_No, </if> <if test="complainType != null" > Complain_Type, </if> <if test="complainAddress != null" > Complain_Address, </if> <if test="complainUserName != null" > Complain_User_Name, </if> <if test="complainPersonTel != null" > Complain_Person_Tel, </if> <if test="eventContent != null" > Event_Content, </if> <if test="divisionNo != null" > Division_No, </if> <if test="complainTime != null" > Complain_Time, </if> <if test="complainUrgency != null" > Complain_Urgency, </if> <if test="complainUrgencyName != null" > Complain_Urgency_Name, </if> <if test="eventSource != null" > Event_Source, </if> <if test="eventSouceName != null" > Event_Souce_Name, </if> <if test="riverNo != null" > River_No, </if> <if test="eventStatusId != null" > Event_Status_Id, </if> <if test="eventStatusName != null" > Event_Status_Name, </if> <if test="complainUserNo != null" > Complain_User_No, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="serial != null" > #{serial,jdbcType=BIGINT}, </if> <if test="eventNo != null" > #{eventNo,jdbcType=VARCHAR}, </if> <if test="complainType != null" > #{complainType,jdbcType=VARCHAR}, </if> <if test="complainAddress != null" > #{complainAddress,jdbcType=NVARCHAR}, </if> <if test="complainUserName != null" > #{complainUserName,jdbcType=VARCHAR}, </if> <if test="complainPersonTel != null" > #{complainPersonTel,jdbcType=VARCHAR}, </if> <if test="eventContent != null" > #{eventContent,jdbcType=NVARCHAR}, </if> <if test="divisionNo != null" > #{divisionNo,jdbcType=VARCHAR}, </if> <if test="complainTime != null" > #{complainTime,jdbcType=TIMESTAMP}, </if> <if test="complainUrgency != null" > #{complainUrgency,jdbcType=INTEGER}, </if> <if test="complainUrgencyName != null" > #{complainUrgencyName,jdbcType=NVARCHAR}, </if> <if test="eventSource != null" > #{eventSource,jdbcType=INTEGER}, </if> <if test="eventSouceName != null" > #{eventSouceName,jdbcType=NVARCHAR}, </if> <if test="riverNo != null" > #{riverNo,jdbcType=VARCHAR}, </if> <if test="eventStatusId != null" > #{eventStatusId,jdbcType=INTEGER}, </if> <if test="eventStatusName != null" > #{eventStatusName,jdbcType=NVARCHAR}, </if> <if test="complainUserNo != null" > #{complainUserNo,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countByExample" parameterType="com.newfiber.api.pc.model.EventsManage.ComplaintQuery" resultType="java.lang.Integer" > select count(DISTINCT a.serial) from (select c.Serial serial, c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name riverName, d.Division_Name divisionName, u.user_name personName, t.Complain_Type_Name complainTypeName from complaint c INNER JOIN river_info_basis r ON r.River_No=c.River_No LEFT JOIN river_chief ch ON ch.River_No=c.River_No LEFT JOIN huludao_main.sys_user_info u ON ch.Chief_User_No=u.User_No INNER JOIN administrative_division d ON c.Division_No = d.Division_No INNER JOIN complain_type_basis t ON t.Complain_Type_No = c.Complain_Type <choose> <when test="_parameter != null"> <include refid="Example_Where_Clause"/> </when> <otherwise> WHERE 1=1 </otherwise> </choose> ) a </select> <update id="updateByExampleSelective" parameterType="map" > update complaint <set > <if test="record.serial != null" > Serial = #{record.serial,jdbcType=BIGINT}, </if> <if test="record.eventNo != null" > Event_No = #{record.eventNo,jdbcType=VARCHAR}, </if> <if test="record.complainType != null" > complain_type = #{record.complainType,jdbcType=VARCHAR}, </if> <if test="record.complainAddress != null" > Complain_Address = #{record.complainAddress,jdbcType=NVARCHAR}, </if> <if test="record.complainUserName != null" > Complain_User_Name = #{record.complainUserName,jdbcType=VARCHAR}, </if> <if test="record.complainPersonTel != null" > Complain_Person_Tel = #{record.complainPersonTel,jdbcType=VARCHAR}, </if> <if test="record.eventContent != null" > Event_Content = #{record.eventContent,jdbcType=NVARCHAR}, </if> <if test="record.divisionNo != null" > Division_No = #{record.divisionNo,jdbcType=VARCHAR}, </if> <if test="record.complainTime != null" > Complain_Time = #{record.complainTime,jdbcType=TIMESTAMP}, </if> <if test="record.complainUrgency != null" > Complain_Urgency = #{record.complainUrgency,jdbcType=INTEGER}, </if> <if test="record.complainUrgencyName != null" > Complain_Urgency_Name = #{record.complainUrgencyName,jdbcType=NVARCHAR}, </if> <if test="record.eventSource != null" > Event_Source = #{record.eventSource,jdbcType=INTEGER}, </if> <if test="record.eventSouceName != null" > Event_Souce_Name = #{record.eventSouceName,jdbcType=NVARCHAR}, </if> <if test="record.riverNo != null" > River_No = #{record.riverNo,jdbcType=VARCHAR}, </if> <if test="record.eventStatusId != null" > Event_Status_Id = #{record.eventStatusId,jdbcType=INTEGER}, </if> <if test="record.eventStatusName != null" > Event_Status_Name = #{record.eventStatusName,jdbcType=NVARCHAR}, </if> <if test="record.complainUserNo != null" > Complain_User_No = #{record.complainUserNo,jdbcType=VARCHAR}, </if> </set> <if test="_parameter != null" > <include refid="Update_By_Example_Where_Clause" /> </if> </update> <select id="selectEvetByEventNo" parameterType="String" resultMap="BaseResultMap"> select c.Serial, c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name riverName, u.user_name personName from complaint c INNER JOIN river_info_basis R ON r.River_No=c.River_No INNER JOIN river_chief ch ON ch.River_No=c.River_No INNER JOIN huludao_main.sys_user_info U ON ch.Chief_User_No=u.User_No WHERE c.Event_No=#{eventNo} </select> <select id="selectCommandEvent" parameterType="com.newfiber.api.pc.model.EventsManage.ComplaintQuery" resultMap="BaseResultMap"> select DISTINCT c.Serial, c.Event_No, c.Complain_Type, b.Complain_Type_Name complainTypeName, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name riverName, u.user_name personName from complaint c INNER JOIN river_info_basis r ON r.River_No=c.River_No INNER JOIN river_chief ch ON ch.River_No=c.River_No INNER JOIN huludao_main.sys_user_info u ON ch.Chief_User_No=u.User_No INNER JOIN complain_process p ON p.Event_No=c.Event_No INNER JOIN complain_type_basis b ON b.Complain_Type_No=c.Complain_Type <choose> <when test="_parameter != null" > <include refid="Example_Where_Clause" /> </when> <otherwise> WHERE 1=1 </otherwise> </choose> <if test="userNos != null"> AND <foreach collection="userNos" index="index" item="item" separator="or" open="(" close=")"> p.Dispose_User_No='${item}' </foreach> </if> AND p.Event_Flow_Id=2 <if test="startRow != null" > ORDER BY c.Serial limit #{startRow},#{pageSize} </if> </select> <select id="countCommandEvent" parameterType="com.newfiber.api.pc.model.EventsManage.ComplaintQuery" resultType="int"> SELECT count(a.serial) FROM ( select DISTINCT c.Serial serial, c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name riverName, u.user_name personName from complaint c INNER JOIN river_info_basis r ON r.River_No=c.River_No INNER JOIN river_chief ch ON ch.River_No=c.River_No INNER JOIN huludao_main.sys_user_info u ON ch.Chief_User_No=u.User_No INNER JOIN complain_process p ON p.Event_No=c.Event_No <choose> <when test="_parameter != null" > <include refid="Example_Where_Clause" /> </when> <otherwise> WHERE 1=1 </otherwise> </choose> <if test="userNos != null"> AND <foreach collection="userNos" index="index" item="item" separator="or" open="(" close=")"> p.Dispose_User_No='${item}' </foreach> </if> AND p.Event_Flow_Id=2 <if test="startRow != null" > ORDER BY c.Serial limit #{startRow},#{pageSize} </if>) a </select> <select id="selectEventSourceCount" parameterType="map" resultType="com.newfiber.api.pc.model.EventsManage.Complaint"> SELECT c.Event_Souce_Name eventSouceName, c.Event_Source eventSource, count(c.Serial) count FROM complaint c WHERE 1=1 <if test="startTime != null and endTime != null"> AND c.Complain_Time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP} </if> <if test="typeList != null and typeList.size() > 0"> AND <foreach collection="typeList" index="index" item="item" open="(" close=")" separator="or"> c.Complain_Type = '${item}' </foreach> </if> <if test="divisionList != null and divisionList.size()>0"> AND <foreach collection="divisionList" index="index" item="item" separator="or" close=")" open="("> c.Division_No='${item}' </foreach> </if> GROUP BY c.Event_Souce_Name,c.Event_Source ORDER BY count DESC </select> <select id="countEventOfYear" resultType="com.newfiber.api.pc.model.EventsManage.YearCount" parameterType="Map"> select sum(one) one ,sum(two) two,sum(three) three,sum(four) four, sum(five) five,sum(six) six,sum(seven) seven,sum(eight) eight,sum(nine) nine,sum(ten) ten,sum(eleven) eleven,sum(twelve) twelve from ( select case when month(Complain_Time) = 1 then 1 else 0 end one, case when month(Complain_Time) = 2 then 1 else 0 end two, case when month(Complain_Time) = 3 then 1 else 0 end three, case when month(Complain_Time) = 4 then 1 else 0 end four, case when month(Complain_Time) = 5 then 1 else 0 end five, case when month(Complain_Time) = 6 then 1 else 0 end six, case when month(Complain_Time) = 7 then 1 else 0 end seven, case when month(Complain_Time) = 8 then 1 else 0 end eight, case when month(Complain_Time) = 9 then 1 else 0 end nine, case when month(Complain_Time) = 10 then 1 else 0 end ten, case when month(Complain_Time) = 11 then 1 else 0 end eleven, case when month(Complain_Time) = 12 then 1 else 0 end twelve from complaint where 1=1 <if test="typeList != null"> AND <foreach collection="typeList" open="(" close=")" separator="or" item="item" index="index"> Complain_Type='${item}' </foreach> </if> <if test="divisionList != null and divisionList.size >0"> AND <foreach collection="divisionList" index="index" item="item" separator="or" close=")" open="("> Division_No='${item}' </foreach> </if> and year(Complain_Time) = #{year} ) t </select> <select id="countEventByTimeAndState" parameterType="map" resultType="int"> SELECT count(DISTINCT c.Serial) FROM complaint c <if test="state ==2"> INNER JOIN complain_process p ON p.Event_No=c.Event_No </if> WHERE 1=1 <if test="typeList != null and typeList.size() != 0"> AND <foreach collection="typeList" open="(" close=")" separator="or" item="item" index="index"> c.Complain_Type='${item}' </foreach> </if> <if test="divisionList != null"> AND <foreach collection="divisionList" index="index" item="item" separator="or" close=")" open="("> c.Division_No='${item}' </foreach> </if> <if test="state == 1"> AND c.Complain_Time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP} </if> <if test="state == 2"> AND p.Event_Time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP} AND p.Event_Flow_Id = 5 </if> </select> <select id="getMyRiverEventsCount" resultType="int"> SELECT COUNT(c.Serial) FROM complaint c LEFT JOIN river_chief r ON r.River_No = c.River_No WHERE 1=1 <if test="elist != null and elist.size()>0"> AND c.Event_Status_Id IN <foreach collection="elist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="ulist != null and ulist.size()>0"> AND r.Chief_User_No IN <foreach collection="ulist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null and endTime != null"> AND c.Create_Data_Time BETWEEN #{startTime} AND #{endTime} </if> </select> <select id="getMyRiverEventsCountNew" resultType="int"> SELECT COUNT(c.Serial) FROM complaint c WHERE 1=1 <if test="elist != null and elist.size()>0"> AND c.Event_Status_Id IN <foreach collection="elist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="divisionList != null and divisionList.size()>0"> AND c.Division_No IN <foreach collection="divisionList" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null and endTime != null"> AND c.Create_Data_Time BETWEEN #{startTime} AND #{endTime} </if> </select> <select id="getCurrentUserRole" parameterType="java.lang.String" resultType="java.lang.String"> SELECT r.role_name FROM huludao_main.sys_roles r INNER JOIN huludao_main.sys_role_org ro ON r.Role_No = ro.Role_No INNER JOIN huludao_main.sys_user_org uo ON uo.Org_No = ro.Org_No WHERE uo.User_No = #{userNo} </select> <select id="getMyRiverEvents" parameterType="java.util.List" resultMap="BaseResultMap"> SELECT c.Serial, c.Event_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, t.Complain_Type_Name Complain_Type_Name FROM complaint c INNER JOIN complain_type_basis t ON t.Complain_Type_No = c.Complain_Type INNER JOIN river_chief r ON c.River_No = r.River_No WHERE r.Chief_User_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> <if test="elist != null"> AND c.Event_Status_Id IN <foreach collection="elist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="riverNo != null and riverNo != ''"> AND c.River_No =#{riverNo} </if> <if test="sort != null"> ORDER BY ${sort} <if test="order != null"> ${order} </if> </if> <if test="sort == null"> ORDER BY formatTime DESC </if> limit 0 , 20 </select> <select id="getEventsCount" parameterType="java.util.List" resultType="int"> SELECT COUNT(c.Serial) FROM complaint c INNER JOIN complain_type_basis t ON t.Complain_Type_No = c.Complain_Type INNER JOIN river_chief r ON c.River_No = r.River_No WHERE r.Chief_User_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> <if test="elist != null"> AND c.Event_Status_Id IN <foreach collection="elist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="riverNo != null"> AND c.River_No =#{riverNo} </if> </select> <select id="getMyTraceEvents" parameterType="java.lang.String" resultMap="BaseResultMap"> SELECT c.Serial, c.Event_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, t.Complain_Type_Name complainTypeName FROM complaint c INNER JOIN complain_type_basis t ON t.Complain_Type_No = c.Complain_Type INNER JOIN event_trace e ON e.Event_No = c.Event_No WHERE e.User_No = #{userNo} <if test="sort != null"> ORDER BY ${sort} <if test="order != null"> ${order} </if> </if> <if test="sort == null"> ORDER BY formatTime DESC </if> </select> <select id="getMyRuleRiver" parameterType="java.util.List" resultType="com.newfiber.api.pc.model.River.RiverInfoBasis"> SELECT distinct r.Serial, r.River_No riverNo, r.River_Name riverName FROM river_info_basis r INNER JOIN division_org_manage d ON d.Division_No = r.Division_No INNER JOIN huludao_main.sys_user_org s ON s.Org_No = d.Org_No WHERE 1=1 <if test="list.size() != 0 and list != null"> s.User_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </select> <select id="getMyRuleRiverCount" parameterType="java.util.List" resultType="int"> SELECT COUNT(r.Serial) FROM river_info_basis r INNER JOIN division_org_manage d ON d.Division_No = r.Division_No INNER JOIN huludao_main.sys_user_org s ON s.Org_No = d.Org_No WHERE s.User_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </select> <select id="getMyRiverChief" parameterType="java.lang.String" resultType="java.lang.String"> select s.User_No from huludao_main.sys_user_org s INNER JOIN division_org_manage d on s.Org_No=d.Org_No WHERE d.Division_No in ( SELECT d1.Division_No FROM division_org_manage d1 INNER JOIN huludao_main.sys_user_org s1 on s1.Org_No=d1.Org_No WHERE s1.User_No = #{userNo} ) </select> <select id="selectEventTraceList" parameterType="com.newfiber.api.pc.model.EventsManage.ComplaintQuery" resultMap="BaseResultMap"> SELECT DISTINCT t.Serial, c.Event_No, c.Complain_Type, b.Complain_Type_Name complainTypeName, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, r.River_Name riverName FROM complaint c INNER JOIN event_trace t ON c.Event_No = t.Event_No INNER JOIN river_info_basis r ON c.River_No=r.River_No INNER JOIN complain_type_basis b ON b.Complain_Type_No=c.Complain_Type <choose> <when test="_parameter != null" > <include refid="Example_Where_Clause" /> </when> <otherwise> WHERE 1=1 </otherwise> </choose> <if test="userNo != null and userNo !=''"> AND t.User_No=#{userNo} </if> ORDER BY formatTime DESC <if test="startRow != null"> limit #{startRow},#{pageSize} </if> </select> <select id="countTraceEvent" parameterType="String" resultType="int"> SELECT count(a.eventNo) FROM (SELECT DISTINCT c.Event_No eventNo FROM complaint C INNER JOIN event_trace T ON C.Event_No = t.Event_No WHERE 1=1 <if test="userNo != null and userNo !=''"> AND t.User_No=#{userNo} </if>) a </select> <select id="selectAddableTraceEvent" parameterType="map" resultMap="BaseResultMap"> SELECT DISTINCT c.Serial, c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, DATE_FORMAT(c.Complain_Time,'%Y-%m-%d %T') formatTime, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Complain_User_No, c.Event_Status_Id, c.Event_Status_Name, d.Division_Name divisionName FROM complaint c INNER JOIN administrative_division d ON c.Division_No=d.Division_No WHERE c.Event_No NOT IN ( SELECT DISTINCT t.Event_No FROM event_trace T WHERE t.User_No = #{userNo} ) <if test="startRow != null and pageSize != null"> ORDER BY formatTime DESC limit #{startRow},#{pageSize} </if> </select> <select id="countAddableTraceEvent" parameterType="String" resultType="int"> SELECT count(a.eventNo) FROM (SELECT DISTINCT c.Event_No eventNo FROM complaint c WHERE c.Event_No NOT IN ( SELECT DISTINCT t.Event_No FROM event_trace T WHERE t.User_No = #{userNo} )) a </select> <select id="getEventStatisticsInfo" parameterType="Map" resultType="com.newfiber.api.pc.model.EventsManage.EventStatistics"> select t.Complain_Type_Name typeName,count(c.Event_No) eventCount from complain_type_basis t left join complaint c on t.Complain_Type_No = c.Complain_Type left JOIN river_info_basis r ON r.River_No=c.River_No LEFT JOIN river_chief ch ON ch.River_No=c.River_No LEFT JOIN huludao_main.sys_user_info u ON ch.Chief_User_No=u.User_No left JOIN administrative_division d ON c.Division_No = d.Division_No WHERE 1=1 <if test="divisions != null and divisions.size>0"> AND (d.Division_No in <foreach collection="divisions" item="division" open="(" separator="," close=")"> #{division} </foreach> OR d.Division_No is null) </if> AND (c.Complain_Time BETWEEN #{st} and #{et} ) group by t.Complain_Type_Name </select> <select id="selectByDivisionNo" parameterType="String" resultMap="BaseResultMap"> SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , p.Pic_Name, p.Pic_Path, Latitude FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 , complain_type_basis t, river_info_basis river WHERE c.Complain_Type = t.Complain_Type_No AND river.River_No = c.River_No AND EXISTS ( SELECT r.River_No FROM river_info_basis r WHERE 1=1 <if test="divisionNo != null and divisionNo !=''"> AND r.Division_No = #{divisionNo} </if> AND r.River_No = c.River_No )order by Complain_Time desc <if test="page != null and rows != null"> limit #{page},#{rows} </if> </select> <select id="selectInfo" parameterType="String" resultMap="BaseResultMap"> SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , r.River_Name , p.Pic_Name, p.Pic_Path, c.Latitude FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 ,complain_type_basis t , river_info_basis r WHERE 1=1 AND c.Complain_Type = t.Complain_Type_No AND r.River_No = c.River_No <if test="eventNo != null and eventNo"> AND c.Event_No = #{eventNo} </if> </select> <select id="selectOrgNameByEventNo" parameterType="String" resultType="String"> SELECT DISTINCT Org_Name orgName FROM complaint c INNER JOIN river_info_basis r ON c.River_No = r.River_No INNER JOIN division_org_manage d ON r.Division_No = d.Division_No INNER JOIN huludao_main.sys_organization o ON d.Org_No = o.Org_No WHERE o.Org_Type = 3 AND c.Event_No = #{eventNo} </select> <select id="selectStaticData" parameterType ="com.newfiber.api.pc.model.EventsManage.Complaint" resultMap="BaseResultMap"> SELECT Serial, Event_No, Complain_Type, Complain_Address, Complain_User_Name, Complain_Person_Tel, Event_Content, Division_No, DATE_FORMAT(Complain_Time,'%Y-%m-%d %T') formatTime, Complain_Urgency, Complain_Urgency_Name, Event_Source, Event_Souce_Name, River_No, Complain_User_No, Event_Status_Id, Event_Status_Name FROM complaint WHERE 1=1 <if test="divisionNo != null"> AND Division_No = #{divisionNo} </if> <if test="startTime != null and endTime != null"> and Complain_Time between #{startTime} and #{endTime} </if> <if test="eventSource != null"> and Event_Source = #{eventSource} </if> <if test="eventStatusId != null"> and Event_Status_Id = #{eventStatusId} </if> <if test="riverNo != null"> and River_No = #{riverNo} </if> <if test="startRow != null"> limit #{startRow},#{pageSize} </if> </select> <select id="selectWithOutType1" parameterType ="com.newfiber.api.pc.model.EventsManage.Complaint" resultMap="BaseResultMap"> SELECT Serial, Event_No, Complain_Type, Complain_Address, Complain_User_Name, Complain_Person_Tel, Event_Content, Division_No, DATE_FORMAT(Complain_Time,'%Y-%m-%d %T') formatTime, Complain_Urgency, Complain_Urgency_Name, Event_Source, Event_Souce_Name, River_No, Complain_User_No, Event_Status_Id, Event_Status_Name FROM complaint WHERE 1=1 <choose> <when test="staticType == 1"> <if test="divisionNo != null"> AND Division_No = #{divisionNo} </if> </when> <when test="staticType ==2"> <if test="riverNo != null"> and River_No = #{riverNo} </if> </when> </choose> <if test="startTime != null and endTime != null"> and Complain_Time between #{startTime} and #{endTime} </if> <if test="eventSource != null"> and Event_Source = #{eventSource} </if> <if test="eventStatusId != null"> and Event_Status_Id = #{eventStatusId} </if> </select> <select id="countStaticData" parameterType="com.newfiber.api.pc.model.EventsManage.Complaint" resultType="int"> SELECT count(serial) FROM complaint WHERE 1=1 <if test="divisionNo != null"> AND Division_No = #{divisionNo} </if> <if test="startTime != null and endTime != null"> and Complain_Time between #{startTime} and #{endTime} </if> <if test="eventSource != null"> and Event_Source = #{eventSource} </if> <if test="eventStatusId != null"> and Event_Status_Id = #{eventStatusId} </if> </select> <select id="getInspectStatisticalDivision" parameterType="Map" resultMap="staticMap"> SELECT b.Division_No num, b.Division_Name name, b.Event_Souce_Name, a.toBeReport, a.efficient, a.disposeING, a.disposed, a.hasChecked, a.finished, b.total, case when FORMAT(IFNULL(a.finished, 0) / b.total * 100,1) > 100 then 100.0 else FORMAT(IFNULL(a.finished, 0) / b.total * 100,1) end as finishRate,1 as od FROM ( SELECT c.Division_No, c.Event_Souce_Name, ad.Division_Name, count(*) AS total FROM complaint c INNER JOIN administrative_division ad ON c.Division_No = ad.Division_No where ad.Division_No IN <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.Division_No, c.Event_Souce_Name, ad.Division_Name ORDER BY Division_No ) b inner JOIN ( select Division_No,Event_Souce_Name, SUM(toBeReport) as toBeReport ,SUM(efficient) as efficient ,SUM(disposeING) as disposeING ,SUM(disposed) as disposed ,SUM(hasChecked) as hasChecked ,SUM(finished) as finished FROM ( SELECT c.Division_No, c.Event_Souce_Name, SUM(CASE c.Event_Status_Id WHEN 1 THEN 1 ELSE 0 END) toBeReport, SUM(CASE c.Event_Status_Id WHEN 2 THEN 1 ELSE 0 END) efficient, SUM(CASE c.Event_Status_Id WHEN 3 THEN 1 ELSE 0 END) disposeING, SUM(CASE c.Event_Status_Id WHEN 4 THEN 1 ELSE 0 END) disposed, SUM(CASE c.Event_Status_Id WHEN 5 THEN 1 ELSE 0 END) hasChecked, SUM(CASE c.Event_Status_Id WHEN 6 THEN 1 ELSE 0 END) finished FROM complaint c INNER JOIN administrative_division ad ON c.Division_No = ad.Division_No WHERE ad.Division_No IN <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.Division_No, c.Event_Souce_Name, c.Event_Status_Id ORDER BY Division_No ) t GROUP BY t.Division_No,t.Event_Souce_Name ) a ON a.Division_No = b.Division_No and a.Event_Souce_Name=b.Event_Souce_Name UNION ALL select Division_No ,Division_Name as Division_Name ,"合计" as Event_Souce_Name, SUM(toBeReport) as toBeReport ,SUM(efficient) as efficient ,SUM(disposeING) as disposeING ,SUM(disposed) as disposed ,SUM(hasChecked) as hasChecked ,SUM(finished) as finished ,SUM(total) as total ,case when FORMAT(SUM(finished) / SUM(total) * 100,1) > 100 then 100.0 else FORMAT(SUM(finished) / SUM(total) * 100,1) end as completionRate ,2 as od FROM ( SELECT c.Division_No, ad.Division_Name, SUM(CASE c.Event_Status_Id WHEN 1 THEN 1 ELSE 0 END) toBeReport, SUM(CASE c.Event_Status_Id WHEN 2 THEN 1 ELSE 0 END) efficient, SUM(CASE c.Event_Status_Id WHEN 3 THEN 1 ELSE 0 END) disposeING, SUM(CASE c.Event_Status_Id WHEN 4 THEN 1 ELSE 0 END) disposed, SUM(CASE c.Event_Status_Id WHEN 5 THEN 1 ELSE 0 END) hasChecked, SUM(CASE c.Event_Status_Id WHEN 6 THEN 1 ELSE 0 END) finished, SUM(1) as total FROM complaint c INNER JOIN administrative_division ad ON c.Division_No = ad.Division_No WHERE ad.Division_No IN <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.Division_No, c.Event_Souce_Name, c.Event_Status_Id, ad.Division_Name ORDER BY Division_No ) t GROUP BY t.Division_No, t.Division_Name <choose> <when test="order !=null and order != '' and sort != null and sort != ''"> order by num,od asc, ${order} ${sort} </when> <otherwise> order by num,od asc,total asc </otherwise> </choose> </select> <select id="getInspectStatisticalRiver" parameterType="Map" resultMap="staticMap"> SELECT b.River_No num, b.River_Name name, b.Event_Souce_Name, a.toBeReport, a.efficient, a.disposeING, a.disposed, a.hasChecked, a.finished, b.total, case when FORMAT(IFNULL(a.finished, 0) / b.total * 100,1) > 100 then 100.0 else FORMAT(IFNULL(a.finished, 0) / b.total * 100,1) end as finishRate, 1 as od FROM ( SELECT c.River_No, c.Event_Souce_Name, ad.River_Name, count(*) AS total FROM complaint c INNER JOIN river_info_basis ad ON c.River_No = ad.River_No where ad.River_No IN <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.River_No, c.Event_Souce_Name, ad.River_Name ORDER BY River_No ) b inner JOIN ( select River_No,Event_Souce_Name, SUM(toBeReport) as toBeReport ,SUM(efficient) as efficient ,SUM(disposeING) as disposeING ,SUM(disposed) as disposed ,SUM(hasChecked) as hasChecked ,SUM(finished) as finished FROM ( SELECT c.River_No, c.Event_Souce_Name, SUM(CASE c.Event_Status_Id WHEN 1 THEN 1 ELSE 0 END) toBeReport, SUM(CASE c.Event_Status_Id WHEN 2 THEN 1 ELSE 0 END) efficient, SUM(CASE c.Event_Status_Id WHEN 3 THEN 1 ELSE 0 END) disposeING, SUM(CASE c.Event_Status_Id WHEN 4 THEN 1 ELSE 0 END) disposed, SUM(CASE c.Event_Status_Id WHEN 5 THEN 1 ELSE 0 END) hasChecked, SUM(CASE c.Event_Status_Id WHEN 6 THEN 1 ELSE 0 END) finished FROM complaint c INNER JOIN river_info_basis ad ON c.River_No = ad.River_No WHERE ad.River_No in <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.River_No, c.Event_Souce_Name, c.Event_Status_Id ORDER BY River_No ) t GROUP BY t.River_No,t.Event_Souce_Name ) a ON a.River_No = b.River_No and a.Event_Souce_Name=b.Event_Souce_Name UNION ALL select River_No ,River_Name as name ,"合计" as Event_Souce_Name, SUM(toBeReport) as toBeReport ,SUM(efficient) as efficient ,SUM(disposeING) as disposeING ,SUM(disposed) as disposed ,SUM(hasChecked) as hasChecked ,SUM(finished) as finished ,SUM(total) as total ,case when FORMAT(SUM(finished) / SUM(total) * 100,1) > 100 then 100.0 else FORMAT(SUM(finished) / SUM(total) * 100,1) end as completionRate ,2 as od FROM ( SELECT c.River_No, ad.River_Name, SUM(CASE c.Event_Status_Id WHEN 1 THEN 1 ELSE 0 END) toBeReport, SUM(CASE c.Event_Status_Id WHEN 2 THEN 1 ELSE 0 END) efficient, SUM(CASE c.Event_Status_Id WHEN 3 THEN 1 ELSE 0 END) disposeING, SUM(CASE c.Event_Status_Id WHEN 4 THEN 1 ELSE 0 END) disposed, SUM(CASE c.Event_Status_Id WHEN 5 THEN 1 ELSE 0 END) hasChecked, SUM(CASE c.Event_Status_Id WHEN 6 THEN 1 ELSE 0 END) finished, SUM(1) as total FROM complaint c INNER JOIN river_info_basis ad ON c.River_No = ad.River_No WHERE ad.River_No in <foreach collection="paraList" item="divisionNo" open="(" close=")" separator=","> #{divisionNo} </foreach> <if test="st != null and et != null"> and c.Complain_Time between #{st} and #{et} </if> GROUP BY c.River_No, c.Event_Souce_Name, c.Event_Status_Id ORDER BY River_No ) t GROUP BY t.River_No <choose> <when test="order !=null and order != '' and sort != null and sort != ''"> order by num,od asc, ${order} ${sort} </when> <otherwise> order by num,od asc ,total asc </otherwise> </choose> </select> <select id="selectEventSourceList" resultType="com.newfiber.api.pc.model.EventsManage.EventSourceBasis"> SELECT sourceNo,sourceName FROM event_source_basis </select> <select id="selectEventSource" parameterType="String" resultType="com.newfiber.api.pc.model.EventsManage.EventSourceBasis"> SELECT sourceNo,sourceName FROM event_source_basis where sourceNo = #{sourceNo} </select> <!--获取某时间段登录用户同级别河流问题数量--> <select id="problemStatisticalInfo" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.ProblemStatistical"> select a.Complain_Type_No code,a.Complain_Type_Name name ,count(b.Complain_Type) num from complain_type_basis a LEFT JOIN complaint b on a.Complain_Type_No = b.Complain_Type where ( exists (select rb.River_No from river_info_basis rb, administrative_division ad where rb.Division_No = ad.Division_No and rb.River_No = b.River_No and exists ( select f.Division_No from login_info c,river_chief d, river_info_basis e ,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Parent_Division_No = ad.Parent_Division_No and c.sId = #{sid} ) ) or b.River_No is null) AND (b.Create_Data_Time BETWEEN #{st} and #{et} OR b.River_No is null) GROUP BY a.Complain_Type_No,a.Complain_Type_Name </select> <!--获取某时间段当前用户同级别河流所有问题总数量--> <select id="problemTotal" parameterType="Map" resultType="int"> select count(b.Complain_Type) from complain_type_basis a LEFT JOIN complaint b on a.Complain_Type_No = b.Complain_Type where ( exists (select rb.River_No from river_info_basis rb, administrative_division ad where rb.Division_No = ad.Division_No and rb.River_No = b.River_No and exists ( select f.Division_No from login_info c,river_chief d, river_info_basis e ,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Parent_Division_No = ad.Parent_Division_No and c.sId = #{sid} ) ) or b.River_No is null) AND b.Create_Data_Time BETWEEN #{st} and #{et} </select> <!--获取某时间段当前用户同下级河流各类问题总数量--> <select id="problemStatisticalSubordinate" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.ProblemStatistical"> select a.Complain_Type_No code,a.Complain_Type_Name name ,count(b.Complain_Type) num from complain_type_basis a LEFT JOIN complaint b on a.Complain_Type_No = b.Complain_Type where ( exists (select rb.River_No from river_info_basis rb, administrative_division ad where rb.Division_No = ad.Division_No and rb.River_No = b.River_No and exists ( select f.Division_No from login_info c,river_chief d, river_info_basis e ,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Division_No = ad.Parent_Division_No and c.sId = #{sid} ) ) or b.River_No is null ) AND (b.Create_Data_Time BETWEEN #{st} and #{et} or b.River_No is null) GROUP BY a.Complain_Type_No,a.Complain_Type_Name </select> <!--获取某时间段当前用户同下级河流所有问题总数量--> <select id="problemTotalSubordinate" parameterType="Map" resultType="int"> select count(b.Complain_Type) from complain_type_basis a LEFT JOIN complaint b on a.Complain_Type_No = b.Complain_Type where ( exists (select rb.River_No from river_info_basis rb, administrative_division ad where rb.Division_No = ad.Division_No and rb.River_No = b.River_No and exists ( select f.Division_No from login_info c,river_chief d, river_info_basis e ,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Division_No = ad.Parent_Division_No and c.sId = #{sid} ) ) or b.River_No is null ) AND (b.Create_Data_Time BETWEEN #{st} and #{et} or b.River_No is null) </select> <!--获取当前用户某时间段同本级河流巡查事件数量--> <select id="InspectEvent" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.ProblemStatistical"> select a.River_No code,a.River_Name name,count(b.Complain_Type) num from river_info_basis a inner JOIN administrative_division ad on a.Division_No = ad.Division_No LEFT JOIN complaint b on a.River_No = b.River_No <if test="problemState != null"> AND b.Event_Status_Id =#{problemState} </if> where exists (select d.Chief_Grade from login_info c,river_chief d,river_info_basis e,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Parent_Division_No = ad.Parent_Division_No and c.sId = #{sid}) and (b.Create_Data_Time BETWEEN #{st} and #{et} or b.River_No is null) GROUP BY a.River_No ,a.River_Name ORDER BY a.River_No <if test="startPage != null and pageSize != null"> limit #{startPage},#{pageSize} </if> </select> <!--获取当前用户某时间段下级区域巡查事件数量--> <select id="InspectEventSubordinate" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.ProblemStatistical"> select ad.Division_No code,ad.Division_Name name,count(b.Complain_Type) num from river_info_basis a inner JOIN administrative_division ad on a.Division_No = ad.Division_No LEFT JOIN complaint b on a.River_No = b.River_No <if test="problemState != null"> AND b.Event_Status_Id =#{problemState} </if> where exists (select d.Chief_Grade from login_info c,river_chief d,river_info_basis e,administrative_division f where c.userNo = d.Chief_User_No and d.River_No = e.River_No and e.Division_No = f.Division_No and f.Division_No = ad.Parent_Division_No and c.sId = #{sid}) and (b.Create_Data_Time BETWEEN #{st} and #{et} or b.River_No is null) GROUP BY ad.Division_No,ad.Division_Name ORDER BY ad.Division_No <if test="startPage != null and pageSize != null"> limit #{startPage},#{pageSize} </if> </select> <!--查询河流的巡查事件--> <select id="queryListByRiver" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.PatrolProblem"> SELECT a.Create_Data_Time problemTime,a.Problem_Address problemAddress,a.Problem_State_Str problemStateStr,b.Complain_Type_Name complainTypeName FROM complaint a,complain_type_basis b WHERE a.Problem_Type = b.Complain_Type_No <if test="st != null and et != null"> and a.Create_Data_Time BETWEEN #{st} and #{et} </if> AND a.River_No = #{riverNo} </select> <!--查询区域的问题数量--> <select id="problemTotalOfArea" parameterType="Map" resultType="com.newfiber.api.mobile.model.domain.ProblemStatistical"> select b.River_No code,b.River_Name name,d.user_name userName,count(e.Complain_Type) num from administrative_division a inner join river_info_basis b on a.Division_No = b.Division_No left join river_chief c on b.River_No = c.River_No left join huludao_main.sys_user_info d on c.Chief_User_No = d.User_no left join complaint e on b.River_No = e.River_No <if test="problemState != null"> AND e.Event_Status_Id =#{problemState} </if> where (e.Create_Data_Time BETWEEN #{st} and #{et} or e.River_No is null) AND a.Division_No = #{divisionNo} GROUP BY b.River_No,b.River_Name,d.user_name ORDER by b.River_No </select> <!--据行政区划编号查询投诉列表--> <select id="selectByDivisionNoNew" parameterType="Map" resultMap="BaseResultMap"> SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , c.Latitude p.Pic_Name, p.Pic_Path FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 , complain_type_basis t, river_info_basis river WHERE c.Complain_Type = t.Complain_Type_No AND river.River_No = c.River_No AND c.Create_Data_Time BETWEEN #{st} and #{et} AND EXISTS ( SELECT r.River_No FROM river_info_basis r <if test="divisionNo != null and divisionNo !=''"> WHERE r.Division_No = #{divisionNo} </if> AND r.River_No = c.River_No ) </select> <!--据行政区划编号查询投诉列表--> <select id="selectByRiverNo" parameterType="Map" resultMap="BaseResultMap"> SELECT c.Event_No, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , c.Latitude, p.Pic_Name, p.Pic_Path FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No left join complain_type_basis t on c.Complain_Type = t.Complain_Type_No left join river_info_basis river on river.River_No = c.River_No WHERE p.Pic_Type = 1 AND c.Create_Data_Time BETWEEN #{st} and #{et} AND c.River_No = #{riverNo} <if test="startRow != null and rows != null"> limit #{startRow},#{rows} </if> </select> <select id="getComplaint" parameterType="com.newfiber.api.pc.model.EventsManage.Complaint" resultMap="BaseResultMapExt"> SELECT c.Serial as Serial1, c.Event_No as Event_No1, c.Complain_Type, c.Complain_Address, c.Complain_User_Name, c.Complain_Person_Tel, c.Event_Content, c.Division_No, c.Complain_Time, c.Complain_Urgency, c.Complain_Urgency_Name, c.Event_Source, c.Event_Souce_Name, c.River_No, c.Event_Status_Id, c.Event_Status_Name, c.Complain_User_No, c.Create_Data_Time, t.Complain_Type_Name , river.River_Name , c.Latitude, p.Pic_Name, p.Pic_Path FROM complaint c LEFT JOIN complain_pic p ON c.Event_No = p.Events_No AND p.Pic_Type = 1 , complain_type_basis t, river_info_basis river WHERE c.Complain_Type = t.Complain_Type_No AND river.River_No = c.River_No AND c.Event_Status_Id != 6 and c.Event_No = #{eventNo} </select> </mapper>