修改查询服务方式和服务内容接口

This commit is contained in:
youxilong 2024-03-01 11:22:47 +08:00
parent 92f4b9a611
commit 77342ed291
8 changed files with 137 additions and 18 deletions

View File

@ -8,9 +8,12 @@ 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.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.service.servicewaycontent.IServiceWayContentService;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -24,6 +27,7 @@ import java.util.List;
* @author xinelu
* @date 2024-02-29
*/
@Api(tags = "服务方式内容控制器")
@RestController
@RequestMapping("/manage/servicewaycontent")
public class ServiceWayContentController extends BaseController {
@ -33,6 +37,7 @@ public class ServiceWayContentController extends BaseController {
/**
* 查询服务方式内容列表
*/
@ApiOperation("查询服务方式内容列表")
@PreAuthorize("@ss.hasPermi('manage:servicewaycontent:list')")
@GetMapping("/list")
public TableDataInfo list(ServiceWayContentDTO serviceWayContentDTO) {
@ -42,8 +47,9 @@ public class ServiceWayContentController extends BaseController {
}
/**
* 查询服务方式和记录数
* 查询服务方式列表和记录数
*/
@ApiOperation("查询服务方式和记录数")
@GetMapping("/listNum")
public AjaxResult listNum(String serviceWayName) {
List<ServiceWayContentAndNumVO> list = serviceWayContentService.selectListNum(serviceWayName);
@ -54,6 +60,7 @@ public class ServiceWayContentController extends BaseController {
/**
* 导出服务方式内容列表
*/
@ApiOperation("导出服务方式内容列表")
@PreAuthorize("@ss.hasPermi('manage:servicewaycontent:export')")
@Log(title = "服务方式内容", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ -64,8 +71,9 @@ public class ServiceWayContentController extends BaseController {
}
/**
* 获取服务方式内容详细信息
* 根据服务频次id获取服务方式内容详细信息
*/
@ApiOperation("根据服务频次id获取服务方式内容详细信息")
@PreAuthorize("@ss.hasPermi('manage:servicewaycontent:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
@ -93,12 +101,13 @@ public class ServiceWayContentController extends BaseController {
}
/**
* 删除服务方式内容
* 根据服务频次id和服务内容id删除服务内容
*/
@ApiOperation("根据服务频次id和服务内容id删除服务内容")
@PreAuthorize("@ss.hasPermi('manage:servicewaycontent:remove')")
@Log(title = "服务方式内容", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(serviceWayContentService.deleteServiceWayContentByIds(ids));
@DeleteMapping("/remove")
public AjaxResult remove(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO) {
return toAjax(serviceWayContentService.deleteByFrequencyIdAndContentId(serviceWayContentRemoveDTO));
}
}

View File

@ -17,9 +17,10 @@ import lombok.NoArgsConstructor;
public class ServiceWayContentDTO {
/**
* 主键id
* 服务方式id
*/
private Long id;
@ApiModelProperty(value = "服务方式id")
private Long serviceWayId;
/**
* 服务内容名称

View File

@ -0,0 +1,31 @@
package com.xinelu.manage.dto.servicewaycontent;
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 10:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "删除服务方式内容对象DTO")
public class ServiceWayContentRemoveDTO {
/**
* 服务频次id
*/
@ApiModelProperty(value = "服务频次id")
private Long id;
/**
* 服务内容id
*/
@ApiModelProperty(value = "服务内容id")
private String serviceContentId;
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.servicewaycontent;
import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
import org.apache.ibatis.annotations.Param;
@ -76,4 +77,18 @@ public interface ServiceWayContentMapper {
* @return
*/
List<ServiceWayContentVO> selectServiceWayContentListV1(ServiceWayContentDTO serviceWayContentDTO);
/**
* 根据服务频次id查询服务内容和服务频次
* @param id
* @return
*/
ServiceWayContentVO selectServiceWayContentDetailByFrequencyId(Long id);
/**
* 根据服务频次id和服务内容id删除服务内容
* @param serviceWayContentRemoveDTO
* @return
*/
int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO);
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.service.servicewaycontent;
import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentAndNumVO;
import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
@ -20,7 +21,7 @@ public interface IServiceWayContentService {
* @param id 服务方式内容主键
* @return 服务方式内容
*/
public ServiceWayContent selectServiceWayContentById(Long id);
public ServiceWayContentVO selectServiceWayContentById(Long id);
/**
* 查询服务方式内容列表
@ -68,4 +69,11 @@ public interface IServiceWayContentService {
* @return
*/
List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName);
/**
* 根据服务频次id和服务内容id删除服务内容
* @param serviceWayContentRemoveDTO
* @return
*/
int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO);
}

View File

@ -1,9 +1,9 @@
package com.xinelu.manage.service.servicewaycontent.impl;
import com.xinelu.common.enums.ServiceWayContentServiceType;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.servicewaycontent.ServiceWayContent;
import com.xinelu.manage.dto.servicewaycontent.ServiceWayContentDTO;
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;
@ -11,7 +11,6 @@ import com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -32,12 +31,13 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
* @return 服务方式内容
*/
@Override
public ServiceWayContent selectServiceWayContentById(Long id) {
return serviceWayContentMapper.selectServiceWayContentById(id);
public ServiceWayContentVO selectServiceWayContentById(Long id) {
return serviceWayContentMapper.selectServiceWayContentDetailByFrequencyId(id);
}
/**
* 查询服务方式内容列表
*
* @param serviceWayContentDTO 服务方式内容
* @return
*/
@ -102,4 +102,15 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
public List<ServiceWayContentAndNumVO> selectListNum(String serviceWayName) {
return serviceWayContentMapper.selectListNum(serviceWayName);
}
/**
* 根据服务频次id和服务内容id删除服务内容
*
* @param serviceWayContentRemoveDTO
* @return
*/
@Override
public int deleteByFrequencyIdAndContentId(ServiceWayContentRemoveDTO serviceWayContentRemoveDTO) {
return serviceWayContentMapper.deleteByFrequencyIdAndContentId(serviceWayContentRemoveDTO);
}
}

View File

@ -17,9 +17,10 @@ import lombok.NoArgsConstructor;
@ApiModel(value = "服务方式内容VO")
public class ServiceWayContentVO {
/**
* 主键id
* 服务内容id
*/
private Long id;
@ApiModelProperty(value = "服务内容id")
private Long serviceContentId;
/**
* 服务内容
@ -28,6 +29,18 @@ public class ServiceWayContentVO {
@Excel(name = "服务内容")
private String serviceContent;
/**
* 服务频次id
*/
@ApiModelProperty(value = "服务频次id")
private Long serviceFrequencyId;
/**
* 服务频次类型
*/
@ApiModelProperty(value = "服务频次类型")
private String serviceFrequencyType;
/**
* 服务频次文本
*/

View File

@ -124,16 +124,21 @@
</select>
<select id="selectServiceWayContentListV1"
resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO">
SELECT swc1.id,swc1.service_content,
SELECT swc1.id AS serviceContentId,swc1.service_content,
swc2.id AS serviceFrequencyId,
swc2.service_frequency_type,
swc2.service_frequency_text,
swc2.service_frequency_start,
swc2.service_frequency_end
FROM service_way_content swc1
LEFT JOIN service_way_content swc2 on swc1.id = swc2.service_content_id
<where>
swc1.service_way_id = #{id}
and swc1.service_type = 'SERVICE_CONTENT'
swc1.service_type = 'SERVICE_CONTENT'
and swc2.service_type = 'SERVICE_FREQUENCY'
<if test="serviceWayId != null ">
and service_way_id =
#{serviceWayId}
</if>
<if test="serviceContent != null and serviceContent != ''">
and swc1.service_content like concat('%',
#{serviceContent},
@ -143,6 +148,24 @@
</where>
</select>
<select id="selectServiceWayContentDetailByFrequencyId"
resultType="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO"
parameterType="java.lang.Long">
SELECT swc2.id AS serviceContentId,
swc2.service_content,
swc1.id AS serviceFrequencyId,
swc1.service_frequency_type,
swc1.service_frequency_text,
swc1.service_frequency_start,
swc1.service_frequency_end
FROM service_way_content swc1
LEFT JOIN service_way_content swc2 ON swc1.service_content_id = swc2.id
WHERE swc1.service_type = 'SERVICE_FREQUENCY'
AND swc2.service_type = 'SERVICE_CONTENT'
AND swc1.id = #{id}
</select>
<insert id="insertServiceWayContent" parameterType="ServiceWayContent" useGeneratedKeys="true"
keyProperty="id">
insert into service_way_content
@ -283,4 +306,12 @@
#{id}
</foreach>
</delete>
<delete id="deleteByFrequencyIdAndContentId"
parameterType="com.xinelu.manage.dto.servicewaycontent.ServiceWayContentRemoveDTO">
DELETE
FROM service_way_content
WHERE id = #{id}
and service_content_id = #{serviceContentId}
and service_type = 'SERVICE_FREQUENCY'
</delete>
</mapper>