<?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="cn.wisenergy.chnmuseum.party.mapper.TBoxOperationMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.TBoxOperation"> <id column="id" property="id"/> <result column="organ_id" property="organId"/> <result column="mac" property="mac"/> <result column="status" property="status"/> <result column="area_id" property="areaId"/> <result column="public_key" property="publicKey" /> <result column="private_key" property="privateKey" /> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <result column="organ_name" property="organName"/> <result column="area_name" property="areaName"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, organ_id, mac, status, area_id, public_key, private_key, create_time, update_time </sql> <select id="getList" resultMap="BaseResultMap"> SELECT b.id,b.organ_id,b.mac,b.status,b.area_id,b.create_time,b.update_time,r.`name` organ_name FROM t_box_operation b left join t_organ r on r.id = b.organ_id where 1=1 <if test="status!= null and status != '' "> and b.status =#{status} </if> <if test="areaId!= null and areaId != '' "> and r.area_id like concat(#{areaId}, '%') </if> </select> <select id="selectBoxPage" resultMap="BaseResultMap"> select b.id,b.organ_id,b.mac,b.status,b.area_id,b.create_time,b.update_time,o.name organ_name,a.full_name area_name from t_user u left join t_organ o on o.id = u.org_id left join t_area a on u.area_id = a.id left join t_box_operation b on b.organ_id = o.id where 1=1 <if test="user.orgId!= null and user.orgId != '' "> and b.organ_id =#{user.orgId} </if> <if test="user.areaId!= null and user.areaId != '' "> and b.area_id =#{user.areaId} </if> <if test="user.orgCode != null and user.orgCode != '' "> and o.code LIKE concat(#{user.orgCode}, '%') </if> <if test="user.areaName != null and user.areaName != '' "> and b.area_id LIKE concat(#{user.areaName}, '%') </if> and u.is_deleted = false and u.type = 3 order by b.create_time desc </select> <select id="selectPageList" resultMap="BaseResultMap"> SELECT b.id,b.organ_id,b.mac,b.status,b.area_id,b.create_time,b.update_time,r.`name` organ_name FROM t_box_operation b left join t_organ r on r.id = b.organ_id where 1=1 <if test="tBoxOperation.organId != null and tBoxOperation.organId != '' "> and b.organ_id =#{tBoxOperation.organId} </if> <if test="tBoxOperation.status != null"> and b.status =#{tBoxOperation.status} </if> <if test="tBoxOperation.areaId != null and tBoxOperation.areaId != '' "> and b.area_id = #{tBoxOperation.areaId} </if> <if test="tBoxOperation.areaName != null and tBoxOperation.areaName != '' "> and b.area_id LIKE concat(#{tBoxOperation.areaName}, '%') </if> </select> </mapper>