移风店镇项目初始化
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.
 
 
 
 
 

92 lines
2.9 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.UserWechatDao">
<!-- 根据userId更新 用户-微信关系表里的属性 -->
<update id="updateByUserId" parameterType="com.epmet.dto.UserWechatDTO">
UPDATE user_wechat
<set>
<if test='null != city and "" != city '>
CITY = #{city},
</if>
<if test='null != wxOpenId and "" != wxOpenId'>
WX_OPEN_ID = #{wxOpenId},
</if>
<if test='null != unionId and "" != unionId'>
WX_UNION_ID = #{unionId},
</if>
<if test='null != nickname and "" != nickname '>
NICKNAME = #{nickname},
</if>
<if test='null != country and "" != country '>
COUNTRY = #{country},
</if>
<if test='null != headImgUrl and "" != headImgUrl'>
HEAD_IMG_URL = #{headImgUrl},
</if>
<if test='null != province and "" != province '>
PROVINCE = #{province},
</if>
<if test='null != sex'>
SEX = #{sex},
</if>
UPDATED_BY = #{updatedBy},
UPDATED_TIME = #{updatedTime}
</set>
WHERE
USER_ID = #{userId}
</update>
<!-- 根据app、openId查询用户是否存在 -->
<select id="selectUserDTOByOpenId" parameterType="com.epmet.dto.form.WxLoginUserInfoFormDTO" resultType="com.epmet.dto.UserDTO">
SELECT
u.*
FROM
USER u
LEFT JOIN user_wechat uw ON (
u.id = uw.USER_ID
AND uw.WX_OPEN_ID = #{openId})
WHERE
u.DEL_FLAG = '0'
AND uw.DEL_FLAG = '0'
AND u.FROM_APP = #{app}
</select>
<select id="selectByUserId" parameterType="string" resultType="com.epmet.entity.UserWechatEntity">
SELECT *
FROM
USER_WECHAT
WHERE
DEL_FLAG = '0'
AND
USER_ID = #{userId}
</select>
<!-- 根据userId查询头像 -->
<select id="selectUserHeadPhotoByUserId" resultType="com.epmet.dto.UserHeadPhotoDTO">
SELECT
user_id AS userId,
IFNULL(head_img_url,'') AS userHeadPhoto
FROM
user_wechat
WHERE
user_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.userId}
</foreach>
AND del_flag = 0
</select>
<!-- 查询已经授权的微信用户信息 -->
<select id="selectAll" resultType="com.epmet.dto.UserWechatDTO">
SELECT
*
FROM
user_wechat uw
WHERE
uw.DEL_FLAG = '0'
AND uw.NICKNAME IS NOT NULL
</select>
</mapper>