打卡接口sql优化

This commit is contained in:
xiezhijun
2021-03-24 18:36:31 +08:00
parent 6213754ca0
commit 63ab5bdc85
2 changed files with 19 additions and 5 deletions

View File

@ -38,10 +38,8 @@
<select id="selectSysWxUserInfoListNot" parameterType="SysWxUserInfo" resultMap="SysWxUserInfoResult">
select distinct wxuser.openid, wxuser.nick_name, wxuser.appid, wxuser.phone, wxuser.avatar_url, wxuser.sex, wxuser.update_time from sys_wx_user_info wxuser
where (SELECT COUNT(wxlog.id) FROM sys_wx_user_log wxlog WHERE wxlog.openid = wxuser.openid) > 0
<where>
<if test="appid != null and appid != ''">and wxuser.appid = #{appid}</if>
<if test="openid != null and openid != ''">and wxuser.openid != #{openid}</if>
</where>
<if test="appid != null and appid != ''">and wxuser.appid = #{appid}</if>
<if test="openid != null and openid != ''">and wxuser.openid <![CDATA[ <> ]]> #{openid} </if>
order by wxuser.update_time desc
</select>