<?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.yifu.cloud.plus.v1.business.mapper.system.TBusDeptMapper"> <resultMap id="tBusDeptMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusDept"> <id property="id" column="id"/> <result property="name" column="name"/> <result property="level" column="level"/> <result property="pid" column="pid"/> <result property="createUserId" column="create_user_id"/> <result property="createUserName" column="create_user_name"/> <result property="createTime" column="create_time"/> <result property="treeLogo" column="tree_logo"/> <result property="deleteFlag" column="delete_flag"/> </resultMap> <sql id="Base_Column_List"> a.id, a.name, a.level, a.pid, a.create_user_id, a.create_user_name, a.create_time, a.tree_logo, a.delete_flag </sql> <sql id="tBusDept_where"> <if test="tBusDept != null"> <if test="tBusDept.id != null"> AND a.id = #{tBusDept.id} </if> <if test="tBusDept.name != null and tBusDept.name.trim() != ''"> AND a.name like concat('%', #{tBusDept.name},'%') </if> <if test="tBusDept.level != null"> AND a.level = #{tBusDept.level} </if> <if test="tBusDept.pid != null"> AND a.pid = #{tBusDept.pid} </if> <if test="tBusDept.createUserId != null and tBusDept.createUserId.trim() != ''"> AND a.create_user_id = #{tBusDept.createUserId} </if> <if test="tBusDept.createUserName != null and tBusDept.createUserName.trim() != ''"> AND a.create_user_name = #{tBusDept.createUserName} </if> <if test="tBusDept.createTime != null"> AND a.create_time = #{tBusDept.createTime} </if> <if test="tBusDept.treeLogo != null and tBusDept.treeLogo.trim() != ''"> AND a.tree_logo like concat(#{tBusDept.treeLogo},'%') </if> </if> </sql> <!--tBusDept简单分页查询--> <select id="getTBusDeptPage" resultMap="tBusDeptMap"> SELECT <include refid="Base_Column_List"/> FROM t_bus_dept a <where> a.delete_flag = 0 and a.level != '-1' <include refid="tBusDept_where"/> </where> ORDER BY a.level,a.create_time asc </select> <!--list--> <select id="getTBusDeptList" resultMap="tBusDeptMap"> SELECT <include refid="Base_Column_List"/> FROM t_bus_dept a <where> a.delete_flag = 0 <if test="tBusDept == null or tBusDept.level == null"> and a.level != '-1' </if> <include refid="tBusDept_where"/> </where> ORDER BY a.level,a.create_time asc </select> <!--list--> <select id="getTBusDeptListAsso" resultMap="tBusDeptMap"> SELECT <include refid="Base_Column_List"/> FROM t_bus_dept a <where> <include refid="tBusDept_where"/> </where> ORDER BY a.level,a.create_time asc </select> <!--list--> <select id="getTBusDeptSubList" resultMap="tBusDeptMap"> SELECT <include refid="Base_Column_List"/> FROM t_bus_dept a where a.delete_flag = 0 and a.id != #{id} AND a.tree_logo like concat(#{treeLogo},'%') </select> <!--判重--> <select id="getDeptByName" resultMap="tBusDeptMap"> SELECT <include refid="Base_Column_List"/> FROM t_bus_dept a where a.delete_flag = 0 <if test="id != null"> and a.id != #{id} </if> AND a.name = #{name} </select> <!-- 批量更新子集的treeLogo --> <update id="updateAllTreeLogo"> update t_bus_dept a set a.tree_logo = concat(#{newLogo},SUBSTRING(a.tree_logo,length(#{oldLogo}) + 1)) where a.tree_logo like concat(#{oldLogo},'%') </update> </mapper>