From db92053279667faaf66cddb6b4d4f33a010b737b Mon Sep 17 00:00:00 2001 From: youxilong Date: Fri, 1 Mar 2024 18:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1=E5=8C=85?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceWayContentController.java | 81 +++++++-- .../ServiceWayContentAddDTO.java | 59 ++++++ .../ServiceWayContentEditDTO.java | 72 ++++++++ .../ServiceWayContentMapper.java | 56 +++++- .../IServiceWayContentService.java | 44 ++++- .../impl/ServiceWayContentServiceImpl.java | 134 +++++++++++++- .../ServiceWayContentMapper.xml | 171 +++++++++++++++++- .../system/mapper/SysDictDataMapper.java | 7 + .../mapper/system/SysDictDataMapper.xml | 7 +- 9 files changed, 591 insertions(+), 40 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentAddDTO.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentEditDTO.java diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java index cbb42060..157a1e4d 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java @@ -7,7 +7,9 @@ import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.enums.BusinessType; import com.xinelu.common.utils.poi.ExcelUtil; import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentAddDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; @@ -34,6 +36,67 @@ public class ServiceWayContentController extends BaseController { @Resource private IServiceWayContentService serviceWayContentService; + /** + * 查询服务方式列表 + * + * @param serviceWayName + * @param id + * @return + */ + @ApiOperation("查询服务方式列表") + @GetMapping("/serviceWayList") + public AjaxResult listNum(String serviceWayName, Long id) { + List list = serviceWayContentService.selectListNum(serviceWayName, id); + return AjaxResult.success(list); + } + + /** + * 新增服务方式 + * + * @param serviceWayContent + * @return + */ + @ApiOperation("新增服务方式") + @PostMapping("/addServiceWay") + public AjaxResult addServiceWay(@RequestBody ServiceWayContent serviceWayContent) { + return toAjax(serviceWayContentService.insertServiceWay(serviceWayContent)); + } + + /** + * 根据服务方式id获取服务方式 + * @param id + * @return + */ + @ApiOperation("根据服务方式id获取服务方式") + @GetMapping(value = "/serviceWay/{id}") + public AjaxResult getServiceWayInfo(@PathVariable("id") Long id) { + return AjaxResult.success(serviceWayContentService.selectServiceWayById(id)); + } + + /** + * 修改服务方式 + * + * @param serviceWayContent + * @return + */ + @ApiOperation("修改服务方式") + @PutMapping("/editServiceWay") + public AjaxResult editServiceWay(@RequestBody ServiceWayContent serviceWayContent) { + return toAjax(serviceWayContentService.editServiceWay(serviceWayContent)); + } + + /** + * 根据id删除服务方式 + * + * @param id + * @return + */ + @ApiOperation("根据id删除服务方式") + @DeleteMapping("/removeServiceWay") + public AjaxResult removeServiceWay(Long id) { + return toAjax(serviceWayContentService.deleteServiceWayById(id)); + } + /** * 查询服务方式内容列表 */ @@ -46,16 +109,6 @@ public class ServiceWayContentController extends BaseController { return getDataTable(list); } - /** - * 查询服务方式列表和记录数 - */ - @ApiOperation("查询服务方式和记录数") - @GetMapping("/listNum") - public AjaxResult listNum(String serviceWayName) { - List list = serviceWayContentService.selectListNum(serviceWayName); - return AjaxResult.success(list); - } - /** * 导出服务方式内容列表 @@ -86,8 +139,8 @@ public class ServiceWayContentController extends BaseController { @PreAuthorize("@ss.hasPermi('manage:servicewaycontent:add')") @Log(title = "服务方式内容", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ServiceWayContent serviceWayContent) { - return toAjax(serviceWayContentService.insertServiceWayContent(serviceWayContent)); + public AjaxResult add(@RequestBody ServiceWayContentAddDTO serviceWayContentAddDTO) { + return toAjax(serviceWayContentService.insertServiceWayContent(serviceWayContentAddDTO)); } /** @@ -96,8 +149,8 @@ public class ServiceWayContentController extends BaseController { @PreAuthorize("@ss.hasPermi('manage:servicewaycontent:edit')") @Log(title = "服务方式内容", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ServiceWayContent serviceWayContent) { - return toAjax(serviceWayContentService.updateServiceWayContent(serviceWayContent)); + public AjaxResult edit(@RequestBody ServiceWayContentEditDTO serviceWayContentEditDTO) { + return toAjax(serviceWayContentService.updateServiceWayContent(serviceWayContentEditDTO)); } /** diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentAddDTO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentAddDTO.java new file mode 100644 index 00000000..9f49c0da --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentAddDTO.java @@ -0,0 +1,59 @@ +package com.xinelu.manage.dto.servicewaycontent; + +import com.xinelu.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author : youxilong + * @date : 2024/3/1 14:52 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "填加服务方式内容对象DTO") +public class ServiceWayContentAddDTO { + /** + * 服务方式id + */ + private Long id; + + + /** + * 服务内容 + */ + @ApiModelProperty(value = "服务内容") + @Excel(name = "服务内容") + private String serviceContent; + + /** + * 服务频次类型,数字:DIGIT,文本:TEXT + */ + @ApiModelProperty(value = "服务频次类型,数字:DIGIT,文本:TEXT") + @Excel(name = "服务频次类型,数字:DIGIT,文本:TEXT") + private String serviceFrequencyType; + + /** + * 服务频次文本 + */ + @ApiModelProperty(value = "服务频次文本") + @Excel(name = "服务频次文本") + private String serviceFrequencyText; + + /** + * 服务频次数字起始值 + */ + @ApiModelProperty(value = "服务频次数字起始值") + @Excel(name = "服务频次数字起始值") + private Integer serviceFrequencyStart; + + /** + * 服务频次数字结束值 + */ + @ApiModelProperty(value = "服务频次数字结束值") + @Excel(name = "服务频次数字结束值") + private Integer serviceFrequencyEnd; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentEditDTO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentEditDTO.java new file mode 100644 index 00000000..ef8b930e --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicewaycontent/ServiceWayContentEditDTO.java @@ -0,0 +1,72 @@ +package com.xinelu.manage.dto.servicewaycontent; + +import com.xinelu.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author : youxilong + * @date : 2024/3/1 17:17 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "修改服务方式内容对象DTO") +public class ServiceWayContentEditDTO { + + /** + * 服务频次id + */ + @ApiModelProperty(value = "服务频次id") + private Long id; + + /** + * 服务方式id + */ + @ApiModelProperty(value = "服务方式id") + private Long serviceWayId; + + /** + * 服务内容id + */ + @ApiModelProperty(value = "服务内容id") + private Long serviceContentId; + + /** + * 服务内容 + */ + @ApiModelProperty(value = "服务内容") + @Excel(name = "服务内容") + private String serviceContent; + + /** + * 服务频次类型,数字:DIGIT,文本:TEXT + */ + @ApiModelProperty(value = "服务频次类型,数字:DIGIT,文本:TEXT") + @Excel(name = "服务频次类型,数字:DIGIT,文本:TEXT") + private String serviceFrequencyType; + + /** + * 服务频次文本 + */ + @ApiModelProperty(value = "服务频次文本") + @Excel(name = "服务频次文本") + private String serviceFrequencyText; + + /** + * 服务频次数字起始值 + */ + @ApiModelProperty(value = "服务频次数字起始值") + @Excel(name = "服务频次数字起始值") + private Integer serviceFrequencyStart; + + /** + * 服务频次数字结束值 + */ + @ApiModelProperty(value = "服务频次数字结束值") + @Excel(name = "服务频次数字结束值") + private Integer serviceFrequencyEnd; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java index f553e4a7..4b837c84 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java @@ -1,7 +1,9 @@ package com.xinelu.manage.mapper.servicewaycontent; import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentAddDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; @@ -65,14 +67,17 @@ public interface ServiceWayContentMapper { public int deleteServiceWayContentByIds(Long[] ids); /** - * 查询服务方式名称 + * 查询服务方式列表 + * * @param serviceWayName + * @param id * @return */ - List selectListNum(@Param("serviceWayName") String serviceWayName); + List selectListNum(@Param("serviceWayName") String serviceWayName, @Param("id") Long id); /** * 查询服务方式内容列表 + * * @param serviceWayContentDTO * @return */ @@ -80,6 +85,7 @@ public interface ServiceWayContentMapper { /** * 根据服务频次id查询服务内容和服务频次 + * * @param id * @return */ @@ -87,8 +93,54 @@ public interface ServiceWayContentMapper { /** * 根据服务频次id和服务内容id删除服务内容 + * * @param serviceWayContentRemoveDTO * @return */ int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO); + + /** + * 查询服务方式是否存在 + * + * @param serviceWayName + * @return + */ + int countByServiceName(String serviceWayName); + + /** + * 根据id删除服务方式 + * + * @param id + * @return + */ + int deleteServiceWayById(Long id); + + /** + * 通过id查询服务方式 + * + * @param id + * @return + */ + String selectServiceWayById(Long id); + + /** + * @param serviceWayContentAddDTO + * @param id + * @return + */ + int countByDTOAndContentId(@Param("DTO") ServiceWayContentAddDTO serviceWayContentAddDTO, @Param("id") Long id); + + /** + * 修改服务方式 + * @param serviceWayContent + * @return + */ + int updateServiceWay(ServiceWayContent serviceWayContent); + + /** + * 判断同一服务内容下服务频次是否存在 + * @param serviceWayContentEditDTO + * @return + */ + int countByEditDTO(ServiceWayContentEditDTO serviceWayContentEditDTO); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/IServiceWayContentService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/IServiceWayContentService.java index 678ade1f..01ec36ff 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/IServiceWayContentService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/IServiceWayContentService.java @@ -1,7 +1,9 @@ package com.xinelu.manage.service.servicewaycontent; import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentAddDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; @@ -34,18 +36,18 @@ public interface IServiceWayContentService { /** * 新增服务方式内容 * - * @param serviceWayContent 服务方式内容 + * @param serviceWayContentAddDTO 服务方式内容 * @return 结果 */ - public int insertServiceWayContent(ServiceWayContent serviceWayContent); + public int insertServiceWayContent(ServiceWayContentAddDTO serviceWayContentAddDTO); /** * 修改服务方式内容 * - * @param serviceWayContent 服务方式内容 + * @param serviceWayContentEditDTO 服务方式内容 * @return 结果 */ - public int updateServiceWayContent(ServiceWayContent serviceWayContent); + public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO); /** * 批量删除服务方式内容 @@ -64,16 +66,46 @@ public interface IServiceWayContentService { public int deleteServiceWayContentById(Long id); /** - * 查询服务方式和记录数 + * 查询服务方式列表 * @param serviceWayName + * @param id * @return */ - List selectListNum(String serviceWayName); + List selectListNum(String serviceWayName, Long id); /** * 根据服务频次id和服务内容id删除服务内容 + * * @param serviceWayContentRemoveDTO * @return */ int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO); + + /** + * 新增服务方式 + * @param serviceWayContent + * @return + */ + int insertServiceWay(ServiceWayContent serviceWayContent); + + /** + * 修改服务方式 + * @param serviceWayContent + * @return + */ + int editServiceWay(ServiceWayContent serviceWayContent); + + /** + * 根据id删除服务方式 + * @param id + * @return + */ + int deleteServiceWayById(Long id); + + /** + * 根据id查询服务方式 + * @param id + * @return + */ + String selectServiceWayById(Long id); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java index 0762c5cf..c2542e6d 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java @@ -1,13 +1,19 @@ package com.xinelu.manage.service.servicewaycontent.impl; +import com.xinelu.common.enums.ServiceWayContentServiceType; +import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; +import com.xinelu.common.utils.SecurityUtils; import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentAddDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO; +import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.mapper.servicewaycontent.ServiceWayContentMapper; import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; +import com.xinelu.system.mapper.SysDictDataMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -24,6 +30,9 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { @Resource private ServiceWayContentMapper serviceWayContentMapper; + @Resource + private SysDictDataMapper sysDictDataMapper; + /** * 查询服务方式内容 * @@ -49,25 +58,61 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { /** * 新增服务方式内容 * - * @param serviceWayContent 服务方式内容 + * @param serviceWayContentAddDTO 服务方式内容 * @return 结果 */ @Override - public int insertServiceWayContent(ServiceWayContent serviceWayContent) { + public int insertServiceWayContent(ServiceWayContentAddDTO serviceWayContentAddDTO) { + // 新增服务内容 + ServiceWayContent serviceWayContent = new ServiceWayContent(); + serviceWayContent.setServiceType(ServiceWayContentServiceType.SERVICE_CONTENT.toString()); + serviceWayContent.setServiceWayId(serviceWayContentAddDTO.getId()); + serviceWayContent.setServiceContent(serviceWayContentAddDTO.getServiceContent()); + serviceWayContent.setCreateBy(SecurityUtils.getUsername()); serviceWayContent.setCreateTime(DateUtils.getNowDate()); - return serviceWayContentMapper.insertServiceWayContent(serviceWayContent); + if (serviceWayContentMapper.insertServiceWayContent(serviceWayContent) <= 0) { + throw new ServiceException("新增服务内容失败"); + + } + // 判断同一方式下同一服务内容下服务频次是否存在 + // 如果存在,则提示该服务内容下服务频次已存在 + if (serviceWayContentMapper.countByDTOAndContentId(serviceWayContentAddDTO, serviceWayContent.getId()) > 0) { + throw new ServiceException("当前服务方式服务内容下服务频次已存在"); + } + // 如果不存在,新增服务频次 + ServiceWayContent serviceFrequency = new ServiceWayContent(); + serviceFrequency.setServiceType(ServiceWayContentServiceType.SERVICE_FREQUENCY.toString()); + serviceFrequency.setServiceContentId(serviceWayContent.getId()); + serviceFrequency.setServiceFrequencyType(serviceWayContentAddDTO.getServiceFrequencyType()); + serviceFrequency.setServiceFrequencyStart(serviceWayContentAddDTO.getServiceFrequencyStart()); + serviceFrequency.setServiceFrequencyEnd(serviceWayContentAddDTO.getServiceFrequencyEnd()); + serviceFrequency.setCreateBy(SecurityUtils.getUsername()); + serviceFrequency.setCreateTime(DateUtils.getNowDate()); + if (serviceWayContentMapper.insertServiceWayContent(serviceWayContent) <= 0) { + throw new ServiceException("新增服务频次失败"); + } + return 1; } /** * 修改服务方式内容 * - * @param serviceWayContent 服务方式内容 + * @param serviceWayContentEditDTO 服务方式内容 * @return 结果 */ @Override - public int updateServiceWayContent(ServiceWayContent serviceWayContent) { - serviceWayContent.setUpdateTime(DateUtils.getNowDate()); - return serviceWayContentMapper.updateServiceWayContent(serviceWayContent); + public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO) { + // 判断同一服务内容下服务频次是否存在 + if (serviceWayContentMapper.countByEditDTO(serviceWayContentEditDTO) <= 0) { + throw new ServiceException("当前服务内容下服务频次已存在"); + } + // TODO + // 如果存在,则提示该服务内容下服务频次已存在 + + // 如果不存在,修改服务频次 + + + return 1; } /** @@ -93,14 +138,15 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { } /** - * 查询服务方式和记录数 + * 查询服务方式列表 * * @param serviceWayName + * @param id * @return */ @Override - public List selectListNum(String serviceWayName) { - return serviceWayContentMapper.selectListNum(serviceWayName); + public List selectListNum(String serviceWayName, Long id) { + return serviceWayContentMapper.selectListNum(serviceWayName, id); } /** @@ -113,4 +159,72 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { public int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO) { return serviceWayContentMapper.deleteByFrequencyIdAndContentId(serviceWayContentRemoveDTO); } + + /** + * 新增服务方式 + * + * @param serviceWayContent + * @return + */ + @Override + public int insertServiceWay(ServiceWayContent serviceWayContent) { + // 查询服务方式名称是否存在 + int existNameCount = serviceWayContentMapper.countByServiceName(serviceWayContent.getServiceWayName()); + // 若size >0,则服务名称已存在 + if (existNameCount > 0) { + throw new ServiceException("服务方式名称已存在"); + } + // 如果不存在,执行新增功能 + Long dictCodeByName = sysDictDataMapper.selectDictCodeByName(serviceWayContent.getServiceWayName()); + String serviceWayCode = (dictCodeByName != null) ? dictCodeByName.toString() : null; + serviceWayContent.setServiceWayCode(serviceWayCode); + serviceWayContent.setServiceType(ServiceWayContentServiceType.SERVICE_WRY.toString()); + serviceWayContent.setCreateBy(SecurityUtils.getUsername()); + serviceWayContent.setCreateTime(DateUtils.getNowDate()); + return serviceWayContentMapper.insertServiceWayContent(serviceWayContent); + } + + /** + * 修改服务方式 + * + * @param serviceWayContent + * @return + */ + @Override + public int editServiceWay(ServiceWayContent serviceWayContent) { + // 查询服务方式名称是否存在 + int existNameCount = serviceWayContentMapper.countByServiceName(serviceWayContent.getServiceWayName()); + // 若size >0,则服务名称已存在 + if (existNameCount > 0) { + throw new ServiceException("服务方式名称已存在"); + } + // 如果不存在,执行修改功能 + Long dictCodeByName = sysDictDataMapper.selectDictCodeByName(serviceWayContent.getServiceWayName()); + String serviceWayCode = (dictCodeByName != null) ? dictCodeByName.toString() : null; + serviceWayContent.setServiceWayCode(serviceWayCode); + serviceWayContent.setUpdateBy(SecurityUtils.getUsername()); + serviceWayContent.setUpdateTime(DateUtils.getNowDate()); + return serviceWayContentMapper.updateServiceWay(serviceWayContent); + } + + /** + * 根据id删除服务方式 + * + * @param id + * @return + */ + @Override + public int deleteServiceWayById(Long id) { + // 判断该服务方式下是否是关联记录,如果有则不能删除 + List voList = serviceWayContentMapper.selectListNum(null, id); + if (voList.size() > 0) { + throw new ServiceException("该服务方式下有服务内容,请先删除服务内容"); + } + return serviceWayContentMapper.deleteServiceWayById(id); + } + + @Override + public String selectServiceWayById(Long id) { + return serviceWayContentMapper.selectServiceWayById(id); + } } diff --git a/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml index c11ad2ef..d19c2e35 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml @@ -107,13 +107,22 @@ where id = #{id} + + + + + + @@ -293,6 +392,60 @@ where id = #{id} + + update service_way_content + + service_way_name = + #{serviceWayName}, + + service_way_code = + #{serviceWayCode}, + + service_type = + #{serviceType}, + + service_way_id = + #{serviceWayId}, + + service_content = + #{serviceContent}, + + service_content_id = + #{serviceContentId}, + + service_frequency_type = + #{serviceFrequencyType}, + + service_frequency_text = + #{serviceFrequencyText}, + + service_frequency_start = + #{serviceFrequencyStart}, + + service_frequency_end = + #{serviceFrequencyEnd}, + + service_sort = + #{serviceSort}, + + service_remark = + #{serviceRemark}, + + create_by = + #{createBy}, + + create_time = + #{createTime}, + + update_by = + #{updateBy}, + + update_time = + #{updateTime}, + + + where id = #{id} and service_type = 'SERVICE_WRY' + delete @@ -314,4 +467,10 @@ and service_content_id = #{serviceContentId} and service_type = 'SERVICE_FREQUENCY' + + delete + from service_way_content + where service_type = 'SERVICE_CONTENT' + and id = #{id} + \ No newline at end of file diff --git a/postdischarge-system/src/main/java/com/xinelu/system/mapper/SysDictDataMapper.java b/postdischarge-system/src/main/java/com/xinelu/system/mapper/SysDictDataMapper.java index 737b3f19..154dcbc2 100644 --- a/postdischarge-system/src/main/java/com/xinelu/system/mapper/SysDictDataMapper.java +++ b/postdischarge-system/src/main/java/com/xinelu/system/mapper/SysDictDataMapper.java @@ -92,4 +92,11 @@ public interface SysDictDataMapper { * @return 结果 */ public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); + + /** + * 根据服务方式名称查询dictCode + * @param serviceWayName + * @return + */ + Long selectDictCodeByName(String serviceWayName); } diff --git a/postdischarge-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/postdischarge-system/src/main/resources/mapper/system/SysDictDataMapper.xml index d2a89ceb..6ab4b37d 100644 --- a/postdischarge-system/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/postdischarge-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -21,7 +21,7 @@ - select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data @@ -57,8 +57,11 @@ + delete from sys_dict_data where dict_code = #{dictCode}