46 lines
2.5 KiB
XML
46 lines
2.5 KiB
XML
<?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="me.zhengjie.modules.system.mapper.BusUserMapper">
|
|
<resultMap id="BaseResultMap" type="me.zhengjie.modules.system.domain.BusUser">
|
|
<id column="id" property="id"/>
|
|
<result column="real_name" property="realName"/>
|
|
<result column="nickname" property="nickname"/>
|
|
<result column="avatar" property="avatar"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="status" property="status"/>
|
|
<result column="token" property="token"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="create_by" property="createBy"/>
|
|
<result column="update_by" property="updateBy"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
</resultMap>
|
|
|
|
<select id="getUserCommands" resultType="me.zhengjie.modules.system.domain.dto.BusTreeVo">
|
|
select CONCAT('d', d.id) id, 0 pid, CONCAT('品牌:', d.brand, ' | ', '型号:', d.model) name, CONCAT(d.location, '[', IF(d.type=1, '3D打印机', '摄像头'), ']') remark from bus_user_device ud inner join bus_device d on ud.device_id = d.id where ud.user_id = #{userId}
|
|
union all
|
|
select CONCAT('c', dc.id) id, CONCAT('d', dc.device_id) pid, dc.command_name name, dc.description remark from bus_user_device_command udc inner join bus_device_command dc on udc.command_id = dc.id where udc.user_id = #{userId}
|
|
</select>
|
|
|
|
<sql id="Base_Column_List">
|
|
id, real_name, nickname, avatar, phone, status, token, sex, create_by, update_by, create_time, update_time
|
|
</sql>
|
|
|
|
<select id="findAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from bus_user
|
|
<where>
|
|
<if test="criteria.nickname != null and criteria.nickname != ''"> and nickname like concat('%', #{criteria.nickname}, '%') </if>
|
|
<if test="criteria.phone != null and criteria.phone != ''"> and phone like concat('%', #{criteria.phone}, '%') </if>
|
|
<if test="criteria.status != null"> and status = #{criteria.status} </if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="getUserByOpenId" resultType="me.zhengjie.modules.system.domain.BusUser">
|
|
select id, real_name realName, nickname, avatar, phone, status, token, sex, create_time createTime
|
|
from bus_user where token = #{openId}
|
|
</select>
|
|
|
|
</mapper> |