|
@@ -748,7 +748,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
public Page<Map<String, Object>> findMerchantSignOrderByPage(Map<String, Object> params, Pageable initPage) {
|
|
|
StringBuilder selSql = new StringBuilder();
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
- selSql.append(" SELECT t.*,(t.unit_price * t.num) as price,m.unit_name from fx_merchant_sign_order t ");
|
|
|
+ selSql.append(" SELECT t.*,(t.unit_price * t.num) as price,m.unit_name,m.type as merchant_type from fx_merchant_sign_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" where 1=1 ");
|
|
|
if(!"".equals(params.get("merchantId"))){
|
|
@@ -759,6 +759,10 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" and t.type=? ");
|
|
|
queryParams.add(params.get("type"));
|
|
|
}
|
|
|
+ if(!"".equals(params.get("merchantType"))){
|
|
|
+ selSql.append(" and m.type=? ");
|
|
|
+ queryParams.add(params.get("merchantType"));
|
|
|
+ }
|
|
|
if(!"".equals(params.get("endSignTime"))){
|
|
|
selSql.append(" and TO_DAYS(t.create_time)<=TO_DAYS(?) ");
|
|
|
queryParams.add(params.get("endSignTime"));
|
|
@@ -778,13 +782,17 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
public Page<Map<String, Object>> findMerchantMealOrderPage(Map<String, Object> params, Pageable initPage) {
|
|
|
StringBuilder selSql = new StringBuilder();
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
- selSql.append(" SELECT t.*,m.unit_name from fx_merchant_meal_order t ");
|
|
|
+ selSql.append(" SELECT t.*,m.unit_name,m.type as merchant_type from fx_merchant_meal_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" where 1=1 ");
|
|
|
if(!"".equals(params.get("merchantId"))){
|
|
|
selSql.append(" and t.merchant_id=? ");
|
|
|
queryParams.add(params.get("merchantId"));
|
|
|
}
|
|
|
+ if(!"".equals(params.get("merchantType"))){
|
|
|
+ selSql.append(" and m.type=? ");
|
|
|
+ queryParams.add(params.get("merchantType"));
|
|
|
+ }
|
|
|
if(!"".equals(params.get("signType"))){
|
|
|
selSql.append(" and t.sign_type=? ");
|
|
|
queryParams.add(params.get("signType"));
|
|
@@ -810,7 +818,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" SELECT t.*,m.unit_name,o.unit_price from fx_merchant_meal t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_meal_order o on t.order_id=o.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
- selSql.append(" where t.status=1 ");
|
|
|
+ selSql.append(" where t.status=1 and t.type>1 ");
|
|
|
if(!"".equals(params.get("type"))){
|
|
|
selSql.append(" and t.type=? ");
|
|
|
queryParams.add(params.get("type"));
|
|
@@ -866,18 +874,21 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
public Page<Map<String, Object>> findMerchantPlatOrderByPage(Map<String, Object> params, Pageable initPage) {
|
|
|
StringBuilder selSql = new StringBuilder();
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
- selSql.append(" SELECT t.*,m.unit_name from fx_merchant_plat_order t ");
|
|
|
+ selSql.append(" SELECT t.*,m.unit_name,m.type as merchant_type from fx_merchant_plat_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" where 1=1 ");
|
|
|
if(!"".equals(params.get("merchantId"))){
|
|
|
selSql.append(" and t.merchant_id=? ");
|
|
|
queryParams.add(params.get("merchantId"));
|
|
|
}
|
|
|
+ if(!"".equals(params.get("merchantType"))){
|
|
|
+ selSql.append(" and m.type=? ");
|
|
|
+ queryParams.add(params.get("merchantType"));
|
|
|
+ }
|
|
|
if(!"".equals(params.get("endSignTime"))){
|
|
|
selSql.append(" and TO_DAYS(t.create_time)<=TO_DAYS(?) ");
|
|
|
queryParams.add(params.get("endSignTime"));
|
|
|
}
|
|
|
-
|
|
|
if(!"".equals(params.get("signTime"))){
|
|
|
selSql.append(" and TO_DAYS(t.create_time)>=TO_DAYS(?) ");
|
|
|
queryParams.add(params.get("signTime"));
|
|
@@ -893,20 +904,20 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" SELECT * from ( ");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,t.unit_price,t.price,t.buy_month,t.give_month,t.sign_type,t.type,t.lib_service,t.create_time as time,1 as cap_type from fx_merchant_meal_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,o.unit_price,o.price,o.buy_month,o.give_month,o.sign_type,o.type,t.lib_service,t.sign_time as time,2 as cap_type from fx_merchant_meal t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_meal_order o ON t.order_id=o.id where t.status=1 and t.type>1 ");//激活期的流水,不统计到资金流水表
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,0 as price,t.price,0 as buy_month,0 as give_month,0 as sign_type,0 as type,0 as lib_service,t.create_time as time,3 as cap_type from fx_merchant_plat_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,0 as price,t.price,0 as buy_month,0 as give_month,0 as sign_type,0 as type,0 as lib_service,t.create_time as time,4 as cap_type from fx_merchant_plat_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,t.unit_price,0 as price,t.num as buy_month,0 as give_month,0 as sign_type,t.type,t.lib_service,t.create_time as time,5 as cap_type from fx_merchant_sign_order t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,o.unit_price,0 as price,o.num as buy_month,0 as give_month,0 as sign_type,o.type,t.lib_service,t.sign_time as time,6 as cap_type from fx_merchant_sign t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_sign_order o ON t.order_id=o.id ");
|
|
@@ -928,7 +939,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" and TO_DAYS(tmp.time)>=TO_DAYS(?) ");
|
|
|
queryParams.add(params.get("signTime"));
|
|
|
}
|
|
|
- selSql.append(" ORDER BY tmp.time DESC ");
|
|
|
+ selSql.append(" ORDER BY tmp.time DESC,FIELD(tmp.cap_type, 6, 5, 4, 3, 2, 1) ");
|
|
|
return dao.findPage(selSql.toString(),queryParams.toArray(), initPage);
|
|
|
}
|
|
|
|
|
@@ -941,20 +952,20 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" SELECT t.to_merchant_id as merchant_id,m.pos_code,m.type as merchant_type,m.unit_name,t.lib_service,m.price,t.create_time,1 as cap_type from tb_lib_join_consume t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.to_merchant_id=m.id ");
|
|
|
selSql.append(" WHERE m.parent_pos_code='ssj001' AND t.type=1 ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL ");
|
|
|
selSql.append(" SELECT t.from_merchant_id as merchant_id,m.pos_code,m.type as merchant_type,m.unit_name,t.lib_service,m.price,t.create_time,2 as cap_type from tb_lib_join_consume t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id ");
|
|
|
selSql.append(" WHERE m.parent_pos_code='ssj001' AND t.type=2 ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL ");
|
|
|
selSql.append(" SELECT t.from_merchant_id as merchant_id,pm.pos_code,pm.type as merchant_type,pm.unit_name,t.lib_service,pm.price,t.create_time,3 as cap_type from tb_lib_join_consume t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant pm ON m.parent_pos_code=pm.pos_code ");
|
|
|
selSql.append(" WHERE pm.parent_pos_code='ssj001' AND t.type=2 ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL ");
|
|
|
selSql.append(" SELECT t.from_merchant_id as merchant_id,m.pos_code,m.type as merchant_type,m.unit_name,t.lib_service,m.price,t.create_time,4 as cap_type from tb_lib_join_consume t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id ");
|
|
|
selSql.append(" WHERE m.parent_pos_code='ssj001' AND t.type=3 ");
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL ");
|
|
|
selSql.append(" SELECT t.from_merchant_id as merchant_id,pm.pos_code,pm.type as merchant_type,pm.unit_name,t.lib_service,pm.price,t.create_time,5 as cap_type from tb_lib_join_consume t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant pm ON m.parent_pos_code=pm.pos_code ");
|
|
@@ -990,7 +1001,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,o.unit_price,o.price,o.buy_month,o.give_month,o.sign_type,o.type,t.lib_service,t.sign_time as time,1 as cap_type from fx_merchant_meal t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_meal_order o ON t.order_id=o.id where t.status=1 and t.type=1 ");//激活期的流水
|
|
|
- selSql.append(" UNION ");
|
|
|
+ selSql.append(" UNION ALL ");
|
|
|
selSql.append(" SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,o.unit_price,o.price,o.buy_month,o.give_month,o.sign_type,o.type,t.lib_service,t.end_sign_time as time,2 as cap_type from fx_merchant_meal t ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_meal_order o ON t.order_id=o.id where t.status=1 and t.type=1 ");//激活期的流水
|