<?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.TOrganMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.TOrgan"> <id column="id" property="id"/> <result column="name" property="name"/> <result column="parent_id" property="parentId"/> <result column="code" property="code"/> <result column="is_deleted" property="isDeleted"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <result column="area_id" property="areaId"/> <result column="icon" property="icon"/> <result column="remarks" property="remarks"/> <result column="level" property="level"/> <result column="parent_name" property="parentName"/> <result column="area_name" property="areaName"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, name, parent_id, is_deleted, create_time, update_time, area_id, icon, remarks, level </sql> <select id="selectArea" resultType="java.util.HashMap"> select full_name name,id from t_area </select> <select id="getById" resultMap="BaseResultMap"> select o.* ,r.`name` parent_name,a.full_name area_name from t_organ o left join t_organ r on o.parent_id = r.id left join t_area a on o.area_id = a.id where o.id = #{id} </select> <select id="getAllList" resultMap="BaseResultMap"> select o.* ,r.`name` parent_name,a.full_name area_name from t_organ o left join t_organ r on o.parent_id = r.id left join t_area a on o.area_id = a.id where 1=1 <if test=" org.code != null and org.code != '' "> and o.code LIKE concat(#{org.code},'%') </if> and o.is_deleted = false order by o.create_time desc </select> <select id="selectCodeMax" resultMap="BaseResultMap"> select * from t_organ where parent_id = #{parentId} order by code desc limit 1 </select> </mapper>