搜索符合条件的项目 排除销售合同里面已经提交的项目
parent
07fb9e07d1
commit
88e7a66106
|
@ -226,9 +226,15 @@ public class ProcessController {
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping("/projects")
|
@GetMapping("/projects")
|
||||||
public List<Map<String, Object>> query(@RequestParam String q) {
|
public List<Map<String, Object>> query(@RequestParam String q, @RequestParam ProcessType processType) {
|
||||||
return projectRepository.findBudgetPassedProjects(q)
|
List<Project> projects = Collections.emptyList();
|
||||||
.stream()
|
if (processType == ProcessType.procurement_contract) {
|
||||||
|
projects = projectRepository.findBudgetPassedProjects(q);
|
||||||
|
}
|
||||||
|
else if (processType == ProcessType.sale_contract) {
|
||||||
|
projects = projectRepository.findBudgetPassedProjectsForSaleContract(q);
|
||||||
|
}
|
||||||
|
return projects.stream()
|
||||||
.map(project -> {
|
.map(project -> {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("id", project.getId());
|
map.put("id", project.getId());
|
||||||
|
|
|
@ -48,4 +48,15 @@ public interface ProjectRepository extends JpaRepository<Project,Integer> {
|
||||||
nativeQuery = true)
|
nativeQuery = true)
|
||||||
List<Project> findBudgetPassedProjects(@Param("q") String query);
|
List<Project> findBudgetPassedProjects(@Param("q") String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预算通过的项目
|
||||||
|
*/
|
||||||
|
@Query(value = "select distinct p.* from project p left join project_process pp on p.id = pp.project_id " +
|
||||||
|
"where (p.`status` > 5 or (p.`status` = 5 and p.approve_status_budget = 2)) " +
|
||||||
|
" and (p.`project_no` like concat('%', :q, '%') or p.`name` like concat('%', :q, '%')) " +
|
||||||
|
" and (pp.process_type is null or (pp.process_type <> 'sale_contract' and " +
|
||||||
|
" (select pps.process_type from project_process pps where pps.id = pp.id) <> 'procurement_contract'))",
|
||||||
|
nativeQuery = true)
|
||||||
|
List<Project> findBudgetPassedProjectsForSaleContract(@Param("q") String query);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,7 +851,7 @@
|
||||||
callback([])
|
callback([])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fetch("${base}/process/projects?q=" + q)
|
fetch("${base}/process/projects?q=" + q + "&processType=" + this.processType)
|
||||||
.then(checkStatus)
|
.then(checkStatus)
|
||||||
.then(parseJSON)
|
.then(parseJSON)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
Loading…
Reference in New Issue