| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <?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.sckw.system.dao.KwsDeptDao">
- <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsDept">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="system_type" jdbcType="INTEGER" property="systemType" />
- <result column="ent_id" jdbcType="BIGINT" property="entId" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="company" jdbcType="INTEGER" property="company" />
- <result column="parent_id" jdbcType="BIGINT" property="parentId" />
- <result column="parent_ids" jdbcType="VARCHAR" property="parentIds" />
- <result column="level" jdbcType="INTEGER" property="level" />
- <result column="sort" jdbcType="INTEGER" property="sort" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="create_by" jdbcType="BIGINT" property="createBy" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_by" jdbcType="BIGINT" property="updateBy" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
- </resultMap>
- <sql id="Base_Column_List">
- id, system_type, ent_id, name, company, parent_id, parent_ids, level, sort, remark,
- status, create_by, create_time, update_by, update_time, del_flag
- </sql>
- <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from kws_dept
- where id = #{id,jdbcType=BIGINT}
- </select>
- <insert id="insert" parameterType="com.sckw.system.model.KwsDept">
- insert into kws_dept
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="systemType != null">
- system_type,
- </if>
- <if test="entId != null">
- ent_id,
- </if>
- <if test="name != null">
- name,
- </if>
- <if test="company != null">
- company,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="parentIds != null">
- parent_ids,
- </if>
- <if test="level != null">
- level,
- </if>
- <if test="sort != null">
- sort,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="createBy != null">
- create_by,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="delFlag != null">
- del_flag,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=BIGINT},
- </if>
- <if test="systemType != null">
- #{systemType,jdbcType=INTEGER},
- </if>
- <if test="entId != null">
- #{entId,jdbcType=BIGINT},
- </if>
- <if test="name != null">
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="company != null">
- #{company,jdbcType=INTEGER},
- </if>
- <if test="parentId != null">
- #{parentId,jdbcType=BIGINT},
- </if>
- <if test="parentIds != null">
- #{parentIds,jdbcType=VARCHAR},
- </if>
- <if test="level != null">
- #{level,jdbcType=INTEGER},
- </if>
- <if test="sort != null">
- #{sort,jdbcType=INTEGER},
- </if>
- <if test="remark != null">
- #{remark,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=INTEGER},
- </if>
- <if test="createBy != null">
- #{createBy,jdbcType=BIGINT},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateBy != null">
- #{updateBy,jdbcType=BIGINT},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="delFlag != null">
- #{delFlag,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="update" parameterType="com.sckw.system.model.KwsDept">
- update kws_dept
- <set>
- <if test="systemType != null">
- system_type = #{systemType,jdbcType=INTEGER},
- </if>
- <if test="entId != null">
- ent_id = #{entId,jdbcType=BIGINT},
- </if>
- <if test="name != null">
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="company != null">
- company = #{company,jdbcType=INTEGER},
- </if>
- <if test="parentId != null">
- parent_id = #{parentId,jdbcType=BIGINT},
- </if>
- <if test="parentIds != null">
- parent_ids = #{parentIds,jdbcType=VARCHAR},
- </if>
- <if test="level != null">
- level = #{level,jdbcType=INTEGER},
- </if>
- <if test="sort != null">
- sort = #{sort,jdbcType=INTEGER},
- </if>
- <if test="remark != null">
- remark = #{remark,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=INTEGER},
- </if>
- <if test="createBy != null">
- create_by = #{createBy,jdbcType=BIGINT},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateBy != null">
- update_by = #{updateBy,jdbcType=BIGINT},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="delFlag != null">
- del_flag = #{delFlag,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=BIGINT}
- </update>
- <select id="findList" resultType="com.sckw.system.model.vo.res.KwsDeptResVo" parameterType="com.sckw.system.model.KwsDept" >
- select
- id, system_type systemType, ent_id entId, name, company, parent_id parentId, level, sort, remark,
- status, create_by createBy, create_time createTime, update_by updateBy, update_time updateTime
- from kws_dept sd
- where sd.del_flag = 0
- <if test="systemType != null and systemType != ''">
- and sd.system_type = #{systemType, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and sd.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="entId != null and entId != ''">
- and sd.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="parentIds != null and parentIds != ''">
- and FIND_IN_SET(#{parentIds, jdbcType=VARCHAR}, parent_ids)
- </if>
- <if test="company != null">
- and sd.company = #{company}
- </if>
- ORDER BY level, sort
- </select>
- <select id="selectByKeys" resultType="com.sckw.system.model.KwsDept">
- select
- <include refid="Base_Column_List" />
- from kws_dept
- where del_flag = 0
- and id in
- <foreach collection="list" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="selectByEntIdList" resultType="com.sckw.system.model.KwsDept">
- select
- <include refid="Base_Column_List" />
- from kws_dept
- where del_flag = 0
- and ent_id in
- <foreach collection="list" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="findDeptUserByDeptIds" resultType="com.sckw.system.model.pojo.FindDeptUserPojo">
- select distinct b.id deptId,
- b.name deptName,
- d.id userId,
- d.name,
- d.account,
- d.phone
- from kws_dept b
- left join kws_user_dept c on b.id = c.dept_id
- left join kws_user d on c.user_id = d.id
- where b.del_flag = 0
- and c.del_flag = 0
- and d.del_flag = 0
- and b.id in
- <foreach collection="list" separator="," open="(" close=")" item="item">
- #{item}
- </foreach>
- </select>
- </mapper>
|