Files
xq-server/ruoyi-xq/src/main/resources/mapper/xq/UserMapper.xml
张良(004796) fbec1e6a56 init
2024-03-29 14:45:29 +08:00

102 lines
4.6 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="com.ruoyi.xq.mapper.UserMapper">
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.user.UserAdminVo">
select t1.*, t2.id as invite_id, t2.nickname as invite_nickname, t2.usercode as invite_usercode
from xq_user t1
left join xq_user t2 on t1.invite_id = t2.id
<where>
<if test="bo.usercode != null and bo.usercode != ''">
and t1.usercode = #{bo.usercode}
</if>
<if test="bo.nickname != null and bo.nickname != ''">
and t1.nickname like concat('%',#{bo.nickname},'%')
</if>
<if test="bo.mobile != null and bo.mobile != ''">
and t1.mobile = #{bo.mobile}
</if>
</where>
order by t1.id desc
</select>
<select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool,t4.show_avatar
from xq_user t1
join xq_user_auth t2 on t1.id = t2.user_id
join xq_user_info t3 on t1.id = t3.user_id
join xq_user_status t4 on t1.id = t4.user_id
where t1.type = 0 and t1.status = 0 and t1.finish_base_status = 1 and t4.personals_status = 1
<if test="params.birthdayBegin != null">
and t1.birthday >= #{params.birthdayBegin}
</if>
<if test="params.birthdayEnd != null">
and t1.birthday &lt;= #{params.birthdayEnd}
</if>
<if test="params.heightBegin != null">
and t1.height >= #{params.heightBegin}
</if>
<if test="params.heightEnd != null">
and t1.height &lt;= #{params.heightEnd}
</if>
<if test="params.weightBegin != null">
and t1.weight >= #{params.weightBegin}
</if>
<if test="params.weightEnd != null">
and t1.weight &lt;= #{params.weightEnd}
</if>
<if test="params.gender != null">
and t1.gender = #{params.gender}
</if>
<if test="params.marriage != null">
and t1.marriage = #{params.marriage}
</if>
<if test="params.education != null">
and t1.education = #{params.education}
</if>
<if test="params.residenceCode != null and params.residenceCode != ''">
and t1.residence_code like concat(#{params.residenceCode},'%')
</if>
<if test="params.vipQuery != null">
<if test="params.vipQuery.profession != null and params.vipQuery.profession != ''">
and t1.profession = #{params.vipQuery.profession}
</if>
<if test="params.vipQuery.annualIncome != null">
and t1.annual_income = #{params.vipQuery.annualIncome}
</if>
<if test="params.vipQuery.zodiac != null">
and t1.zodiac = #{params.vipQuery.zodiac}
</if>
<if test="params.vipQuery.sign != null">
and t1.sign = #{params.vipQuery.sign}
</if>
<if test="params.vipQuery.childStatus != null">
and t3.child_status = #{params.vipQuery.childStatus}
</if>
<if test="params.vipQuery.housingStatus != null">
and t3.housing_status = #{params.vipQuery.housingStatus}
</if>
<if test="params.vipQuery.carStatus != null">
and t3.car_status = #{params.vipQuery.carStatus}
</if>
<if test="params.vipQuery.addressCode != null">
and t1.address_code like concat(#{params.vipQuery.addressCode},'%')
</if>
</if>
</select>
<select id="vipHomePage" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool
from xq_user t1
join xq_user_auth t2 on t1.id = t2.user_id
where t1.type = 0 and t1.status = 0 and t1.finish_base_status = 1
and exists(select 1 from xq_user_vip p1 where p1.user_id = t1.id and p1.vip_status = 1 and p1.vip_timeout &lt;= now())
</select>
<select id="getMinUserById" resultType="com.ruoyi.xq.dto.common.user.MinUser">
select t1.id,t1.usercode
from xq_user t1
where t1.id = #{userId}
</select>
</mapper>