package com.sunxung.factoring.service.businessConsulting.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sunxung.factoring.component.util.BeanUtilsProxy;
import com.sunxung.factoring.entity.BaseSearch;
import com.sunxung.factoring.entity.GridPage;
import com.sunxung.factoring.entity.businessConsulting.BusinessConsultingDO;
import com.sunxung.factoring.entity.businessConsulting.model.dto.BusinessConsultingDTO;
import com.sunxung.factoring.mapper.businessConsulting.BusinessConsultingDAO;
import com.sunxung.factoring.service.businessConsulting.BusinessConsultingService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author liutao
* @date  2024-03-30
*/
@Service
public class BusinessConsultingServiceImpl extends ServiceImpl<BusinessConsultingDAO, BusinessConsultingDO> implements BusinessConsultingService {

//
//    @Override
//    public void addBusinessConsulting(AddBusinessConsultingRequest addBusinessConsultingRequest) {
//    BusinessConsultingDO businessConsulting = BeanUtilsProxy.copyPropertiesIgnoreNull(addBusinessConsultingRequest, BusinessConsultingDO.class);
//    this.baseMapper.insert(businessConsulting);
//    }

//    @Override
//    public void editBusinessConsulting(EditBusinessConsultingRequest editBusinessConsultingRequest) {
//
//    BusinessConsultingDO businessConsulting = super.getById(editBusinessConsultingRequest.getId());
//    if (businessConsulting == null) {
//    throw new ServiceException(400, ExceptionEnum.SYSTEM_DATE_ERROR);
//    }
//    BeanUtilsProxy.copyPropertiesNotIgnoreNull(editBusinessConsultingRequest,businessConsulting);
//    this.updateById(businessConsulting);
//    }

    @Override
    public BusinessConsultingDTO getBusinessConsultingDtoById(Long id) {
    BusinessConsultingDO businessConsulting = super.getById(id);
    BusinessConsultingDTO businessConsultingDto = BeanUtilsProxy.copyProperties(businessConsulting,BusinessConsultingDTO.class);
    return businessConsultingDto;
    }

    @Override
    public GridPage findAll(BaseSearch baseSearch) {
        Page page = PageHelper.startPage(baseSearch.getPage(),baseSearch.getRows());
        List<BusinessConsultingDO> list = list();
        return new GridPage(baseSearch.getRows(),baseSearch.getPage(),page.getTotal(),page.getResult());
    }
//
//    @Override
//    public void deleteBusinessConsulting(Long id) {
//
//    this.removeById(id);
//    }
}

