修改服务包内容查询接口
This commit is contained in:
parent
5e2471e742
commit
db92053279
@ -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<ServiceWayContentAndNumVO> 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<ServiceWayContentAndNumVO> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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<ServiceWayContentAndNumVO> selectListNum(@Param("serviceWayName") String serviceWayName);
|
||||
List<ServiceWayContentAndNumVO> 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);
|
||||
}
|
||||
|
||||
@ -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<ServiceWayContentAndNumVO> selectListNum(String serviceWayName);
|
||||
List<ServiceWayContentAndNumVO> 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);
|
||||
}
|
||||
|
||||
@ -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<ServiceWayContentAndNumVO> selectListNum(String serviceWayName) {
|
||||
return serviceWayContentMapper.selectListNum(serviceWayName);
|
||||
public List<ServiceWayContentAndNumVO> 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<ServiceWayContentAndNumVO> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,13 +107,22 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectListNum" resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO">
|
||||
select swc1.id,swc1.service_way_name,count(*) as serviceContentNum from service_way_content swc1 left join
|
||||
service_way_content swc2 on swc1.id = swc2.service_way_id
|
||||
left join service_way_content swc3 on swc2.id =swc3.service_content_id
|
||||
SELECT
|
||||
swc1.id,
|
||||
swc1.service_way_name,
|
||||
COUNT(swc3.id) AS serviceContentNum
|
||||
FROM
|
||||
service_way_content swc1
|
||||
LEFT JOIN
|
||||
service_way_content swc2 ON swc1.id = swc2.service_way_id AND swc2.service_type = 'SERVICE_CONTENT'
|
||||
LEFT JOIN
|
||||
service_way_content swc3 ON swc2.id = swc3.service_content_id AND swc3.service_type = 'SERVICE_FREQUENCY'
|
||||
<where>
|
||||
swc1.service_type = 'SERVICE_WRY'
|
||||
and swc2.service_type = 'SERVICE_CONTENT'
|
||||
and swc3.service_type = 'SERVICE_FREQUENCY'
|
||||
<if test="id != null">
|
||||
and swc1.id =
|
||||
#{id}
|
||||
</if>
|
||||
<if test="serviceWayName != null and serviceWayName != ''">
|
||||
and swc1.service_way_name like concat('%',
|
||||
#{serviceWayName},
|
||||
@ -121,6 +130,7 @@
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
Group By swc1.id
|
||||
</select>
|
||||
<select id="selectServiceWayContentListV1"
|
||||
resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO">
|
||||
@ -136,7 +146,7 @@
|
||||
swc1.service_type = 'SERVICE_CONTENT'
|
||||
and swc2.service_type = 'SERVICE_FREQUENCY'
|
||||
<if test="serviceWayId != null ">
|
||||
and service_way_id =
|
||||
and swc1.service_way_id =
|
||||
#{serviceWayId}
|
||||
</if>
|
||||
<if test="serviceContent != null and serviceContent != ''">
|
||||
@ -165,6 +175,95 @@
|
||||
AND swc1.id = #{id}
|
||||
|
||||
</select>
|
||||
<select id="countByServiceName" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
select count(*)
|
||||
from service_way_content swc
|
||||
where swc.service_way_name = #{serviceWayName}
|
||||
and swc.service_type = 'SERVICE_WRY'
|
||||
</select>
|
||||
|
||||
<select id="selectServiceWayById" resultType="java.lang.String" parameterType="java.lang.Long">
|
||||
select swc.service_way_name
|
||||
from service_way_content swc
|
||||
where swc.service_type = 'SERVICE_WRY'
|
||||
and swc.id = #{id}
|
||||
</select>
|
||||
<select id="selectList" resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO">
|
||||
select
|
||||
from service_way_content swc
|
||||
<where>
|
||||
swc.service_type = 'SERVICE_WRY'
|
||||
<if test="id != null">
|
||||
and swc.id =
|
||||
#{id}
|
||||
</if>
|
||||
<if test="serviceWayName != null and serviceWayName != ''">
|
||||
and swc.service_way_name like concat('%',
|
||||
#{serviceWayName},
|
||||
'%'
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="countByDTOAndContentId" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from service_way_content swc1
|
||||
left join
|
||||
service_way_content swc2 on swc1.id = swc2.service_way_id
|
||||
left join service_way_content swc3 on swc2.id = swc3.service_content_id
|
||||
<where>
|
||||
swc1.service_type = 'SERVICE_WRY'
|
||||
and swc2.service_type = 'SERVICE_CONTENT'
|
||||
and swc3.service_type = 'SERVICE_FREQUENCY'
|
||||
and swc1.id = #{DTO.id} and swc2.id = #{id}
|
||||
<if test="serviceFrequencyType != null and serviceFrequencyType != ''">
|
||||
and service_frequency_type =
|
||||
#{serviceFrequencyType}
|
||||
</if>
|
||||
<if test="serviceFrequencyText != null and serviceFrequencyText != ''">
|
||||
and service_frequency_text =
|
||||
#{serviceFrequencyText}
|
||||
</if>
|
||||
<if test="serviceFrequencyStart != null ">
|
||||
and service_frequency_start =
|
||||
#{serviceFrequencyStart}
|
||||
</if>
|
||||
<if test="serviceFrequencyEnd != null ">
|
||||
and service_frequency_end =
|
||||
#{serviceFrequencyEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="countByEditDTO" resultType="java.lang.Integer"
|
||||
parameterType="com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO">
|
||||
select count(*)
|
||||
from service_way_content swc1
|
||||
left join
|
||||
service_way_content swc2 on swc1.id = swc2.service_way_id
|
||||
left join service_way_content swc3 on swc2.id = swc3.service_content_id
|
||||
<where>
|
||||
swc1.service_type = 'SERVICE_WRY'
|
||||
and swc2.service_type = 'SERVICE_CONTENT'
|
||||
and swc3.service_type = 'SERVICE_FREQUENCY'
|
||||
and swc1.id = #{DTO.id} and swc2.id = #{id}
|
||||
<if test="serviceFrequencyType != null and serviceFrequencyType != ''">
|
||||
and service_frequency_type =
|
||||
#{serviceFrequencyType}
|
||||
</if>
|
||||
<if test="serviceFrequencyText != null and serviceFrequencyText != ''">
|
||||
and service_frequency_text =
|
||||
#{serviceFrequencyText}
|
||||
</if>
|
||||
<if test="serviceFrequencyStart != null ">
|
||||
and service_frequency_start =
|
||||
#{serviceFrequencyStart}
|
||||
</if>
|
||||
<if test="serviceFrequencyEnd != null ">
|
||||
and service_frequency_end =
|
||||
#{serviceFrequencyEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertServiceWayContent" parameterType="ServiceWayContent" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
@ -293,6 +392,60 @@
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateServiceWay" parameterType="com.xinelu.manage.domain.servicewaycontent.ServiceWayContent">
|
||||
update service_way_content
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="serviceWayName != null">service_way_name =
|
||||
#{serviceWayName},
|
||||
</if>
|
||||
<if test="serviceWayCode != null">service_way_code =
|
||||
#{serviceWayCode},
|
||||
</if>
|
||||
<if test="serviceType != null">service_type =
|
||||
#{serviceType},
|
||||
</if>
|
||||
<if test="serviceWayId != null">service_way_id =
|
||||
#{serviceWayId},
|
||||
</if>
|
||||
<if test="serviceContent != null">service_content =
|
||||
#{serviceContent},
|
||||
</if>
|
||||
<if test="serviceContentId != null">service_content_id =
|
||||
#{serviceContentId},
|
||||
</if>
|
||||
<if test="serviceFrequencyType != null">service_frequency_type =
|
||||
#{serviceFrequencyType},
|
||||
</if>
|
||||
<if test="serviceFrequencyText != null">service_frequency_text =
|
||||
#{serviceFrequencyText},
|
||||
</if>
|
||||
<if test="serviceFrequencyStart != null">service_frequency_start =
|
||||
#{serviceFrequencyStart},
|
||||
</if>
|
||||
<if test="serviceFrequencyEnd != null">service_frequency_end =
|
||||
#{serviceFrequencyEnd},
|
||||
</if>
|
||||
<if test="serviceSort != null">service_sort =
|
||||
#{serviceSort},
|
||||
</if>
|
||||
<if test="serviceRemark != null">service_remark =
|
||||
#{serviceRemark},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id} and service_type = 'SERVICE_WRY'
|
||||
</update>
|
||||
|
||||
<delete id="deleteServiceWayContentById" parameterType="Long">
|
||||
delete
|
||||
@ -314,4 +467,10 @@
|
||||
and service_content_id = #{serviceContentId}
|
||||
and service_type = 'SERVICE_FREQUENCY'
|
||||
</delete>
|
||||
<delete id="deleteServiceWayById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from service_way_content
|
||||
where service_type = 'SERVICE_CONTENT'
|
||||
and id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDictDataVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
@ -57,8 +57,11 @@
|
||||
</select>
|
||||
|
||||
<select id="countDictDataByType" resultType="Integer">
|
||||
select count(1) from sys_dict_data where dict_type=#{dictType}
|
||||
select count(1) from sys_dict_data where dict_type=#{dictType}
|
||||
</select>
|
||||
<select id="selectDictCodeByName" resultType="java.lang.Long">
|
||||
select dict_code from sys_dict_data where dict_label = #{serviceWayName}
|
||||
</select>
|
||||
|
||||
<delete id="deleteDictDataById" parameterType="Long">
|
||||
delete from sys_dict_data where dict_code = #{dictCode}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user