<?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.devplatform.alarm.modules.syspreset.dao.SysPresetDao"> <!-- Result Map --> <resultMap id="BaseResultMap" type="com.devplatform.alarm.modules.syspreset.bean.SysPreset"> <result column="id" property="id"/> <result column="resource_id" property="resourceId"/> <result column="name" property="name"/> <result column="order_num" property="orderNum"/> <result column="sys_sign" property="sysSign"/> <result column="deleted" property="deleted"/> <result column="byx1" property="byx1"/> <result column="byx2" property="byx2"/> <result column="byx3" property="byx3"/> <result column="station_id" property="stationId"/> </resultMap> <!-- sys_preset table all fields --> <sql id="Base_Column_List"> id,resource_id,name,order_num,sys_sign,byx1,byx2,byx3,deleted,station_id </sql> <!-- 公共查询条件 --> <sql id="Example_Where_Clause"> where deleted=0 <if test="id!=null and id!=''">and id = #{id}</if> <if test="resourceId!=null and resourceId!=''">and resource_id = #{resourceId}</if> <if test="name!=null and name!=''">and name = #{name}</if> <if test="orderNum!=null ">and order_num = #{orderNum}</if> <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if> <if test="deleted!=null ">and deleted = #{deleted}</if> <if test="byx1!=null and byx1!=''">and byx1 = #{byx1}</if> <if test="byx2!=null and byx2!=''">and byx2 = #{byx2}</if> <if test="byx3!=null and byx3!=''">and byx3 = #{byx3}</if> <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if> </sql> <select id="queryPageByCount" parameterType="com.devplatform.alarm.modules.syspreset.model.SysPresetModel" resultType="java.lang.Integer"> select count(1) from sys_preset WHERE resource_id =#{resourceId} and deleted = 0 <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if> </select> <select id="queryPageByList" parameterType="com.devplatform.alarm.modules.syspreset.model.SysPresetModel" resultType="com.devplatform.alarm.modules.syspreset.bean.SysPreset"> select * from sys_preset WHERE resource_id =#{resourceId} and deleted = 0 <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if> <if test="pager.orderCondition != null and pager.orderCondition != ''"> ${pager.orderCondition} </if> <if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''"> ${pager.mysqlQueryCondition} </if> </select> <select id="countByResourceId" parameterType="object" resultType="java.lang.Integer"> SELECT COUNT(1) FROM sys_preset WHERE deleted = 0 and resource_id=#{resourceId} and order_num = #{orderNum} <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if> <if test="id!=null and id!=''">and id != #{id}</if> </select> </mapper>