<?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="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, create_time, update_time </sql> <select id="getList" resultMap="BaseResultMap"> SELECT b.*,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.*,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> and u.is_deleted = false and u.type = 3 order by b.create_time desc </select> </mapper>