package com.iailab.module.model.mcs.pre.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.collection.CollectionUtils;
|
import com.iailab.module.model.mcs.pre.dao.MmItemTypeDao;
|
import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity;
|
import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity;
|
import com.iailab.module.model.mcs.pre.service.MmItemTypeService;
|
import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.*;
|
|
/**
|
* @author PanZhibao
|
* @date 2021年04月23日 15:29
|
*/
|
@Service
|
public class MmItemTypeImpl extends ServiceImpl<MmItemTypeDao, MmItemTypeEntity> implements MmItemTypeService {
|
|
@Autowired
|
private MmItemTypeDao mmItemTypeDao;
|
|
@Override
|
public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) {
|
return mmItemTypeDao.selectPage(reqVO);
|
}
|
|
@Override
|
public void saveItemType(MmItemTypeEntity itemType) {
|
itemType.setId(UUID.randomUUID().toString());
|
mmItemTypeDao.insert(itemType);
|
}
|
|
@Override
|
public void update(MmItemTypeEntity itemType) {
|
mmItemTypeDao.updateById(itemType);
|
}
|
|
@Override
|
public void deleteBatch(String[] moduleIds) {
|
mmItemTypeDao.deleteBatchIds(Arrays.asList(moduleIds));
|
}
|
|
@Override
|
public int check(MmItemTypeEntity itemType) {
|
String id = itemType.getId();
|
String itemtypename = itemType.getItemtypename();
|
QueryWrapper<MmItemTypeEntity> moduleWrapper = new QueryWrapper();
|
moduleWrapper.ne(StringUtils.isNotBlank(id), "id", id);
|
moduleWrapper.and(wrapper -> wrapper.eq("itemtypename",itemtypename));
|
List<MmItemTypeEntity> list = mmItemTypeDao.selectList(moduleWrapper);
|
return list.size();
|
}
|
|
@Override
|
public MmItemTypeEntity getItemTypeByItemId(String itemId) {
|
List<MmItemTypeEntity> list = mmItemTypeDao.getItemTypeByItemId(itemId);
|
if (CollectionUtils.isAnyEmpty(list)) {
|
return null;
|
}
|
return list.get(0);
|
}
|
|
@Override
|
public MmItemTypeEntity info(String id) {
|
return mmItemTypeDao.selectById(id);
|
}
|
|
@Override
|
public List<MmItemTypeEntity> list(Map<String, Object> params) {
|
return mmItemTypeDao.selectList(new QueryWrapper<>());
|
}
|
}
|