cloudroam
2025-01-07 1d0fc6126fb664e81a1a3737d8eaf4a618e7cb0f
src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java
@@ -1,13 +1,20 @@
package com.mzl.flower.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.config.security.SecurityUtils;
import com.mzl.flower.dto.request.configParam.ParamGroupDTO;
import com.mzl.flower.dto.request.configParam.QueryConfigParamDTO;
import com.mzl.flower.dto.request.configParam.QueryConfigParamGroupDTO;
import com.mzl.flower.dto.response.configParam.ConfigParamGroupVO;
import com.mzl.flower.dto.response.configParam.ConfigParamVO;
import com.mzl.flower.entity.configParam.ConfigParamDO;
import com.mzl.flower.entity.configParam.ConfigParamGroupDO;
import com.mzl.flower.mapper.configParam.ConfigParamGroupMapper;
import com.mzl.flower.mapper.configParam.ConfigParamGroupMapperCustom;
import com.mzl.flower.service.ConfigParamGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,6 +34,9 @@
    @Autowired
    private ConfigParamGroupMapperCustom configParamGroupMapperCustom;
    @Autowired
    private ConfigParamGroupMapper configParamGroupMapper;
    @Override
    public List<ConfigParamGroupDO> getList(QueryConfigParamDTO dto) {
        QueryWrapper<ConfigParamGroupDO> wrapper = new QueryWrapper<>();
@@ -34,4 +44,32 @@
                .orderByAsc(ConfigParamGroupDO::getParamOrder);
        return list(wrapper);
    }
    @Override
    public void saveConfigParamGroup(ParamGroupDTO dto) {
        ConfigParamGroupDO configParamGroupDO = new ConfigParamGroupDO();
        BeanUtils.copyProperties(dto, configParamGroupDO);
        configParamGroupDO.create(SecurityUtils.getUserId());
        configParamGroupMapper.insert(configParamGroupDO);
    }
    @Override
    public void updateConfigParamGroup(ParamGroupDTO dto) {
        ConfigParamGroupDO configParamGroupDO = configParamGroupMapper.selectById(dto.getId());
        BeanUtils.copyProperties(dto, configParamGroupDO);
        configParamGroupDO.update(SecurityUtils.getUserId());
        configParamGroupMapper.updateById(configParamGroupDO);
    }
    @Override
    public void deleteConfigParamGroup(Long id) {
        configParamGroupMapper.deleteById(id);
    }
    @Override
    public Page<ConfigParamGroupVO> queryPage(QueryConfigParamGroupDTO dto, Page page) {
        List<ConfigParamGroupVO> list = configParamGroupMapper.queryPage(dto, page);
        page.setRecords(list);
        return page;
    }
}