| | |
| | | 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.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.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 15:29 |
| | | */ |
| | | @Service("mmItemTypeService") |
| | | public class MmItemTypeImpl extends BaseServiceImpl<MmItemTypeDao, MmItemTypeEntity> implements MmItemTypeService { |
| | | @Service |
| | | public class MmItemTypeImpl extends ServiceImpl<MmItemTypeDao, MmItemTypeEntity> implements MmItemTypeService { |
| | | |
| | | @Autowired |
| | | private MmItemTypeDao mmItemTypeDao; |
| | | |
| | | @Override |
| | | public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<MmItemTypeEntity> getWrapper(Map<String, Object> params) { |
| | | String itemtypename = (String)params.get("itemtypename"); |
| | | |
| | | QueryWrapper<MmItemTypeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(itemtypename),"itemtypename", itemtypename); |
| | | |
| | | return wrapper; |
| | | return mmItemTypeDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveItemType(MmItemTypeEntity itemType) { |
| | | itemType.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(itemType); |
| | | mmItemTypeDao.insert(itemType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmItemTypeEntity itemType) { |
| | | baseDao.updateById(itemType); |
| | | mmItemTypeDao.updateById(itemType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] moduleIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(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<>(); |
| | | QueryWrapper<MmItemTypeEntity> moduleWrapper = new QueryWrapper(); |
| | | moduleWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | moduleWrapper.and(wrapper -> wrapper.eq("itemtypename",itemtypename)); |
| | | List<MmItemTypeEntity> list = baseDao.selectList(moduleWrapper); |
| | | List<MmItemTypeEntity> list = mmItemTypeDao.selectList(moduleWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | public MmItemTypeEntity getById(String itemtypeid) { |
| | | MmItemTypeEntity entity = baseDao.selectById(itemtypeid); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public MmItemTypeEntity getItemTypeByItemId(String itemId) { |
| | | List<MmItemTypeEntity> list = baseDao.getItemTypeByItemId(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 Collections.emptyList(); |
| | | } |
| | | } |