package com.iailab.module.model.mpk.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.util.object.ConvertUtils;
|
import com.iailab.module.model.mpk.dao.FileMenuDao;
|
import com.iailab.module.model.mpk.dto.FileMenuDTO;
|
import com.iailab.module.model.mpk.entity.FileMenuEntity;
|
import com.iailab.module.model.mpk.service.FileGroupService;
|
import com.iailab.module.model.mpk.service.FileMenuService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.UUID;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年09月22日
|
*/
|
@Slf4j
|
@Service
|
public class FileMenuServiceImpl implements FileMenuService {
|
|
@Resource
|
private FileMenuDao fileMenuDao;
|
|
@Resource
|
private FileGroupService fileGroupService;
|
|
@Override
|
public List<FileMenuDTO> list() {
|
QueryWrapper<FileMenuEntity> wrapper = new QueryWrapper<>();
|
wrapper.orderByAsc("sort");
|
List<FileMenuDTO> list = ConvertUtils.sourceToTarget(fileMenuDao.selectList(wrapper), FileMenuDTO.class);
|
list.forEach(item -> {
|
item.setGroups(fileGroupService.list(item.getId()));
|
});
|
return list;
|
}
|
|
@Override
|
public FileMenuEntity get(String id) {
|
return fileMenuDao.selectById(id);
|
}
|
|
@Override
|
public void create(FileMenuEntity entity) {
|
entity.setId(UUID.randomUUID().toString());
|
fileMenuDao.insert(entity);
|
}
|
|
@Override
|
public void update(FileMenuEntity entity) {
|
fileMenuDao.updateById(entity);
|
}
|
|
@Override
|
public void deleteById(String id) {
|
fileMenuDao.deleteById(id);
|
}
|
}
|