<?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.PatrolManageDicMapper"> <!-- 通用映射列 --> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.PatrolManageDic"> <result column="id" property="id"/> <result column="source" property="source"/> <result column="patrolType" property="patrolType"/> <result column="patrol_type_id" property="patrolTypeId"/> <result column="patrol_type_name" property="patrolTypeName"/> <result column="name" property="name"/> <result column="alarm_type" property="alarmType"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <!-- 通用数据库列 --> <sql id="Base_Column_List"> id, source, patrol_type, patrol_type_id, patrol_type_name, name, alarm_type, create_time, update_time </sql> <select id="getListByPatrolType" resultType="com.newfiber.api.pc.model.River.PatrolManageDic"> SELECT <include refid="Base_Column_List"/> FROM `patrol_manage_dic` pmd left join (select pmp.problem_type,count(id) as c from patrol_manage_problem pmp where problem_type is not null GROUP BY problem_type) c on pmd.id = c.problem_type where 1=1 and source = "problem" <if test="patrolType != null"> and pmd.patrol_type = #{patrolType} </if> order by c.c desc </select> <select id="getListByPatrolState" resultType="com.newfiber.api.pc.model.River.PatrolManageDic"> SELECT <include refid="Base_Column_List"/> FROM `patrol_manage_dic` pmd where source = "state" order by FIELD(`patrol_type_id`,1,2,3,4,5,15,6,7,8,9,10,16,11,12,13,14,17,18,19,20,21,22,23,24,0) </select> </mapper>