zjh
2024-05-16 adaaa23c789be3313a0e554fbf7beaa8ab261e68
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyTemplateController.java
@@ -75,11 +75,12 @@
    @ApiOperation(value = "判断该模板是否可删除")
    @GetMapping(value = "/canDelete")
    public AjaxResult canDelete(Long id) {
        TjSurveyTemplate byId = tjSurveyTemplateService.selectTemplateByMid1(id);
//        List<FwdPlanInfoVo> fwdPlanInfoVos = fwdSqlMapper.canDelete(id);
//        if (fwdPlanInfoVos!=null && fwdPlanInfoVos.size()>0){
//            return AjaxResult.success(false);
//        }
        return AjaxResult.success(false);
        if (byId !=null && byId.getQybz().equals("0")){
            return AjaxResult.success(false);
        }
        return AjaxResult.success(true);
    }
@@ -153,7 +154,7 @@
            wq1.eq(TjSurveyQuestion::getMid,byId.getMid());
            final List<TjSurveyQuestion> list1 = tjSurveyQuestionService.list(wq1);
            for (TjSurveyQuestion tjSurveyQuestion : list1) {
                final List<TjSurveyOptions> tjSurveyOptions = tjSurveyQuestionService.selectOptionsByQid(tjSurveyQuestion.getQid());
                final List<TjSurveyOptions> tjSurveyOptions = tjSurveyQuestionService.selectOptionsByQid(String.valueOf(tjSurveyQuestion.getQid()));
                tjSurveyQuestion.setTjSurveyOptionsList(tjSurveyOptions);
            }
            return AjaxResult.success(list1);
@@ -175,6 +176,34 @@
//            return AjaxResult.success(l11);
//        }
//        return AjaxResult.success("暂无信息");
    }
    /**
     * 获取问卷模板
     */
    @GetMapping("/getQuesByMids")
    @ApiOperation(value = "获取问卷模板信息")
    public AjaxResult getQuesByMids(@RequestParam Long mid) {
        List<TjSurveyQuestion> l1 = new ArrayList<>();
//        TjSurveyTemplate byId = tjSurveyTemplateService.selectTjSurveyTemplateByMid(mid);
        List<TjSurveyTempQues> tjSurveyTempQuesList = tjSurveyQuestionService.selectOptionsByMid(mid.toString());
        if (tjSurveyTempQuesList != null && tjSurveyTempQuesList.size()>0) {
            for (TjSurveyTempQues tjSurveyTempQues : tjSurveyTempQuesList) {
                TjSurveyQuestion byId1 = tjSurveyQuestionService.selectTjSurveyQuestionByQid(tjSurveyTempQues.getQid());
                if (byId1 != null) {
                    l1.add(byId1);
                }
            }
            return AjaxResult.success(l1);
        }
        List<TjSurveyQuestion> optionsByMid = tjSurveyQuestionService.getOptionsByMid(mid.toString());
        if(null !=optionsByMid && optionsByMid.size()>0){
            return AjaxResult.success(optionsByMid);
        }
        return AjaxResult.success("暂无信息");
    }
@@ -220,7 +249,6 @@
                                                 @RequestParam("pageNum") int pageNum,
                                                 @RequestParam("pageSize") int pageSize) {
        Map<String, Object> res = new HashMap<>();
        System.out.println();
//        List<TjSurveyQuestion> list = tjSurveyTemplateService.getQuestionsByMid(mid);
        LambdaQueryWrapper<TjSurveyQuestion> wq1=new LambdaQueryWrapper<>();
        wq1.eq(TjSurveyQuestion::getMid,mid);
@@ -240,7 +268,7 @@
        final TjSurveyTemplate byId = tjSurveyTemplateService.selectTemplateByMid1(mid);
        for (TjSurveyQuestion tjSurveyQuestion : result) {
            tjSurveyQuestion.setTemplate(byId);
            final List<TjSurveyOptions> tjSurveyOptions = tjSurveyQuestionService.selectOptionsByQid(tjSurveyQuestion.getQid());
            final List<TjSurveyOptions> tjSurveyOptions = tjSurveyQuestionService.selectOptionsByQid(String.valueOf(tjSurveyQuestion.getQid()));
            tjSurveyQuestion.setTjSurveyOptionsList(tjSurveyOptions);
        }
        res.put("data", result);