<!--
// 查询报销次数 - state=3 成功的
// 宠物数量 - nickname 不为空的,不包括临时宠物
// 缴费次数 - wallet_type 流水表,支出的
-->
<select id="findPage" resultType="com.ws.ldy.modules.pets.model.vo.PetsUserVO">
select
u.*
,(SELECT count( t1.id) FROM t_pets_declare t1 WHERE t1.user_id = u.id and t1.state = 3 ) as declareNum
,(SELECT count( t1.id) FROM t_pets_pet_info t1 WHERE t1.user_id = u.id and t1.nickname != '' ) as petsNum
,(SELECT count( t1.id) FROM t_pets_wallet_flow t1 WHERE t1.user_id = u.id and t1.wallet_type = 2) as payNum
from t_pets_user u
where 1=1
<if test="fullName !=null and fullName != ''">
and u.full_name like concat('%',#{
fullName},'%')
</if>
<if test="phone !=null and phone != ''">
and u.phone like concat('%',#{
phone},'%')
</if>
<if test="disable !=null and disable != ''">
and u.disable = #{
disable}
</if>
</select>
-
个人开源项目(通用后台管理系统)–> https://gitee.com/wslxm/spring-boot-plus2 , 喜欢的可以看看
-
本文到此结束,如果觉得有用,动动小手点赞或关注一下呗,将不定时持续更新更多的内容…,感谢大家的观看!