Commit ad6a3aeb by kangxiaoshan

日期筛选

parent 46d3232d
......@@ -98,21 +98,21 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select contract_code,my_body_code,sale,platform from contract where contract_code in ?1",nativeQuery = true)
List<Object[]> findByContractCode(List<String> codesList);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3",nativeQuery = true)
List<Contract> findShareContranctByDate(String startDate, String endDate, String platform);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?4 and platform=?3",nativeQuery = true)
List<Contract> findShareContranctByDate3(String startDate, String endDate, String platform,String endCreate);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3 and my_body_code = ?4",nativeQuery = true)
List<Contract> findShareContranctByDate(String startDate, String endDate, String platform, String bodyCode);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?5 and platform=?3 and my_body_code = ?4",nativeQuery = true)
List<Contract> findShareContranctByDate2(String startDate, String endDate, String platform, String bodyCode,String endCreate);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?4%)",nativeQuery = true)
List<Contract> findShareContranctByDateSerche(String startDate, String endDate, String platform, String serchName);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?5 and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?4%)",nativeQuery = true)
List<Contract> findShareContranctByDateSerche(String startDate, String endDate, String platform, String serchName,String endCreate);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3 and my_body_code = ?4 and (my_body_name like %?5% or customer_body like %?5% or contract_code like %?5%)",nativeQuery = true)
List<Contract> findShareContranctByDate(String startDate, String endDate, String platform, String bodyCode, String serchName);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?6 and platform=?3 and my_body_code = ?4 and (my_body_name like %?5% or customer_body like %?5% or contract_code like %?5%)",nativeQuery = true)
List<Contract> findShareContranctByDate1(String startDate, String endDate, String platform, String bodyCode, String serchName,String endCreate);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?5%) and my_body_code in ?5",nativeQuery = true)
List<Contract> findShareContranctByDateSercheFinace(String startDate, String endDate, String platform, String serchName, List<String> financeBodies);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?6 and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?5%) and my_body_code in ?5",nativeQuery = true)
List<Contract> findShareContranctByDateSercheFinace(String startDate, String endDate, String platform, String serchName, List<String> financeBodies,String endCreate);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?2 and platform=?3 and my_body_code in ?4",nativeQuery = true)
List<Contract> findShareContranctByDateFinace(String startDate, String endDate, String platform, List<String> financeBodies);
@Query(value="select * from contract where start_date >= ?1 and start_date <=?2 and end_date >= ?1 and create_time <= ?5 and platform=?3 and my_body_code in ?4",nativeQuery = true)
List<Contract> findShareContranctByDateFinace(String startDate, String endDate, String platform, List<String> financeBodies,String endCreate);
}
......@@ -2379,13 +2379,15 @@ public class ContractServiceImpl implements ContractService {
financeBodies = JSONArray.fromObject(auth.getAuthExtend());
}
String endCreate = new DateTime(endDate).plusDays(1).toString("yyyy-MM-dd");
if (!StringUtils.isEmpty(bodyCode) && !StringUtils.isEmpty(serchName)) {
if (financeBodies != null && !financeBodies.contains(bodyCode)) {
//沒有权限查看
return contracts;
} else {
contracts = contractRepository.findShareContranctByDate(startDate, endDate, platform, bodyCode, serchName);
contracts = contractRepository.findShareContranctByDate1(startDate, endDate, platform, bodyCode, serchName,endCreate);
}
} else if (!StringUtils.isEmpty(bodyCode)) {
......@@ -2393,19 +2395,19 @@ public class ContractServiceImpl implements ContractService {
//沒有权限查看
return contracts;
} else {
contracts = contractRepository.findShareContranctByDate(startDate, endDate, platform, bodyCode);
contracts = contractRepository.findShareContranctByDate2(startDate, endDate, platform, bodyCode,endCreate);
}
} else if (!StringUtils.isEmpty(serchName)) {
if (financeBodies != null) {
contracts = contractRepository.findShareContranctByDateSercheFinace(startDate, endDate, platform, serchName, financeBodies);
contracts = contractRepository.findShareContranctByDateSercheFinace(startDate, endDate, platform, serchName, financeBodies,endCreate);
} else {
contracts = contractRepository.findShareContranctByDateSerche(startDate, endDate, platform, serchName);
contracts = contractRepository.findShareContranctByDateSerche(startDate, endDate, platform, serchName,endCreate);
}
} else {
if (financeBodies != null) {
contracts = contractRepository.findShareContranctByDateFinace(startDate, endDate, platform, financeBodies);
contracts = contractRepository.findShareContranctByDateFinace(startDate, endDate, platform, financeBodies,endCreate);
} else {
contracts = contractRepository.findShareContranctByDate(startDate, endDate, platform);
contracts = contractRepository.findShareContranctByDate3(startDate, endDate, platform,endCreate);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment