package com.doumee.service.system.impl; 
 | 
  
 | 
import com.github.pagehelper.PageHelper; 
 | 
import com.github.pagehelper.PageInfo; 
 | 
import com.doumee.service.business.third.model.PageData; 
 | 
import com.doumee.service.business.third.model.PageWrap; 
 | 
import com.doumee.dao.system.SystemDictMapper; 
 | 
import com.doumee.dao.system.dto.QuerySystemDictDTO; 
 | 
import com.doumee.dao.system.model.SystemDict; 
 | 
import com.doumee.dao.system.vo.SystemDictListVO; 
 | 
import com.doumee.service.system.SystemDictService; 
 | 
import com.baomidou.mybatisplus.core.conditions.Wrapper; 
 | 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.stereotype.Service; 
 | 
import org.springframework.transaction.annotation.Transactional; 
 | 
import org.springframework.util.CollectionUtils; 
 | 
  
 | 
import java.util.List; 
 | 
  
 | 
/** 
 | 
 * 字典Service实现 
 | 
 * @author Eva.Caesar Liu 
 | 
 * @date 2023/03/21 14:49 
 | 
 */ 
 | 
@Service 
 | 
public class SystemDictServiceImpl implements SystemDictService { 
 | 
  
 | 
    @Autowired 
 | 
    private SystemDictMapper systemDictMapper; 
 | 
  
 | 
    @Override 
 | 
    public Integer create(SystemDict systemDict) { 
 | 
        systemDictMapper.insert(systemDict); 
 | 
        return systemDict.getId(); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public void deleteById(Integer id) { 
 | 
        SystemDict systemDict = new SystemDict(); 
 | 
        systemDict.setId(id); 
 | 
        systemDict.setDeleted(Boolean.TRUE); 
 | 
        this.updateById(systemDict); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    @Transactional 
 | 
    public void deleteByIdInBatch(List<Integer> ids) { 
 | 
        if (CollectionUtils.isEmpty(ids)) return; 
 | 
        for (Integer id : ids) { 
 | 
            this.deleteById(id); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public void updateById(SystemDict systemDict) { 
 | 
        systemDictMapper.updateById(systemDict); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    @Transactional 
 | 
    public void updateByIdInBatch(List<SystemDict> systemDicts) { 
 | 
        if (CollectionUtils.isEmpty(systemDicts)) return; 
 | 
        for (SystemDict systemDict: systemDicts) { 
 | 
            this.updateById(systemDict); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public SystemDict findById(Integer id) { 
 | 
        return systemDictMapper.selectById(id); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public SystemDict findOne(SystemDict systemDict) { 
 | 
        Wrapper<SystemDict> wrapper = new QueryWrapper<>(systemDict); 
 | 
        return systemDictMapper.selectOne(wrapper); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public List<SystemDict> findList(SystemDict systemDict) { 
 | 
        Wrapper<SystemDict> wrapper = new QueryWrapper<>(systemDict); 
 | 
        return systemDictMapper.selectList(wrapper); 
 | 
    } 
 | 
   
 | 
    @Override 
 | 
    public PageData<SystemDictListVO> findPage(PageWrap<QuerySystemDictDTO> pageWrap) { 
 | 
        PageHelper.startPage(pageWrap.getPage(), pageWrap.getCapacity()); 
 | 
        return PageData.from(new PageInfo<>(systemDictMapper.selectManageList(pageWrap.getModel(), pageWrap.getOrderByClause()))); 
 | 
    } 
 | 
  
 | 
    @Override 
 | 
    public long count(SystemDict systemDict) { 
 | 
        Wrapper<SystemDict> wrapper = new QueryWrapper<>(systemDict); 
 | 
        return systemDictMapper.selectCount(wrapper); 
 | 
    } 
 | 
} 
 |