From adaaa23c789be3313a0e554fbf7beaa8ab261e68 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期四, 16 五月 2024 18:07:01 +0800 Subject: [PATCH] zjh 2024/05/16-1 --- ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java | 2 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyTemplate.java | 13 ++++ ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjSurveyQuestionService.java | 2 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java | 21 ++++-- ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyQuestion.java | 5 + ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSurveyQuestionMapper.java | 4 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyTemplateController.java | 42 +++++++++++-- ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java | 8 ++ ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyQuestionMapper.xml | 12 ++- ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyTemplateMapper.xml | 10 ++ ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java | 3 + ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyQuestionController.java | 7 + 12 files changed, 100 insertions(+), 29 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyQuestionController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyQuestionController.java index 1d0bdf5..45b47f4 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyQuestionController.java +++ b/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); } } diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyTemplateController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyTemplateController.java index fe19864..68a43e5 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSurveyTemplateController.java +++ b/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); diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyQuestion.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyQuestion.java index c8fe3b4..826f80b 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyQuestion.java +++ b/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; /** * 闂 diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyTemplate.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyTemplate.java index 45b6d1f..5df30ab 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjSurveyTemplate.java +++ b/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; + /** * 闂嵎妯℃澘闂淇℃伅 diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSurveyQuestionMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSurveyQuestionMapper.java index 7641e46..6cd6807 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSurveyQuestionMapper.java +++ b/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") diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjSurveyQuestionService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjSurveyQuestionService.java index 915d03b..93e7dd2 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjSurveyQuestionService.java +++ b/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); diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java index fff56f8..85c696e 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java +++ b/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()); diff --git a/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyQuestionMapper.xml b/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyQuestionMapper.xml index 1695842..8ec4c80 100644 --- a/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyQuestionMapper.xml +++ b/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">--> diff --git a/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyTemplateMapper.xml b/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyTemplateMapper.xml index fbe6e88..3b560b4 100644 --- a/ltkj-hosp/src/main/resources/mapper/hosp/TjSurveyTemplateMapper.xml +++ b/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> diff --git a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java b/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java index e510f0c..9740b24 100644 --- a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java +++ b/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鏌ヨ閮ㄩ棬鏍戜俊鎭� * diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java b/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java index 3f5b6de..ad26ac2 100644 --- a/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java +++ b/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); + /** * 鏌ヨ閮ㄩ棬鏍戠粨鏋勪俊鎭� * diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java b/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java index 2f9e3b9..37f2ec2 100644 --- a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java +++ b/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); } } -- Gitblit v1.8.0