ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyQuestionController.java
@@ -92,7 +92,10 @@ //@PreAuthorize("@ss.hasPermi('hosp:question:remove')") @Log(title = "问卷问题", businessType = BusinessType.DELETE) @DeleteMapping("/{qids}") public AjaxResult remove(@PathVariable String[] qids) { return toAjax(tjSurveyQuestionService.deleteTjSurveyQuestionByQids(qids)); public AjaxResult remove(@PathVariable Long[] qids) { for (Long qid : qids) { tjSurveyQuestionService.deleteTjSurveyQuestionByQid(qid); } return toAjax(1); } } 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); ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyQuestion.java
@@ -2,6 +2,7 @@ import java.util.List; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -33,9 +34,9 @@ * id */ // @ApiModelProperty(value = "主键id") // @TableId @TableId(type = IdType.AUTO) // @JsonSerialize(using = ToStringSerializer.class) private String qid; private Long qid; /** * 问题 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyTemplate.java
@@ -61,6 +61,19 @@ /*启用标志*/ private String qybz; private Long deptId; @TableField(exist = false) private String deptName; /** * 备注 */ @TableField(exist = false) private String remark; private Integer flag; /** * 问卷模板问题信息 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSurveyQuestionMapper.java
@@ -69,7 +69,7 @@ * @param qid 问卷问题主键 * @return 结果 */ public int deleteTjSurveyQuestionByQid(String qid); public int deleteTjSurveyQuestionByQid(Long qid); public int deleteTjSurveyQuestionByMid(Long mid); @@ -105,7 +105,7 @@ * @param qid 问卷问题ID * @return 结果 */ public int deleteTjSurveyOptionsByQid(String qid); public int deleteTjSurveyOptionsByQid(Long qid); @Select("SELECT * FROM tj_survey_temp_ques a WHERE a.mid=#{mid} AND a.deleted=0") ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjSurveyQuestionService.java
@@ -61,7 +61,7 @@ * @param qid 问卷问题主键 * @return 结果 */ public int deleteTjSurveyQuestionByQid(String qid); public int deleteTjSurveyQuestionByQid(Long qid); List<TjSurveyTempQues> selectOptionsByMid(String mid); ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java
@@ -27,6 +27,9 @@ @Autowired private TjSurveyQuestionMapper tjSurveyQuestionMapper; @Autowired private ITjSurveyQuestionService tjSurveyQuestionService; /** * 查询问卷问题 * @@ -60,15 +63,17 @@ * @param tjSurveyQuestion 问卷问题 * @return 结果 */ @Transactional // @Transactional @Override public int insertTjSurveyQuestion(TjSurveyQuestion tjSurveyQuestion) { tjSurveyQuestion.setCreateTime(DateUtils.getNowDate()); tjSurveyQuestion.setCreateBy(SecurityUtils.getLoginUser().getUsername()); int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); System.out.println(tjSurveyQuestion); insertTjSurveyOptions(tjSurveyQuestion); return rows; // int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); if (tjSurveyQuestionService.save(tjSurveyQuestion)) { insertTjSurveyOptions(tjSurveyQuestion); return 1; } return 0; } /** @@ -107,7 +112,7 @@ */ @Transactional @Override public int deleteTjSurveyQuestionByQid(String qid) { public int deleteTjSurveyQuestionByQid(Long qid) { tjSurveyQuestionMapper.deleteTjSurveyOptionsByQid(qid); return tjSurveyQuestionMapper.deleteTjSurveyQuestionByQid(qid); } @@ -129,11 +134,11 @@ */ public void insertTjSurveyOptions(TjSurveyQuestion tjSurveyQuestion) { List<TjSurveyOptions> tjSurveyOptionsList = tjSurveyQuestion.getTjSurveyOptionsList(); String qid = tjSurveyQuestion.getQid(); Long qid = tjSurveyQuestion.getQid(); if (StringUtils.isNotNull(tjSurveyOptionsList)) { List<TjSurveyOptions> list = new ArrayList<TjSurveyOptions>(); for (TjSurveyOptions tjSurveyOptions : tjSurveyOptionsList) { tjSurveyOptions.setQid(qid); tjSurveyOptions.setQid(qid.toString()); tjSurveyOptions.setDeleted(0); tjSurveyOptions.setCreateBy(SecurityUtils.getLoginUser().getUsername()); tjSurveyOptions.setCreateTime(DateUtils.getNowDate()); ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyQuestionMapper.xml
@@ -150,9 +150,9 @@ </select> <select id="selectOptionsByQid" parameterType="String" resultType="TjSurveyOptions"> <select id="selectOptionsByQid" parameterType="java.lang.String" resultType="TjSurveyOptions"> select oid,qid,ooption,score,remark,create_by,create_time,update_by,update_time,deleted from tj_survey_options where qid = #{qid} where qid = #{qid} and deleted=0 </select> <!-- <insert id="insertTjSurveyQuestion" parameterType="TjSurveyQuestion" useGeneratedKeys="true"--> @@ -302,7 +302,7 @@ where qid = #{qid} </update> <update id="deleteTjSurveyQuestionByQid" parameterType="TjSurveyQuestion"> <update id="deleteTjSurveyQuestionByQid" parameterType="java.lang.Long"> update tj_survey_question SET deleted = 1 where qid = #{qid} </update> @@ -352,7 +352,7 @@ <!-- where qid = #{qid}--> <!-- </delete>--> <update id="deleteTjSurveyOptionsByQid" parameterType="TjSurveyOptions"> <update id="deleteTjSurveyOptionsByQid" parameterType="java.lang.Long"> update tj_survey_options SET deleted = 1 where qid = #{qid} </update> @@ -397,6 +397,10 @@ </if> </trim> <!-- 获取主键 --> <selectKey keyProperty="qid" resultType="String" order="AFTER"> SELECT LAST_INSERT_ID() AS qid </selectKey> </insert> <!-- <insert id="batchTjSurveyOptions">--> ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyTemplateMapper.xml
@@ -16,6 +16,7 @@ <result property="deleted" column="deleted"/> <result property="designId" column="design_id"/> <result property="qybz" column="qybz"/> <result property="deptId" column="dept_id"/> </resultMap> <resultMap id="TjSurveyTemplateTjSurveyTempQuesResult" type="TjSurveyTemplate" extends="TjSurveyTemplateResult"> @@ -78,6 +79,7 @@ a.deleted, a.design_id, a.qybz, a.dept_id, b.tqid as sub_tqid, b.mid as @@ -156,6 +158,8 @@ </if> <if test="qybz != null">qybz, </if> <if test="deptId != null">dept_id, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="tempName != null">#{tempName}, @@ -176,8 +180,8 @@ </if> <if test="designId != null">#{designId}, </if> <if test="qybz != null">#{qybz}, </if> <if test="qybz != null">#{qybz},</if> <if test="deptId != null">#{deptId},</if> </trim> </insert> @@ -214,6 +218,8 @@ <if test="qybz != null">qybz = #{qybz}, </if> <if test="deptId != null">dept_id= #{deptId}, </if> </trim> where mid = #{mid} </update> ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java
@@ -30,6 +30,9 @@ @Select("SELECT * FROM v_tj_deptpro") public List<SysDept> selectDeptTreeList1(); @Select("SELECT * FROM v_dept_template") public List<SysDept> selectDeptTreeList11(); /** * 根据角色ID查询部门树信息 * ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java
@@ -24,6 +24,8 @@ public List<SysDept> selectDeptList(SysDept dept); public List<SysDept> selectDeptList11(SysDept dept); public List<SysDept> selectDeptList111(SysDept dept); /** * 查询部门树结构信息 * ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java
@@ -56,6 +56,12 @@ return deptMapper.selectDeptTreeList1(); } @Override @DataScope(deptAlias = "d") public List<SysDept> selectDeptList111(SysDept dept) { return deptMapper.selectDeptTreeList11(); } /** * 查询部门树结构信息 * @@ -425,7 +431,7 @@ @Override public List<TreeSelect> selectDeptList1(SysDept dept) { List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList11(dept); List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList111(dept); return buildDeptTreeSelect(depts); } }