| | |
| | | <select id="getDispatchList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | SELECT * FROM (SELECT c1.name as companyName,c2.name as franchiseeName,dd.* FROM t_dispatch as dd |
| | | LEFT JOIN (select * from t_company where type = 2 and flag != 3) as c1 on c1.id = dd.companyId |
| | | LEFT JOIN (select * from t_company where type = 3 and flag != 3) as c2 on c2.id = dd.franchiseeId) as o |
| | | LEFT JOIN (select * from t_company where type = 3 and flag != 3) as c2 on c2.id = dd.companyId) as o |
| | | <where> |
| | | o.state != 3 |
| | | <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> |
| | |
| | | and o.state = #{state} |
| | | </if> |
| | | <if test="roleType != null and roleType != '' and roleType == 2"> |
| | | and (o.companyId = #{nowUserId} or FIND_IN_SET(o.franchiseeId,(SELECT GROUP_CONCAT(id) as ids FROM t_company where superiorId = #{nowUserId} GROUP BY superiorId))) |
| | | and (o.companyId = #{nowUserId} or FIND_IN_SET(o.companyId,(SELECT GROUP_CONCAT(id) as ids FROM t_company where superiorId = #{nowUserId} GROUP BY superiorId))) |
| | | </if> |
| | | <if test="roleType != null and roleType != '' and roleType == 3"> |
| | | and o.franchiseeId = #{nowUserId} |
| | | and o.companyId = #{nowUserId} |
| | | </if> |
| | | </where> |
| | | order by o.id desc |