| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <?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.KwsUserDao">
- <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsUser">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="system_type" jdbcType="INTEGER" property="systemType" />
- <result column="account" jdbcType="VARCHAR" property="account" />
- <result column="password" jdbcType="VARCHAR" property="password" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="telephone" jdbcType="VARCHAR" property="telephone" />
- <result column="photo" jdbcType="VARCHAR" property="photo" />
- <result column="email" jdbcType="VARCHAR" property="email" />
- <result column="client_id" jdbcType="VARCHAR" property="clientId" />
- <result column="is_main" jdbcType="INTEGER" property="isMain" />
- <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, account, password, name, telephone, photo, email, client_id, is_main,
- 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_user
- where id = #{id,jdbcType=BIGINT}
- </select>
- <insert id="insert" parameterType="com.sckw.system.model.KwsUser">
- insert into kws_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="systemType != null">
- system_type,
- </if>
- <if test="account != null">
- account,
- </if>
- <if test="password != null">
- password,
- </if>
- <if test="name != null">
- name,
- </if>
- <if test="telephone != null">
- telephone,
- </if>
- <if test="photo != null">
- photo,
- </if>
- <if test="email != null">
- email,
- </if>
- <if test="clientId != null">
- client_id,
- </if>
- <if test="isMain != null">
- is_main,
- </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="account != null">
- #{account,jdbcType=VARCHAR},
- </if>
- <if test="password != null">
- #{password,jdbcType=VARCHAR},
- </if>
- <if test="name != null">
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="telephone != null">
- #{telephone,jdbcType=VARCHAR},
- </if>
- <if test="photo != null">
- #{photo,jdbcType=VARCHAR},
- </if>
- <if test="email != null">
- #{email,jdbcType=VARCHAR},
- </if>
- <if test="clientId != null">
- #{clientId,jdbcType=VARCHAR},
- </if>
- <if test="isMain != null">
- #{isMain,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.KwsUser">
- update kws_user
- <set>
- <if test="systemType != null">
- system_type = #{systemType,jdbcType=INTEGER},
- </if>
- <if test="account != null">
- account = #{account,jdbcType=VARCHAR},
- </if>
- <if test="password != null">
- password = #{password,jdbcType=VARCHAR},
- </if>
- <if test="name != null">
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="telephone != null">
- telephone = #{telephone,jdbcType=VARCHAR},
- </if>
- <if test="photo != null">
- photo = #{photo,jdbcType=VARCHAR},
- </if>
- <if test="email != null">
- email = #{email,jdbcType=VARCHAR},
- </if>
- <if test="clientId != null">
- client_id = #{clientId,jdbcType=VARCHAR},
- </if>
- <if test="isMain != null">
- is_main = #{isMain,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="findPage" resultMap="BaseResultMap" parameterType="java.util.Map" >
- select
- <include refid="Base_Column_List" />
- from kws_user su
- where su.del_flag = 0
- <if test="systemType != null and systemType != ''">
- and su.system_type = #{system_type, jdbcType=VARCHAR}
- </if>
- <if test="account != null and account != ''">
- and su.account = #{account, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and su.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="telephone != null and telephone != ''">
- and su.telephone = #{telephone, jdbcType=VARCHAR}
- </if>
- <if test="email != null and email != ''">
- and su.email = #{email, jdbcType=VARCHAR}
- </if>
- <if test="deptId != null and deptId != ''">
- and su.id in (
- select
- sud.user_id
- from kws_user_dept sud
- left join kws_dept sd on sud.dept_id = sd.id
- where sd.del_flag = 0 and sud.del_flag = 0
- and sd.dept_id = #{deptId, jdbcType=VARCHAR}
- )
- </if>
- <if test="entId != null and entId != ''">
- and su.id in (
- select
- user_id
- from kws_user_dept
- where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
- )
- </if>
- ORDER BY su.create_time desc
- </select>
- <select id="findList" resultType="com.sckw.system.model.KwsUser" parameterType="com.sckw.system.model.KwsUser" >
- select
- su.id, su.system_type systemType, su.account, su.password, su.name,
- su.telephone, su.photo, su.email, su.is_main isMain, su.remark, su.status
- from kws_user su
- where su.del_flag = 0
- <if test="systemType != null and systemType != ''">
- and su.system_type = #{systemType, jdbcType=INTEGER}
- </if>
- <if test="account != null and account != ''">
- and su.account = #{account, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and su.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="telephone != null and telephone != ''">
- and su.telephone = #{telephone, jdbcType=VARCHAR}
- </if>
- ORDER BY su.create_time desc
- </select>
- <select id="queryUserDeptByUserId" resultType="com.sckw.system.model.KwsUserDept">
- select a.* from kws_user_depot a where a.user_id = #{userId} and a.del_flag = 0
- </select>
- <select id="queryDeptByIds" resultType="com.sckw.system.model.KwsDept">
- select a.*
- from kws_dept a
- where a.id in
- <foreach collection="list" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- </mapper>
|