查询预算通过的项目

master
Harry Yang 2022-12-27 14:50:35 +08:00
parent 40f9706e29
commit 9073362fcc
2 changed files with 10 additions and 3 deletions

View File

@ -204,10 +204,13 @@ public class ProcessController {
return processService.getProjectRepaidAmount(id);
}
/**
* ,
*/
@ResponseBody
@GetMapping("/projects")
public List<Map<String, Object>> query(@RequestParam String q) {
return projectRepository.findByProjectNoOrName(q)
return projectRepository.findBudgetPassedProjects(q)
.stream()
.map(project -> {
HashMap<String, Object> map = new HashMap<>();

View File

@ -40,8 +40,12 @@ public interface ProjectRepository extends JpaRepository<Project,Integer> {
@Query(value = "update project set approve_id=?, approve_name=? where approve_id = ?", nativeQuery = true)
int batchUpdateApprove(int targetAdminId, String targetAdminName, int adminId);
@Query(value = "select * from project where `project_no` like concat('%', :q, '%') or `name` like concat('%', :q, '%')",
/**
*
*/
@Query(value = "select * from project where (`status` > 5 or (`status` = 5 and approve_status_budget = 2)) " +
" and (`project_no` like concat('%', :q, '%') or `name` like concat('%', :q, '%'))",
nativeQuery = true)
List<Project> findByProjectNoOrName(@Param("q") String query);
List<Project> findBudgetPassedProjects(@Param("q") String query);
}