<?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.PatrolManageStatisticsMapper"> <!-- 通用映射列 --> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.PatrolManageStatistics"> <result column="id" property="id"/> <result column="patrol_type" property="patrolType"/> <result column="bind_no" property="bindNo"/> <result column="project_name" property="projectName"/> <result column="user_no" property="userNo"/> <result column="day_patrol_time" property="dayPatrolTime"/> <result column="day_patrol_count" property="dayPatrolCount"/> <result column="day_patrol_state" property="dayPatrolState"/> <result column="month_patrol_time" property="monthPatrolTime"/> <result column="month_patrol_count" property="monthPatrolCount"/> <result column="month_patrol_state" property="monthPatrolState"/> <result column="year_patrol_time" property="yearPatrolTime"/> <result column="year_patrol_count" property="yearPatrolCount"/> <result column="year_patrol_state" property="yearPatrolState"/> <result column="year" property="year"/> <result column="month" property="month"/> <result column="time" property="time"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <!-- 通用数据库列 --> <sql id="Base_Column_List"> id, patrol_type, bind_no, project_name, user_no, day_patrol_time, day_patrol_count, day_patrol_state, month_patrol_time, month_patrol_count, month_patrol_state, year_patrol_time, year_patrol_count, year_patrol_state, `year`, `month`, `time`, create_time, update_time </sql> <select id="selectByUser" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List"/> FROM `patrol_manage_statistics` pms where 1=1 <if test="patrolType != null and patrolType != ''"> and pms.patrol_type = #{patrolType} </if> <if test="startTime != null and startTime != ''"> and pms.update_time > #{startTime} </if> <if test="endTime != null and endTime != ''"> and pms.update_time < #{endTime} </if> <if test="collect != null and collect.size > 0"> and pms.bind_no in <foreach collection="collect" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </select> <select id="getDetail" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List"/> FROM `patrol_manage_statistics` pms where 1=1 <if test="bindNo != null and bindNo != ''"> and pms.bind_no = #{bindNo} </if> <if test="patrolType != null and patrolType != ''"> and pms.patrol_type = #{patrolType} </if> <if test="startTime != null"> and pms.update_time > #{startTime} </if> <if test="endTime != null"> and pms.update_time < #{endTime} </if> <if test="userNo != null and userNo != ''"> and pms.user_no = #{userNo} </if> order by update_time desc </select> </mapper>