123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?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.jkcredit.invoice.mapper.user.UserMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="baseResultMap" type="com.jkcredit.invoice.model.entity.user.User">
- <id column="id" property="id"/>
- <result column="user_name" property="userName"/>
- <result column="password" property="password"/>
- <result column="name" property="name"/>
- <result column="phone" property="phone"/>
- <result column="company" property="company"/>
- <result column="role_id" property="roleId"/>
- <result column="role_name" property="roleName"/>
- <result column="create_time" property="createTime"/>
- <result column="is_lock" property="isLock"/>
- <result column="company_num" property="companyNum"/>
- </resultMap>
- <sql id="userSql">
- id,
- user_name,
- `name`,
- company_num,
- phone,
- company,
- role_id,
- password,
- role_name,
- create_time,
- is_lock
- </sql>
- <select id="getUserByUserName" resultMap="baseResultMap">
- SELECT
- <include refid="userSql" />
- FROM
- t_user
- WHERE user_name = BINARY #{userName}
- </select>
- <select id="getAllUser" resultMap="baseResultMap">
- SELECT
- <include refid="userSql" />
- FROM
- t_user
- ORDER by id desc
- </select>
- <select id="getUserById" resultMap="baseResultMap">
- SELECT
- <include refid="userSql" />
- FROM
- t_user
- WHERE
- id = #{id}
- </select>
- <select id="getUsersPage" resultMap="baseResultMap">
- SELECT
- <include refid="userSql"/>
- FROM
- t_user
- <where>
- <if test="query.userName != null and query.userName != ''">
- and user_name = BINARY #{query.userName}
- </if>
- <if test="query.company != null and query.company != ''">
- and company LIKE BINARY CONCAT('%',#{query.company},'%')
- </if>
- </where>
- order by create_time desc
- </select>
- <update id="updatePassword">
- UPDATE
- t_user
- SET
- password = #{password, jdbcType=VARCHAR}
- WHERE
- id = #{id}
- </update>
- <update id="updateLock">
- UPDATE
- t_user
- SET
- is_lock = #{isLock}
- WHERE
- id = #{id}
- </update>
- <update id="updateCompanyNumById">
- UPDATE
- t_user
- SET
- company_num = #{companyNum}
- WHERE
- id = #{id}
- </update>
- <update id="updateUserInfo">
- UPDATE
- t_user
- <set>
- <if test="name != null and name != ''">
- `name` = #{name},
- </if>
- <if test="phone != null and phone != ''">
- phone = #{phone},
- </if>
- <if test="company != null and company != ''">
- company = #{company},
- </if>
- <if test="roleId != null and roleId != ''">
- role_id = #{roleId},
- </if>
- <if test="roleName != null and roleName != ''">
- role_name = #{roleName}
- </if>
- </set>
- WHERE
- id = #{id}
- </update>
- </mapper>
|