You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
3.5 KiB
107 lines
3.5 KiB
<?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.epmet.dao.UserDao">
|
|
<!-- 根据手机号查询运营人员信息-->
|
|
<select id="selectOperUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
|
|
SELECT
|
|
ou.USER_ID AS userId,
|
|
PASSWORD AS PASSWORD
|
|
FROM
|
|
oper_user ou
|
|
WHERE
|
|
ou.DEL_FLAG = '0'
|
|
AND ou.STATUS = '1'
|
|
AND ou.PHONE = #{phone}
|
|
</select>
|
|
|
|
<!-- 查询用户注册时间 -->
|
|
<select id="createdTimeByUserId" resultType="com.epmet.dto.result.CreatedTimeByUserIdResultDTO">
|
|
SELECT
|
|
UNIX_TIMESTAMP( created_time ) AS registerTime
|
|
FROM
|
|
user
|
|
WHERE
|
|
id = #{userId}
|
|
AND del_flag = 0
|
|
</select>
|
|
|
|
<!-- 获取居民端个人信息 -->
|
|
<select id="getMyselfMsg" resultType="com.epmet.dto.result.MyselfMsgResultDTO">
|
|
SELECT
|
|
user.Id AS userId,
|
|
IFNULL(wechat.HEAD_IMG_URL,"") AS userHeadPhoto,
|
|
IFNULL(wechat.NICKNAME,"") AS nickName,
|
|
IFNULL(resi.ID,"") AS resiId,
|
|
IFNULL(CONCAT(resi.SURNAME,resi.NAME),"") AS userRealName,
|
|
IFNULL(relation.GRID_ID,"") AS gridId,
|
|
IFNULL(resi.id_num,'')AS idNum
|
|
FROM
|
|
USER user
|
|
LEFT JOIN
|
|
USER_RESI_INFO resi ON user.ID = resi.USER_ID AND resi.DEL_FLAG = '0'
|
|
LEFT JOIN
|
|
user_base_info wechat ON user.ID = wechat.USER_ID AND wechat.DEL_FLAG = '0'
|
|
LEFT JOIN
|
|
REGISTER_RELATION relation ON user.ID = relation.USER_ID
|
|
AND relation.DEL_FLAG = '0'
|
|
AND relation.FIRST_REGISTER = '1'
|
|
WHERE
|
|
user.ID = #{userId}
|
|
AND
|
|
user.DEL_FLAG = '0'
|
|
AND
|
|
user.FROM_APP = 'resi'
|
|
</select>
|
|
|
|
<select id="selectUserBasicInfo" resultType="com.epmet.dto.result.UserBasicInfo">
|
|
SELECT
|
|
u.id AS "userId",
|
|
uw.wx_open_id AS "openId"
|
|
FROM
|
|
`user` u
|
|
INNER JOIN user_wechat uw ON u.id = uw.user_id
|
|
WHERE
|
|
u.del_flag = '0'
|
|
AND uw.del_flag = '0'
|
|
AND u.from_app = 'resi'
|
|
AND u.id = #{userId}
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<!-- 根据userId查询用户所属终端,是居民端的用户还是工作人员,还是运营人员 -->
|
|
<select id="selectByUserId" parameterType="java.lang.String" resultType="com.epmet.dto.UserDTO">
|
|
SELECT
|
|
u.id,
|
|
u.CUSTOMER_ID,
|
|
u.FROM_APP,
|
|
u.FROM_CLIENT
|
|
FROM
|
|
USER u
|
|
WHERE
|
|
u.DEL_FLAG = '0'
|
|
AND u.id = #{userId}
|
|
</select>
|
|
|
|
<select id="selectIdNum" parameterType="map" resultType="java.lang.String">
|
|
SELECT
|
|
uri.ID_NUM
|
|
FROM
|
|
user_resi_info uri
|
|
WHERE
|
|
uri.DEL_FLAG = '0'
|
|
AND uri.USER_ID = #{epmetUserId}
|
|
AND uri.CUSTOMER_ID = #{customerId}
|
|
</select>
|
|
|
|
<select id="selectCommonEpmetUser" parameterType="map" resultType="java.lang.String">
|
|
SELECT DISTINCT
|
|
uri.user_id
|
|
FROM
|
|
user_resi_info uri
|
|
WHERE
|
|
uri.DEL_FLAG = '0'
|
|
AND uri.CUSTOMER_ID = #{customerId}
|
|
AND uri.ID_NUM = #{idNum}
|
|
</select>
|
|
</mapper>
|
|
|