修改服务包内容查询接口

This commit is contained in:
youxilong 2024-03-01 18:00:52 +08:00
parent 5e2471e742
commit db92053279
9 changed files with 591 additions and 40 deletions

View File

@ -7,7 +7,9 @@ import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType; import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil; import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.servicewaycontent.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.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService; import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
@ -34,6 +36,67 @@ public class ServiceWayContentController extends BaseController {
@Resource @Resource
private IServiceWayContentService serviceWayContentService; 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); 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')") @PreAuthorize("@ss.hasPermi('manage:servicewaycontent:add')")
@Log(title = "服务方式内容", businessType = BusinessType.INSERT) @Log(title = "服务方式内容", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ServiceWayContent serviceWayContent) { public AjaxResult add(@RequestBody ServiceWayContentAddDTO serviceWayContentAddDTO) {
return toAjax(serviceWayContentService.insertServiceWayContent(serviceWayContent)); return toAjax(serviceWayContentService.insertServiceWayContent(serviceWayContentAddDTO));
} }
/** /**
@ -96,8 +149,8 @@ public class ServiceWayContentController extends BaseController {
@PreAuthorize("@ss.hasPermi('manage:servicewaycontent:edit')") @PreAuthorize("@ss.hasPermi('manage:servicewaycontent:edit')")
@Log(title = "服务方式内容", businessType = BusinessType.UPDATE) @Log(title = "服务方式内容", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ServiceWayContent serviceWayContent) { public AjaxResult edit(@RequestBody ServiceWayContentEditDTO serviceWayContentEditDTO) {
return toAjax(serviceWayContentService.updateServiceWayContent(serviceWayContent)); return toAjax(serviceWayContentService.updateServiceWayContent(serviceWayContentEditDTO));
} }
/** /**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,7 +1,9 @@
package com.xinelu.manage.mapper.servicewaycontent; package com.xinelu.manage.mapper.servicewaycontent;
import com.xinelu.manage.domain.servicewaycontent.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.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
@ -65,14 +67,17 @@ public interface ServiceWayContentMapper {
public int deleteServiceWayContentByIds(Long[] ids); public int deleteServiceWayContentByIds(Long[] ids);
/** /**
* 查询服务方式名称 * 查询服务方式列表
*
* @param serviceWayName * @param serviceWayName
* @param id
* @return * @return
*/ */
List<ServiceWayContentAndNumVO> selectListNum(@Param("serviceWayName") String serviceWayName); List<ServiceWayContentAndNumVO> selectListNum(@Param("serviceWayName") String serviceWayName, @Param("id") Long id);
/** /**
* 查询服务方式内容列表 * 查询服务方式内容列表
*
* @param serviceWayContentDTO * @param serviceWayContentDTO
* @return * @return
*/ */
@ -80,6 +85,7 @@ public interface ServiceWayContentMapper {
/** /**
* 根据服务频次id查询服务内容和服务频次 * 根据服务频次id查询服务内容和服务频次
*
* @param id * @param id
* @return * @return
*/ */
@ -87,8 +93,54 @@ public interface ServiceWayContentMapper {
/** /**
* 根据服务频次id和服务内容id删除服务内容 * 根据服务频次id和服务内容id删除服务内容
*
* @param serviceWayContentRemoveDTO * @param serviceWayContentRemoveDTO
* @return * @return
*/ */
int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO); 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);
} }

View File

@ -1,7 +1,9 @@
package com.xinelu.manage.service.servicewaycontent; package com.xinelu.manage.service.servicewaycontent;
import com.xinelu.manage.domain.servicewaycontent.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.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
@ -34,18 +36,18 @@ public interface IServiceWayContentService {
/** /**
* 新增服务方式内容 * 新增服务方式内容
* *
* @param serviceWayContent 服务方式内容 * @param serviceWayContentAddDTO 服务方式内容
* @return 结果 * @return 结果
*/ */
public int insertServiceWayContent(ServiceWayContent serviceWayContent); public int insertServiceWayContent(ServiceWayContentAddDTO serviceWayContentAddDTO);
/** /**
* 修改服务方式内容 * 修改服务方式内容
* *
* @param serviceWayContent 服务方式内容 * @param serviceWayContentEditDTO 服务方式内容
* @return 结果 * @return 结果
*/ */
public int updateServiceWayContent(ServiceWayContent serviceWayContent); public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO);
/** /**
* 批量删除服务方式内容 * 批量删除服务方式内容
@ -64,16 +66,46 @@ public interface IServiceWayContentService {
public int deleteServiceWayContentById(Long id); public int deleteServiceWayContentById(Long id);
/** /**
* 查询服务方式和记录数 * 查询服务方式列表
* @param serviceWayName * @param serviceWayName
* @param id
* @return * @return
*/ */
List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName); List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName, Long id);
/** /**
* 根据服务频次id和服务内容id删除服务内容 * 根据服务频次id和服务内容id删除服务内容
*
* @param serviceWayContentRemoveDTO * @param serviceWayContentRemoveDTO
* @return * @return
*/ */
int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO); 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);
} }

View File

@ -1,13 +1,19 @@
package com.xinelu.manage.service.servicewaycontent.impl; 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.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.manage.domain.servicewaycontent.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.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentEditDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO; import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.mapper.servicewaycontent.ServiceWayContentMapper; import com.xinelu.manage.mapper.servicewaycontent.ServiceWayContentMapper;
import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService; import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO; import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
import com.xinelu.system.mapper.SysDictDataMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -24,6 +30,9 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
@Resource @Resource
private ServiceWayContentMapper serviceWayContentMapper; private ServiceWayContentMapper serviceWayContentMapper;
@Resource
private SysDictDataMapper sysDictDataMapper;
/** /**
* 查询服务方式内容 * 查询服务方式内容
* *
@ -49,25 +58,61 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
/** /**
* 新增服务方式内容 * 新增服务方式内容
* *
* @param serviceWayContent 服务方式内容 * @param serviceWayContentAddDTO 服务方式内容
* @return 结果 * @return 结果
*/ */
@Override @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()); 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 结果 * @return 结果
*/ */
@Override @Override
public int updateServiceWayContent(ServiceWayContent serviceWayContent) { public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO) {
serviceWayContent.setUpdateTime(DateUtils.getNowDate()); // 判断同一服务内容下服务频次是否存在
return serviceWayContentMapper.updateServiceWayContent(serviceWayContent); if (serviceWayContentMapper.countByEditDTO(serviceWayContentEditDTO) <= 0) {
throw new ServiceException("当前服务内容下服务频次已存在");
}
// TODO
// 如果存在则提示该服务内容下服务频次已存在
// 如果不存在修改服务频次
return 1;
} }
/** /**
@ -93,14 +138,15 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
} }
/** /**
* 查询服务方式和记录数 * 查询服务方式列表
* *
* @param serviceWayName * @param serviceWayName
* @param id
* @return * @return
*/ */
@Override @Override
public List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName) { public List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName, Long id) {
return serviceWayContentMapper.selectListNum(serviceWayName); return serviceWayContentMapper.selectListNum(serviceWayName, id);
} }
/** /**
@ -113,4 +159,72 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
public int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO) { public int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO) {
return serviceWayContentMapper.deleteByFrequencyIdAndContentId(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);
}
} }

View File

@ -107,13 +107,22 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="selectListNum" resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO"> <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 SELECT
service_way_content swc2 on swc1.id = swc2.service_way_id swc1.id,
left join service_way_content swc3 on swc2.id =swc3.service_content_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> <where>
swc1.service_type = 'SERVICE_WRY' swc1.service_type = 'SERVICE_WRY'
and swc2.service_type = 'SERVICE_CONTENT' <if test="id != null">
and swc3.service_type = 'SERVICE_FREQUENCY' and swc1.id =
#{id}
</if>
<if test="serviceWayName != null and serviceWayName != ''"> <if test="serviceWayName != null and serviceWayName != ''">
and swc1.service_way_name like concat('%', and swc1.service_way_name like concat('%',
#{serviceWayName}, #{serviceWayName},
@ -121,6 +130,7 @@
) )
</if> </if>
</where> </where>
Group By swc1.id
</select> </select>
<select id="selectServiceWayContentListV1" <select id="selectServiceWayContentListV1"
resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO"> resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO">
@ -136,7 +146,7 @@
swc1.service_type = 'SERVICE_CONTENT' swc1.service_type = 'SERVICE_CONTENT'
and swc2.service_type = 'SERVICE_FREQUENCY' and swc2.service_type = 'SERVICE_FREQUENCY'
<if test="serviceWayId != null "> <if test="serviceWayId != null ">
and service_way_id = and swc1.service_way_id =
#{serviceWayId} #{serviceWayId}
</if> </if>
<if test="serviceContent != null and serviceContent != ''"> <if test="serviceContent != null and serviceContent != ''">
@ -165,6 +175,95 @@
AND swc1.id = #{id} AND swc1.id = #{id}
</select> </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" <insert id="insertServiceWayContent" parameterType="ServiceWayContent" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
@ -293,6 +392,60 @@
</trim> </trim>
where id = #{id} where id = #{id}
</update> </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 id="deleteServiceWayContentById" parameterType="Long">
delete delete
@ -314,4 +467,10 @@
and service_content_id = #{serviceContentId} and service_content_id = #{serviceContentId}
and service_type = 'SERVICE_FREQUENCY' and service_type = 'SERVICE_FREQUENCY'
</delete> </delete>
<delete id="deleteServiceWayById" parameterType="java.lang.Long">
delete
from service_way_content
where service_type = 'SERVICE_CONTENT'
and id = #{id}
</delete>
</mapper> </mapper>

View File

@ -92,4 +92,11 @@ public interface SysDictDataMapper {
* @return 结果 * @return 结果
*/ */
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
/**
* 根据服务方式名称查询dictCode
* @param serviceWayName
* @return
*/
Long selectDictCodeByName(String serviceWayName);
} }

View File

@ -59,6 +59,9 @@
<select id="countDictDataByType" resultType="Integer"> <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>
<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 id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode} delete from sys_dict_data where dict_code = #{dictCode}