| package com.mzl.flower.service.payment; | 
|   | 
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
| import com.mzl.flower.config.security.SecurityUtils; | 
| import com.mzl.flower.dto.request.payment.FeeServiceCreateDTO; | 
| import com.mzl.flower.dto.request.payment.FeeServiceUpdateDTO; | 
| import com.mzl.flower.dto.response.payment.FeeServiceDTO; | 
| import com.mzl.flower.entity.payment.FeeService; | 
| import com.mzl.flower.mapper.payment.FeeServiceMapper; | 
| import com.mzl.flower.service.BaseService; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.BeanUtils; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
| import org.springframework.transaction.annotation.Transactional; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| @Slf4j | 
| @Service | 
| @Transactional | 
| public class FeeServiceService extends BaseService { | 
|   | 
|     @Autowired | 
|     private FeeServiceMapper feeServiceMapper; | 
|   | 
|     public Long addConfig(FeeServiceCreateDTO dto){ | 
|         FeeService g = new FeeService(); | 
|   | 
|         BeanUtils.copyProperties(dto, g); | 
|         g.create(SecurityUtils.getUserId()); | 
|   | 
|         feeServiceMapper.insert(g); | 
|   | 
|         return g.getId(); | 
|     } | 
|   | 
|     public Long updateConfig(FeeServiceUpdateDTO dto){ | 
|         Long id = dto.getId(); | 
|         FeeService g = feeServiceMapper.selectById(id); | 
|   | 
|         BeanUtils.copyProperties(dto, g); | 
|         g.update(SecurityUtils.getUserId()); | 
|   | 
|         feeServiceMapper.updateById(g); | 
|   | 
|         return id; | 
|     } | 
|   | 
|     public FeeServiceDTO getConfig(Long id){ | 
|         FeeServiceDTO dto = new FeeServiceDTO(); | 
|         FeeService d = feeServiceMapper.selectById(id); | 
|         BeanUtils.copyProperties(d, dto); | 
|   | 
|         return dto; | 
|     } | 
|   | 
|     public List<FeeServiceDTO> selectConfigList(){ | 
|         List<FeeServiceDTO> ls = new ArrayList<>(); | 
|         List<FeeService> ll = feeServiceMapper.selectList(new QueryWrapper<FeeService>().orderByAsc("lower_num")); | 
|         if(ll != null && ll.size() > 0){ | 
|             for(FeeService pl : ll){ | 
|                 FeeServiceDTO dto = new FeeServiceDTO(); | 
|                 BeanUtils.copyProperties(pl, dto); | 
|                 ls.add(dto); | 
|             } | 
|         } | 
|   | 
|         return ls; | 
|     } | 
|   | 
|     public void deleteConfig(Long id){ | 
|         feeServiceMapper.deleteById(id); | 
|     } | 
|   | 
| } |