package cn.iocoder.yudao.module.museum.service.museuminfo;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoPageReqVO;
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoRespVO;
import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
import cn.iocoder.yudao.module.museum.dal.mysql.museuminfo.MuseumInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.singleton;

@Service
public  class  MuseumInfoServiceImpl implements MuseumInfoService {

   @Resource
   private MuseumInfoMapper museumInfoMapper;

   /**
    * 新增标本
    */
   @Override
   public Integer createMuseumInfo(MuseumInfoSaveVO saveVO) {
      return museumInfoMapper.insert(BeanUtils.toBean(saveVO, MuseumInfoDO.class));//insert(内置)
   }

   /**
    * 更新标本
    */
   @Override
   public void updateMuseumInfo(MuseumInfoSaveVO saveVO) {
      museumInfoMapper.updateMuseumInfo(BeanUtils.toBean(saveVO, MuseumInfoDO.class));
   }

   /**
    * 删除标本
    */
   @Override
   public void deleteMuseumInfo(Integer id,String reason) {
      museumInfoMapper.deleteMuseumInfo(id,reason);
//      museumInfoMapper.deleteById(id);
   }
   /**
    * 删除标本
    */

   /**
    * 查询标本id
    */
   @Override
   public MuseumInfoDO selectMuseumInfo(Integer id) {
      return museumInfoMapper.selectMuseumInfoById(id);
   }

   /**
    * 查询标本编号
    */
   @Override
   public MuseumInfoDO getMuseumInfoBySampleId (String sampleId) {
      return museumInfoMapper.getMuseumInfoBySampleId(sampleId);
   }
   /**
    * 查询标本类型
    */
   @Override
   public List<MuseumInfoDO> selectMuseumInfoListBySampleType(Integer sampleType){
      return museumInfoMapper.selectMuseumInfoListBySampleType(sampleType);
   }
   /**
   * 分页列表
    */
   @Override
   public PageResult<MuseumInfoDO> getMuseumInfoPage(MuseumInfoPageReqVO pageReqVO){
      return museumInfoMapper.selectPage(pageReqVO);
   }
   /**
    * 标本类型计数
    * */
   @Override
   public Map<MuseumInfoRespVO,Integer> MuseumInfoBySampleType(Integer sampleType){
      return museumInfoMapper.countMuseumInfoBySampleType(sampleType);
   }
   /**
    * 标本出入库状态计数
    * */
   @Override
   public Map<String,Integer> MuseumInfoBySave(Integer save) {
      return museumInfoMapper.countMuseumInfoBySave(save);
   }
}


