zjh
2024-08-13 399142eaaef038d040b78e20ce07a17e67d4e96a
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
@@ -1736,21 +1736,32 @@
    /**
     * 根据项目id获取建议
     */
    @GetMapping("/getDeptAdvice/{proId}")
    @GetMapping("/getDeptAdvice")
    @ApiOperation(value = "根据项目id获取建议")
    public AjaxResult getDeptAdvice(@ApiParam(value = "父项目项目id") @PathVariable String proId) {
        List<TjAdvice> list = new ArrayList<>();
    public AjaxResult getDeptAdvice(@ApiParam(value = "父项目项目id") @RequestParam(required = false) String proId,
                                    @ApiParam(value = "内容") @RequestParam(required = false) String nr,
                                    @ApiParam(value = "拼音码") @RequestParam(required = false) String pym,
                                    @ApiParam(value = "页码") @RequestParam(defaultValue ="1") int page,
                                    @ApiParam(value = "每页展示条数") @RequestParam(defaultValue ="10") int pageSize) {
        LambdaQueryWrapper<TjAdvice> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjAdvice::getProId, proId);
        List<TjAdvice> list1 = tjAdviceService.list(wq1);
        //如果没有项目id  就返回所有的建议集合
        if (list1.size() == 0) {
            return AjaxResult.success(tjAdviceService.list());
        if(null !=proId){
            wq1.eq(TjAdvice::getProId, proId);
        }
        for (TjAdvice tjAdvice : list1) {
            list.add(tjAdvice);
        if(null !=nr && !nr.isEmpty()){
            wq1.like(TjAdvice::getTitle,nr);
        }else if (null !=pym && !pym.isEmpty()){
            wq1.like(TjAdvice::getTitle,pym);
        }
        return AjaxResult.success(list);
//        else {
//            wq1.last("limit 20");
//        }
        Page<TjAdvice> pages=new Page<>(page,pageSize);
        Page<TjAdvice> advicePage = tjAdviceService.page(pages, wq1);
        Map<String,Object> map=new HashMap<>();
        map.put("list",advicePage.getRecords());
        map.put("total",advicePage.getTotal());
//        List<TjAdvice> list = tjAdviceService.list(wq1);
        return AjaxResult.success(map);
    }
    /**