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 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 queryPage(ConfigCustomerServiceQueryDTO configCustomerServiceQueryDTO, Page page) { List list = configCustomerServiceMapper.queryPage(configCustomerServiceQueryDTO, page); page.setRecords(list); return page; } }