123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?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.css.simulation.resource.system.mapper.UserMapper" >
- <select id="getUserInfo" parameterType="java.lang.String" resultType="api.common.pojo.vo.system.UserVO">
- SELECT
- id,
- username,
- nickname,
- photo,
- phone,
- company,
- role_code
- FROM system_user WHERE id = #{userId,jdbcType=VARCHAR}
- </select>
- <!-- 列表查询共用字段-->
- <sql id="pageColumn">
- u.id,
- u.username,
- u.nickname,
- u.photo,
- u.phone,
- u.company,
- u.role_code,
- u.use_type,
- u.visible,
- u.create_time,
- t.username as createUserName
- </sql>
- <!-- 列表查询共用查询条件-->
- <sql id="pageWhere">
- <if test="username != null and username != ''">
- and u.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
- </if>
- <if test="nickname != null and nickname != ''">
- and u.nickname like CONCAT('%',#{nickname,jdbcType=VARCHAR},'%')
- </if>
- <if test="company != null and company != ''">
- and u.company like CONCAT('%',#{company,jdbcType=VARCHAR},'%')
- </if>
- <if test="roleCode != null and roleCode != ''">
- and u.role_code = #{roleCode,jdbcType=VARCHAR}
- </if>
- <if test="visible != null and visible != ''">
- and u.visible = #{visible,jdbcType=VARCHAR}
- </if>
- </sql>
- <select id="getUserPageLista" parameterType="api.common.pojo.param.system.UserParam" resultType="api.common.pojo.vo.system.UserVO">
- SELECT
- <include refid="pageColumn"></include>
- FROM system_user u
- JOIN system_user t ON u.create_user_id = t.id
- WHERE u.is_deleted = '0' AND u.role_code <> '0' and u.role_code <> '3'
- <include refid="pageWhere"></include>
- ORDER BY u.modify_time DESC
- </select>
- <select id="getUserPageListb" parameterType="api.common.pojo.param.system.UserParam" resultType="api.common.pojo.vo.system.UserVO">
- SELECT
- <include refid="pageColumn"></include>
- FROM system_user u
- JOIN system_user t ON u.create_user_id = t.id
- WHERE u.is_deleted = '0' AND u.role_code = '2'
- <include refid="pageWhere"></include>
- ORDER BY u.modify_time DESC
- </select>
- <select id="getUserPageListc" parameterType="api.common.pojo.param.system.UserParam" resultType="api.common.pojo.vo.system.UserVO">
- SELECT
- <include refid="pageColumn"></include>
- FROM system_user u
- JOIN system_user t ON u.create_user_id = t.id
- WHERE u.is_deleted = '0' AND u.role_code = '3'
- <include refid="pageWhere"></include>
- and u.create_user_id = #{createUserId,jdbcType=VARCHAR}
- ORDER BY u.modify_time DESC
- </select>
- <select id="selectCount" resultType="java.lang.Integer">
- select count(*)
- from system_user
- </select>
- <select id="checkUsername" parameterType="api.common.pojo.po.system.UserPO" resultType="api.common.pojo.po.system.UserPO">
- select
- id
- from system_user
- where is_deleted = '0'
- and username = #{username,jdbcType=VARCHAR}
- <if test="id != null and id != ''">
- and id <> #{id,jdbcType=VARCHAR}
- </if>
- </select>
- <insert id="insert" parameterType="api.common.pojo.po.system.UserPO">
- INSERT INTO system_user(
- id,
- username,
- password,
- nickname,
- photo,
- phone,
- company,
- role_code,
- use_type,
- visible,
- create_time,
- modify_time,
- create_user_id,
- modify_user_id,
- is_deleted
- )
- VALUES(
- #{id,jdbcType=VARCHAR},
- #{username,jdbcType=VARCHAR},
- #{password,jdbcType=VARCHAR},
- #{nickname,jdbcType=VARCHAR},
- #{photo,jdbcType=VARCHAR},
- #{phone,jdbcType=VARCHAR},
- #{company,jdbcType=VARCHAR},
- #{roleCode,jdbcType=VARCHAR},
- #{useType,jdbcType=VARCHAR},
- #{visible,jdbcType=VARCHAR},
- #{createTime,jdbcType=TIMESTAMP},
- #{modifyTime,jdbcType=TIMESTAMP},
- #{createUserId,jdbcType=VARCHAR},
- #{modifyUserId,jdbcType=VARCHAR},
- #{isDeleted,jdbcType=VARCHAR}
- )
- </insert>
- <update id="update" parameterType="api.common.pojo.po.system.UserPO">
- update system_user set
- username = #{username,jdbcType=VARCHAR},
- nickname = #{nickname,jdbcType=VARCHAR},
- <!--photo = #{photo,jdbcType=VARCHAR},-->
- phone = #{phone,jdbcType=VARCHAR},
- company = #{company,jdbcType=VARCHAR},
- <!--visible = #{visible,jdbcType=VARCHAR},-->
- modify_time = #{modifyTime,jdbcType=TIMESTAMP},
- modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="saveDefaultPassword" parameterType="api.common.pojo.po.system.UserPO">
- update system_user set
- password = #{password,jdbcType=VARCHAR},
- modify_time = #{modifyTime,jdbcType=TIMESTAMP},
- modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="saveVisible" parameterType="api.common.pojo.po.system.UserPO">
- update system_user set
- visible = #{visible,jdbcType=VARCHAR},
- modify_time = #{modifyTime,jdbcType=TIMESTAMP},
- modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- </mapper>
|