<?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.equipment.modules.sysdictionary.dao.SysDictionaryDao"> <!-- Result Map --> <resultMap id="BaseResultMap" type="com.devplatform.equipment.modules.sysdictionary.bean.SysDictionary"> <result column="key_id" property="keyId"/> <result column="id" property="id"/> <result column="name" property="name"/> <result column="value" property="value"/> <result column="parent_id" property="parentId"/> <result column="remark" property="remark"/> <result column="status" property="status"/> <result column="deleted" property="deleted"/> <result column="create_user_id" property="createUserId"/> <result column="create_time" property="createTime"/> <result column="update_user_id" property="updateUserId"/> <result column="update_time" property="updateTime"/> <result column="byx1" property="byx1"/> <result column="byx2" property="byx2"/> <result column="byx3" property="byx3"/> <result column="sys_sign" property="sysSign"/> <result column="sort_value" property="sortValue"/> <result column="station_id" property="stationId"/> </resultMap> <!-- sys_dictionary table all fields --> <sql id="Base_Column_List"> key_id,id,name,value,parent_id,remark,status,deleted,create_user_id,create_time,update_user_id,update_time,byx1,byx2,byx3,sys_sign,sort_value,station_id </sql> <!-- 公共查询条件 --> <sql id="Example_Where_Clause"> where deleted=0 <if test="id!=null and id!=''">and id = #{id}</if> <if test="name!=null and name!=''">and name = #{name}</if> <if test="value!=null and value!=''">and value = #{value}</if> <if test="parentId!=null and parentId!=''">and parent_id = #{parentId}</if> <if test="remark!=null and remark!=''">and remark = #{remark}</if> <if test="status!=null ">and status = #{status}</if> <if test="deleted!=null ">and deleted = #{deleted}</if> <if test="createUserId!=null and createUserId!=''">and create_user_id = #{createUserId}</if> <if test="createTime!=null ">and create_time = #{createTime}</if> <if test="updateUserId!=null and updateUserId!=''">and update_user_id = #{updateUserId}</if> <if test="updateTime!=null ">and update_time = #{updateTime}</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="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if> <if test="sortValue!=null ">and sort_value = #{sortValue}</if> <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if> </sql> <!-- 公共查询条件 --> <sql id="Example_Where_Clause1"> where deleted=0 <if test="model.id!=null and model.id!=''">and id = #{model.id}</if> <if test="model.name!=null and model.name!=''">and name = #{model.name}</if> <if test="model.value!=null and model.value!=''">and value = #{model.value}</if> <if test="model.parentId!=null and model.parentId!=''">and parent_id = #{model.parentId}</if> <if test="model.remark!=null and model.remark!=''">and remark = #{model.remark}</if> <if test="model.status!=null ">and status = #{model.status}</if> <if test="model.deleted!=null ">and deleted = #{model.deleted}</if> <if test="model.createUserId!=null and model.createUserId!=''">and create_user_id = #{model.createUserId}</if> <if test="model.createTime!=null ">and create_time = #{model.createTime}</if> <if test="model.updateUserId!=null and model.updateUserId!=''">and update_user_id = #{model.updateUserId}</if> <if test="model.updateTime!=null ">and update_time = #{model.updateTime}</if> <if test="model.byx1!=null and model.byx1!=''">and byx1 = #{model.byx1}</if> <if test="model.byx2!=null and model.byx2!=''">and byx2 = #{model.byx2}</if> <if test="model.byx3!=null and model.byx3!=''">and byx3 = #{model.byx3}</if> <if test="model.sysSign!=null and model.sysSign!=''">and sys_sign = #{model.sysSign}</if> <if test="model.sortValue!=null ">and sort_value = #{model.sortValue}</if> <if test="model.stationId!=null and model.stationId!=''">and station_id = #{model.stationId}</if> </sql> <!-- 根据id查询data_dictionary --> <select id="queryById" parameterType="Object" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from sys_dictionary where id = #{id} <if test="stationId != null and stationId != ''"> and station_id = #{stationId} </if> </select> <select id="queryByPid" parameterType="Object" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from sys_dictionary where deleted=0 <if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if> <if test="parentId == null"> and parent_id = -1 </if> <if test="stationId != null and stationId != ''"> and station_id = #{stationId} </if> order by sort_value </select> <select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer"> select count(1) from sys_dictionary <include refid="Example_Where_Clause1"/> </select> <select id="queryPageList" parameterType="Object" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from sys_dictionary <include refid="Example_Where_Clause1"/> <if test="model.pager.orderCondition != null and model.pager.orderCondition != ''"> ${model.pager.orderCondition} </if> <if test="model.pager.mysqlQueryCondition != null and model.pager.mysqlQueryCondition != ''"> ${model.pager.mysqlQueryCondition} </if> </select> <!--查询数量--> <select id="queryCountByParentId" parameterType="Object" resultType="java.lang.Integer"> select count(1) from sys_dictionary where deleted=0 and parent_id = #{parentId} <if test="stationId != null and stationId != ''"> and station_id = #{stationId} </if> </select> <select id="querySubId" resultType="java.lang.String"> select id from sys_dictionary where deleted = 0 and parent_id = #{subParentId} and value = #{subCode} and station_id = #{stationId} </select> </mapper>