" where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)"+
" and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)"+
" and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)"+
" and IF(:#{#req.orgTreeValue} is not null, (tt.cluster_id=:#{#req.orgTreeValue} or tt.branch_id=:#{#req.orgTreeValue} or tt.group_id=:#{#req.orgTreeValue}), 1=1)"+
" and IF(:#{#req.clusterId} is not null, tt.cluster_id=:#{#req.clusterId}, 1=1)"+
" and IF(:#{#req.branchId} is not null, tt.branch_id=:#{#req.branchId}, 1=1)"+
" and IF(:#{#req.groupId} is not null, tt.group_id=:#{#req.groupId}, 1=1)"+
"group by tt.cluster_id,tt.branch_id,tt.group_id"+
" where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)"+
" and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)"+
" and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)"+
" and IF(:#{#req.orgTreeValue} is not null, (tt.cluster_id=:#{#req.orgTreeValue} or tt.branch_id=:#{#req.orgTreeValue} or tt.group_id=:#{#req.orgTreeValue}), 1=1)"+
" and IF(:#{#req.clusterId} is not null, tt.cluster_id=:#{#req.clusterId}, 1=1)"+
" and IF(:#{#req.branchId} is not null, tt.branch_id=:#{#req.branchId}, 1=1)"+
" and IF(:#{#req.groupId} is not null, tt.group_id=:#{#req.groupId}, 1=1)"+
"group by tt.cluster_id,tt.branch_id,tt.group_id"+
" join sys_role r on r.id=ur.role_id and r.name='分站派工'"+
" and IF(:groupId is not null, uo.org_id=:groupId and uo.org_level=2, 1=1)"+
" and IF(:groupId is null and :branchId is not null, uo.org_id=:branchId and uo.org_level=1, 1=1)"+
" and IF(:groupId is not null, ((uo.org_id=:groupId and uo.org_level=2) or (uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)"+
" and IF(:groupId is null and :branchId is not null, ((uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)"+
" and IF(:groupId is null and :branchId is null and :clusterId is not null, uo.org_id=:clusterId and uo.org_level=0, 1=1)"
@Query("SELECT o.orderId, s.skillCategory as skillCaption FROM OrderInfoEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId and o.dt = :dt")