| | |
| | | |
| | | <!--根据条件查询用户列表--> |
| | | <select id="getUserList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | SELECT * FROM (SELECT ci.`name` as companyName,IFNULL(ot.num,0) as historyNum,IFNULL(td.num,0) as consumptionNum,ui.* from t_user as ui |
| | | SELECT * FROM |
| | | ( |
| | | SELECT ci.`name` as companyName, |
| | | IFNULL(ot.num,0) + IFNULL(ol.num,0) as historyNum, |
| | | IFNULL(td.num,0) as consumptionNum, |
| | | ui.* |
| | | from t_user as ui |
| | | LEFT JOIN (select * from t_company where flag != 3) as ci on ci.id = ui.companyId |
| | | LEFT JOIN (SELECT COUNT(id) as num,userId from t_order_private_car where FIND_IN_SET(state,'8,9') GROUP BY userId) as ot on ot.userId = ui.id |
| | | LEFT JOIN (SELECT COUNT(id) as num,userId from t_order_logistics where FIND_IN_SET(state,'8,9') GROUP BY userId) as ol on ol.userId = ui.id |
| | | LEFT JOIN (SELECT sum(money) as num,userId from t_pub_transaction_details where userType = 1 and type = 1 and state = 2 GROUP BY userId) as td on td.userId = ui.id |
| | | ) as o |
| | | <where> |