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

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.museum.controller.admin.museumpicture.vo.PictureGroupSaveVO;
import cn.iocoder.yudao.module.museum.dal.database.museumpicture.PictureGroupDO;
import cn.iocoder.yudao.module.museum.dal.mysql.museumpicture.PictureGroupMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public  class PictureGroupServiceImpl implements PictureGroupService {

    @Resource
    private PictureGroupMapper pictureGroupMapper;

    @Override
    public Integer createPictureGroup(PictureGroupSaveVO saveVO){
        return pictureGroupMapper.insert(BeanUtils.toBean(saveVO, PictureGroupDO.class));
    }

    @Override
    public void updatePictureGroup(PictureGroupSaveVO saveVO){
        pictureGroupMapper.updatePictureGroup(BeanUtils.toBean(saveVO,PictureGroupDO.class));
    }

    @Override
    public void deletePictureGroup(Integer id){
//      pictureGroupMapper.deletePictureGroup(id);
        pictureGroupMapper.deleteById(id);
    }

    @Override
    public PictureGroupDO selectPictureGroup(Integer id){
        return pictureGroupMapper.selectPictureGroupById(id);
    }
}