package bus.service.impl;

import bus.model.dto.BRegionDto;
import bus.model.dto.BRegionPageDto;
import bus.model.vo.BRegionVo;
import bus.model.po.BRegionPo;
import bus.mapper.BRegionMapper;

import bus.service.BRegionService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
import java.util.List;

/**
 * @Program: bus
 * @Description: 描述
 * @Author: zy
 * @Date: 2025-03-01 18:02:30
 **/
@Service
public class BRegionServiceImpl implements BRegionService {

    @Autowired
    private BRegionMapper bRegionMapper;


	/**
     * 详情
     * @param id
     * @return
     */
    @Override
    public BRegionPo getDetailById(String id){
        return this.bRegionMapper.selectById(id);
    }

	/**
     * 保存
     * @param dto
     * @return
     */
    @Override
	public void save(BRegionDto dto){
        BRegionPo po = new BRegionPo();
        BeanUtils.copyProperties(dto,po);
		this.bRegionMapper.insert(po);
    }

    /**
    * 列表
    * @param dto
    * @return
    */
    @Override
    public List<BRegionDto> list(BRegionPageDto dto){
        return this.bRegionMapper.list(dto);
    }

	/**
     * 修改
     * @param dto
     * @return
     */
    @Override
    public void update(BRegionDto dto){
        BRegionPo po = new BRegionPo();
        BeanUtils.copyProperties(dto,po);
		bRegionMapper.updateById(po);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public void delete(String id){
		bRegionMapper.deleteById(id);
    }
}
