charging_pile/common/target/classes/mapper/UserMapper.xml

110 lines
3.6 KiB
XML
Raw Normal View History

<?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.hcy.common.mapper.user.UserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hcy.common.entity.user.User">
</resultMap>
<select id="pageSearchByDist" resultType="com.hcy.common.dto.result.UserResultDto">
SELECT
t.id,
t.sn,
t.avatar,
t.real_name,
t.nickname,
t.username,
t.password,
t.mobile,
t.channel,
t.salt,
t.money,
t.sex,
t.is_disable,
t.is_delete,
t.is_new,
t.last_login_ip,
t.last_login_time,
t.create_time,
t.update_time,
t.delete_time,
t.distributor_id,
t.bind_time,
t1.dist_num AS distNum,
t1.group_id AS groupId,
t1.name AS distName
FROM la_user t
LEFT JOIN la_distributor t1
ON (t1.id = t.distributor_id AND t1.is_delete = 0)
<where>
t.is_delete = 0
<if test="form.likeWork != null">
AND (t.username LIKE '%${form.likeWork}%'
OR t.nickname LIKE '%${form.likeWork}%'
OR t.mobile LIKE '%${form.likeWork}%')
</if>
<if test="form.channel != null">
And t.channel = #{form.channel}
</if>
<choose>
<when test="form.flag != null">
AND t.distributor_id != 0
<if test="form.startTime != null and form.endTime != null">
AND (t.bind_time &gt;= #{form.startTime} AND t.bind_time &lt;= #{form.endTime})
</if>
</when>
<otherwise>
<if test="form.startTime != null and form.endTime != null">
AND (t.create_time &gt;= #{form.startTime} AND t.create_time &lt;= #{form.endTime})
</if>
</otherwise>
</choose>
<if test="form.type != null">
AND t.type = #{form.type}
</if>
<if test="form.distNum != null">
AND (t1.dist_num LIKE '%${form.distNum}%')
</if>
<if test="form.distName != null">
AND (t1.name LIKE '%${form.distName}%')
</if>
<if test="form.groupId != null">
And t1.group_id = #{form.groupId}
</if>
</where>
order by t.id desc
</select>
<select id="getNotBindingStaffUser" resultType="com.hcy.common.entity.user.User">
SELECT
us.*
FROM
la_user AS us
LEFT JOIN la_staff AS s ON s.user_id = us.id
AND s.is_delete = 0
<where>
us.is_delete = 0
AND s.id IS NULL
AND us.type = 1
<if test="keyword != null and keyword != ''">
AND ((us.sn LIKE '%${keyword}%') OR (us.mobile LIKE '%${keyword}%') OR (us.nickname LIKE '%${keyword}%'))
</if>
</where>
</select>
<select id="reconditionList" resultType="com.hcy.common.dto.result.UserLargeDataDto">
SELECT
u.*
FROM
la_user AS u
JOIN la_system_auth_admin AS aa ON aa.user_id = u.id
JOIN la_system_auth_role AS ar ON aa.role = ar.id
WHERE
aa.is_delete = 0
AND u.is_delete = 0
AND aa.role = 6
and u.longitude is not null
and u.latitude is not null
</select>
</mapper>