123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?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.hssx.cloudmodel.mapper.UserMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.User">
- <id column="id" property="id" />
- <result column="account" property="account" />
- <result column="username" property="username" />
- <result column="password" property="password" />
- <result column="mobile" property="mobile" />
- <result column="role_type" property="roleType" />
- <result column="company_id" property="companyId" />
- <result column="parent_id" property="parentId" />
- <result column="sex" property="sex" />
- <result column="role_name" property="roleName" />
- <result column="work_state" property="workState" />
- <result column="is_disable" property="isDisable" />
- <result column="indate" property="indate" />
- <result column="head_imgurl" property="headImgurl" />
- <result column="team_name" property="teamName" />
- <result column="subordinate_type" property="subordinateType" />
- <result column="openid" property="openid" />
- </resultMap>
- <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.UserVO">
- <id column="id" property="id" />
- <result column="account" property="account" />
- <result column="username" property="username" />
- <result column="password" property="password" />
- <result column="mobile" property="mobile" />
- <result column="role_type" property="roleType" />
- <result column="role_name" property="roleName" />
- <result column="company_id" property="companyId" />
- <result column="company_name" property="companyName"/>
- <result column="parent_id" property="parentId" />
- <result column="sex" property="sex" />
- <result column="work_state" property="workState" />
- <result column="is_disable" property="isDisable" />
- <result column="indate" property="indate" />
- <result column="head_imgurl" property="headImgurl" />
- <result column="team_name" property="teamName" />
- <result column="subordinate_type" property="subordinateType" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, account, username, password, mobile, role_type, company_id, parent_id, sex, role_name, work_state, is_disable, indate, head_imgurl, team_name, subordinate_type, openid
- </sql>
- <select id="selsctUsersByUids" resultMap="BaseResultMapVO">
- SELECT
- u.id id, u.username username, u.mobile mobile, u.company_id company_id, c.`company_name` company_name,
- u.parent_id parent_id, u.work_state work_state, u.is_disable is_disable,
- u.indate indate, u.head_imgurl head_imgurl, u.team_name team_name, u.subordinate_type subordinate_type
- FROM
- tb_user AS u
- LEFT JOIN tb_company c
- ON u.company_id = c.`id`
- <where>
- <foreach collection="list" separator="," close=")" item="item" open="u.id in (" index="index">
- #{item}
- </foreach>
- and u.id != #{id}
- </where>
- </select>
- <select id="selectListByCondition" resultMap="BaseResultMapVO">
- SELECT
- u.id id, u.account account, u.username username, u.password password, u.mobile mobile, u.role_type role_type, u.company_id company_id, c.`company_name` company_name,
- u.role_name role_name,u.parent_id parent_id, u.sex sex, u.work_state work_state, u.is_disable is_disable,
- u.indate indate, u.head_imgurl head_imgurl, u.team_name team_name, u.subordinate_type subordinate_type
- FROM
- tb_user AS u
- LEFT JOIN tb_company c
- ON u.company_id = c.`id`
- <where>
- u.id != #{user.id}
- <if test="user.id != 1">
- AND u.parent_id = #{user.id}
- </if>
- <if test="flag==0 and keyName != '' and keyName !=null">
- AND u.username like concat('%',#{keyName},'%')
- </if>
- <if test="flag==1 and keyName != '' and keyName !=null">
- AND u.account like concat('%',#{keyName},'%')
- </if>
- <if test="companyId != -1">
- AND u.company_id = #{companyId}
- </if>
- </where>
- Order by u.id desc
- </select>
- <select id="selectUserListByCondition" resultMap="BaseResultMapVO">
- SELECT
- u.id id, u.account account, u.username username, u.password password, u.mobile mobile, u.role_type role_type, u.company_id company_id, c.`company_name` company_name,
- u.role_name role_name,u.parent_id parent_id, u.sex sex, u.work_state work_state, u.is_disable is_disable,
- u.indate indate, u.head_imgurl head_imgurl, u.team_name team_name, u.subordinate_type subordinate_type
- FROM
- tb_user AS u
- LEFT JOIN tb_company c
- ON u.company_id = c.`id`
- <where>
- u.id in
- <foreach collection="list" index="index" open="(" item="item" close=")" separator=",">
- #{item}
- </foreach>
- and u.id != #{user.id}
- <if test="flag==0 and keyName != '' and keyName !=null">
- AND u.username like concat('%',#{keyName},'%')
- </if>
- <if test="flag==1 and keyName != '' and keyName !=null">
- AND u.account like concat('%',#{keyName},'%')
- </if>
- <if test="companyId != -1">
- AND u.company_id = #{companyId}
- </if>
- </where>
- Order by u.id desc
- </select>
- <select id="getUserByAccount" resultMap="BaseResultMapVO">
- select
- u.id id, u.account account, u.username username, u.password password, u.mobile mobile, u.role_type role_type, u.company_id company_id, c.`company_name` company_name,
- u.role_name role_name,u.parent_id parent_id, u.sex sex, u.work_state work_state, u.is_disable is_disable,
- u.indate indate, u.head_imgurl head_imgurl, u.team_name team_name, u.subordinate_type subordinate_type
- from
- tb_user AS u
- LEFT JOIN tb_company c
- ON u.company_id = c.`id`
- where
- u.account = #{userVO.account}
- </select>
- </mapper>
|