From f76b3b27279df0cbc4a8a212182382c9f694d1cb Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期四, 02 一月 2025 15:00:27 +0800 Subject: [PATCH] add:客服配置 --- src/main/java/com/mzl/flower/mapper/configParam/ConfigCustomerServiceMapper.java | 26 +++++ src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceDTO.java | 26 +++++ src/main/java/com/mzl/flower/entity/configParam/ConfigCustomerService.java | 35 +++++++ src/main/java/com/mzl/flower/service/config/impl/ConfigCustomerServiceServiceImpl.java | 62 ++++++++++++ src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceQueryDTO.java | 11 ++ src/main/java/com/mzl/flower/dto/response/configParam/ConfigCustomerServiceVO.java | 25 +++++ src/main/resources/mapper/configParam/ConfigCustomerServiceMapper.xml | 15 +++ src/main/java/com/mzl/flower/service/config/ConfigCustomerServiceService.java | 22 ++++ src/main/java/com/mzl/flower/web/v2/configParam/ConfigCustomerServiceController.java | 62 ++++++++++++ 9 files changed, 284 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceDTO.java b/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceDTO.java new file mode 100644 index 0000000..8eb14aa --- /dev/null +++ b/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceDTO.java @@ -0,0 +1,26 @@ +package com.mzl.flower.dto.request.configParam; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ConfigCustomerServiceDTO { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("图标内容") + private String iconContent; + + @ApiModelProperty("图标地址") + private String iconUrl; + + @ApiModelProperty("微信号") + private String weixin; +} diff --git a/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceQueryDTO.java b/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceQueryDTO.java new file mode 100644 index 0000000..5bd90ce --- /dev/null +++ b/src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceQueryDTO.java @@ -0,0 +1,11 @@ +package com.mzl.flower.dto.request.configParam; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ConfigCustomerServiceQueryDTO { + + @ApiModelProperty(value = "会员等级名称") + private String name; +} diff --git a/src/main/java/com/mzl/flower/dto/response/configParam/ConfigCustomerServiceVO.java b/src/main/java/com/mzl/flower/dto/response/configParam/ConfigCustomerServiceVO.java new file mode 100644 index 0000000..3e7acb2 --- /dev/null +++ b/src/main/java/com/mzl/flower/dto/response/configParam/ConfigCustomerServiceVO.java @@ -0,0 +1,25 @@ +package com.mzl.flower.dto.response.configParam; + +import com.mzl.flower.base.AbstractTransDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ConfigCustomerServiceVO extends AbstractTransDTO { + private Long id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("图标内容") + private String iconContent; + + @ApiModelProperty("图标地址") + private String iconUrl; + + @ApiModelProperty("微信号") + private String weixin; +} diff --git a/src/main/java/com/mzl/flower/entity/configParam/ConfigCustomerService.java b/src/main/java/com/mzl/flower/entity/configParam/ConfigCustomerService.java new file mode 100644 index 0000000..3b90edd --- /dev/null +++ b/src/main/java/com/mzl/flower/entity/configParam/ConfigCustomerService.java @@ -0,0 +1,35 @@ +package com.mzl.flower.entity.configParam; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.mzl.flower.base.BaseAutoEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * @author fanghaowei + * @version version2.0 + * @className ConfigCustomerService + * @date 2024/8/26 + * @description + */ +@Data +@TableName("t_config_customer_service") +public class ConfigCustomerService extends BaseAutoEntity { + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("图标内容") + private String iconContent; + + @ApiModelProperty("图标地址") + private String iconUrl; + + @ApiModelProperty("微信号") + private String weixin; + +} diff --git a/src/main/java/com/mzl/flower/mapper/configParam/ConfigCustomerServiceMapper.java b/src/main/java/com/mzl/flower/mapper/configParam/ConfigCustomerServiceMapper.java new file mode 100644 index 0000000..6d753f1 --- /dev/null +++ b/src/main/java/com/mzl/flower/mapper/configParam/ConfigCustomerServiceMapper.java @@ -0,0 +1,26 @@ +package com.mzl.flower.mapper.configParam; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceQueryDTO; +import com.mzl.flower.dto.response.configParam.ConfigCustomerServiceVO; +import com.mzl.flower.entity.configParam.ConfigCustomerService; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +/** + * @author fanghaowei + * @version version2.0 + * @className ConfigCustomerServiceMapper + * @date 2024/8/26 + * @description ConfigCustomerServiceMapper + */ +@SuppressWarnings("ALL") +@Repository +public interface ConfigCustomerServiceMapper extends BaseMapper<ConfigCustomerService> { + + List<ConfigCustomerServiceVO> queryPage(@Param("dto") ConfigCustomerServiceQueryDTO configCustomerServiceQueryDTO, Page page); +} diff --git a/src/main/java/com/mzl/flower/service/config/ConfigCustomerServiceService.java b/src/main/java/com/mzl/flower/service/config/ConfigCustomerServiceService.java new file mode 100644 index 0000000..2ef3776 --- /dev/null +++ b/src/main/java/com/mzl/flower/service/config/ConfigCustomerServiceService.java @@ -0,0 +1,22 @@ +package com.mzl.flower.service.config; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceDTO; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceQueryDTO; +import com.mzl.flower.dto.response.configParam.ConfigCustomerServiceVO; +import com.mzl.flower.entity.configParam.ConfigCustomerService; + + +public interface ConfigCustomerServiceService extends IService<ConfigCustomerService> { + + void saveConfigCustomerService(ConfigCustomerServiceDTO configCustomerServiceDTO); + + void updateConfigCustomerService(ConfigCustomerServiceDTO configCustomerServiceDTO); + + void deleteConfigCustomerService(String id); + + Page<ConfigCustomerServiceVO> queryPage(ConfigCustomerServiceQueryDTO configCustomerServiceQueryDTO, Page page); + +} diff --git a/src/main/java/com/mzl/flower/service/config/impl/ConfigCustomerServiceServiceImpl.java b/src/main/java/com/mzl/flower/service/config/impl/ConfigCustomerServiceServiceImpl.java new file mode 100644 index 0000000..9d7edb9 --- /dev/null +++ b/src/main/java/com/mzl/flower/service/config/impl/ConfigCustomerServiceServiceImpl.java @@ -0,0 +1,62 @@ +package com.mzl.flower.service.config.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mzl.flower.config.security.SecurityUtils; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceDTO; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceQueryDTO; +import com.mzl.flower.dto.response.configParam.ConfigCustomerServiceVO; +import com.mzl.flower.entity.configParam.ConfigCustomerService; +import com.mzl.flower.mapper.configParam.ConfigCustomerServiceMapper; +import com.mzl.flower.service.config.ConfigCustomerServiceService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author fanghaowei + * @version version2.0 + * @className ConfigCustomerServiceServiceImpl + * @date 2024/8/26 + * @description 配置客户管理功能逻辑层 + */ +@Service +@Transactional +@RequiredArgsConstructor +public class ConfigCustomerServiceServiceImpl extends ServiceImpl<ConfigCustomerServiceMapper, ConfigCustomerService> implements ConfigCustomerServiceService { + + private final ConfigCustomerServiceMapper configCustomerServiceMapper; + + @Override + public void saveConfigCustomerService(ConfigCustomerServiceDTO configCustomerServiceDTO) { + ConfigCustomerService configCustomerService = new ConfigCustomerService(); + BeanUtils.copyProperties(configCustomerServiceDTO, configCustomerService); + configCustomerService.create(SecurityUtils.getUserId()); + configCustomerServiceMapper.insert(configCustomerService); + + } + + @Override + public void updateConfigCustomerService(ConfigCustomerServiceDTO configCustomerServiceDTO) { + ConfigCustomerService configCustomerServiceInfo = configCustomerServiceMapper.selectById(configCustomerServiceDTO.getId()); + BeanUtils.copyProperties(configCustomerServiceDTO, configCustomerServiceInfo); + configCustomerServiceInfo.update(SecurityUtils.getUserId()); + configCustomerServiceMapper.updateById(configCustomerServiceInfo); + + } + + @Override + public void deleteConfigCustomerService(String id) { + configCustomerServiceMapper.deleteById(id); + } + + @Override + public Page<ConfigCustomerServiceVO> queryPage(ConfigCustomerServiceQueryDTO configCustomerServiceQueryDTO, Page page) { + List<ConfigCustomerServiceVO> list = configCustomerServiceMapper.queryPage(configCustomerServiceQueryDTO, page); + page.setRecords(list); + return page; + } +} diff --git a/src/main/java/com/mzl/flower/web/v2/configParam/ConfigCustomerServiceController.java b/src/main/java/com/mzl/flower/web/v2/configParam/ConfigCustomerServiceController.java new file mode 100644 index 0000000..e6494ab --- /dev/null +++ b/src/main/java/com/mzl/flower/web/v2/configParam/ConfigCustomerServiceController.java @@ -0,0 +1,62 @@ +package com.mzl.flower.web.v2.configParam; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mzl.flower.base.BaseController; +import com.mzl.flower.base.R; +import com.mzl.flower.base.ReturnDataDTO; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceDTO; +import com.mzl.flower.dto.request.configParam.ConfigCustomerServiceQueryDTO; +import com.mzl.flower.dto.response.configParam.ConfigCustomerServiceVO; +import com.mzl.flower.service.config.ConfigCustomerServiceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; + +/** + * @author fanghaowei + * @version version2.0 + * @className ConfigCustomerServiceController + * @date 2024/8/26 + * @description 客服配置管理功能开发 + */ +@Api(value = "客服配置管理", tags = "客服配置管理") +@RestController +@RequestMapping("/api") +@RequiredArgsConstructor +public class ConfigCustomerServiceController extends BaseController { + + private final ConfigCustomerServiceService configCustomerServiceService; + + @GetMapping("/configCustomer/list") + @ApiOperation(value = "客服配置列表", httpMethod = "GET") + public ResponseEntity<ReturnDataDTO<Page<ConfigCustomerServiceVO>>> getConfigCustomerServiceList(Page page, ConfigCustomerServiceQueryDTO dto) { + return returnData(R.SUCCESS.getCode(), configCustomerServiceService.queryPage(dto, page)); + } + + @GetMapping(value = "/configCustomer/delete") + @ApiOperation(value = "删除客服配置 ", httpMethod = "GET", notes = "ID") + public ResponseEntity delete(@NotNull(message = "id不能为空") Long id) { + configCustomerServiceService.deleteConfigCustomerService(String.valueOf(id)); + return returnData(R.SUCCESS.getCode(), null); + } + + @PostMapping(value = "/configCustomer/new") + @ApiOperation(value = "保存客服配置", httpMethod = "POST") + public ResponseEntity insert(@RequestBody ConfigCustomerServiceDTO configCustomerServiceDTO) { + configCustomerServiceService.saveConfigCustomerService(configCustomerServiceDTO); + return returnData(R.SUCCESS.getCode(), null); + } + + @PostMapping(value = "/configCustomer/edit") + @ApiOperation(value = "更新客服配置", httpMethod = "POST") + public ResponseEntity update(@RequestBody ConfigCustomerServiceDTO configCustomerServiceDTO) { + configCustomerServiceService.updateConfigCustomerService(configCustomerServiceDTO); + return returnData(R.SUCCESS.getCode(), null); + } + +} + diff --git a/src/main/resources/mapper/configParam/ConfigCustomerServiceMapper.xml b/src/main/resources/mapper/configParam/ConfigCustomerServiceMapper.xml new file mode 100644 index 0000000..c438a31 --- /dev/null +++ b/src/main/resources/mapper/configParam/ConfigCustomerServiceMapper.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.mzl.flower.mapper.configParam.ConfigCustomerServiceMapper"> + + + <select id="queryPage" resultType="com.mzl.flower.dto.response.configParam.ConfigCustomerServiceVO"> + select t.*, u.nick_name createName from t_config_customer_service t + left join t_user u on t.create_by = u.id + where t.deleted= 0 + <if test="dto.name != null and dto.name != ''"> + and t.name like concat('%', #{dto.name}, '%') + </if> + </select> + +</mapper> -- Gitblit v1.9.3