package com.iailab.module.model.mpk.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.module.model.mpk.dao.PackDao;
|
import com.iailab.module.model.mpk.entity.PackEntity;
|
import com.iailab.module.model.mpk.service.PackService;
|
import com.iailab.module.model.mpk.vo.PackPageReqVO;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.UUID;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年11月05日
|
*/
|
@Slf4j
|
@Service
|
public class PackServiceImpl implements PackService {
|
|
@Autowired
|
private PackDao iconDao;
|
|
@Override
|
public PageResult<PackEntity> page(PackPageReqVO reqVO) {
|
return iconDao.selectPage(reqVO);
|
}
|
|
@Override
|
public List<PackEntity> list() {
|
QueryWrapper<PackEntity> qw = new QueryWrapper<>();
|
qw.orderByAsc("sort");
|
return iconDao.selectList(qw);
|
}
|
|
@Override
|
public Map<String, PackEntity> getNameMap() {
|
Map<String, PackEntity> map = new HashMap<>();
|
QueryWrapper<PackEntity> qw = new QueryWrapper<>();
|
List<PackEntity> list = iconDao.selectList(qw);
|
if (CollectionUtils.isEmpty(list)) {
|
return map;
|
}
|
list.forEach(packEntity -> {
|
map.put(packEntity.getPackName(), packEntity);
|
});
|
return map;
|
}
|
|
@Override
|
public String getModelPath(String packName) {
|
QueryWrapper<PackEntity> qw = new QueryWrapper<>();
|
qw.eq("pack_name", packName);
|
PackEntity packEntity = iconDao.selectOne(qw);
|
|
if (packEntity == null) {
|
return null;
|
}
|
return packEntity.getModelPath();
|
}
|
|
@Override
|
public void create(PackEntity entity) {
|
entity.setId(UUID.randomUUID().toString());
|
iconDao.insert(entity);
|
}
|
|
@Override
|
public void update(PackEntity entity) {
|
iconDao.updateById(entity);
|
}
|
|
@Override
|
public PackEntity get(String id) {
|
return iconDao.selectById(id);
|
}
|
|
@Override
|
public void delete(String id) {
|
iconDao.deleteById(id);
|
}
|
}
|