cloudroam
2025-01-02 f76b3b27279df0cbc4a8a212182382c9f694d1cb
add:客服配置
已添加9个文件
284 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/configParam/ConfigCustomerServiceQueryDTO.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/configParam/ConfigCustomerServiceVO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/entity/configParam/ConfigCustomerService.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/mapper/configParam/ConfigCustomerServiceMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/config/ConfigCustomerServiceService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/config/impl/ConfigCustomerServiceServiceImpl.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/v2/configParam/ConfigCustomerServiceController.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/configParam/ConfigCustomerServiceMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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;
}
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;
}
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;
}
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);
}
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);
}
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;
    }
}
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);
    }
}
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>