package bus.service.impl;

import bus.model.dto.BTestDto;
import bus.model.dto.page.BTestPageDto;
import bus.model.vo.BTestVo;
import bus.model.po.BTestPo;
import bus.mapper.BTestMapper;

import bus.service.BTestService;
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: bus
 * @Date: 2025-02-24 14:39:33
 **/
@Service
public class BTestServiceImpl implements BTestService {

    @Autowired
    private BTestMapper bTestMapper;


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

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

    /**
    * 列表
    * @param dto
    * @return
    */
    @Override
    public List<BTestVo> list(BTestPageDto dto){
        return this.bTestMapper.list(dto);
    }

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

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