package cn.com.countrygarden.bi.main.service.dmn.impl;

import cn.com.countrygarden.bi.main.core.Response;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.dao.dmn.CostInformationMapper;
import cn.com.countrygarden.bi.main.model.dmn.CostInformation;
import cn.com.countrygarden.bi.main.service.dmn.CostInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: backEnd
 * @description: 消费信息业务层
 * @author: bug大神
 * @create: 2024-07-24 17:28
 **/
@Service
public class CostInformationServiceImpl implements CostInformationService {
    @Autowired
    private CostInformationMapper costInformationMapper;

    public void setCostInformatio() {
        System.out.println(costInformationMapper.selectAll());
    }

    @Override
    public Result getCostInformation() {
        return Response.response(costInformationMapper.selectAll());
    }

    @Override
    public Result deleteCostInformationById(Integer id) {
//        删除消费信息
        return costInformationMapper.deleteCostInformationById(id) > 0 ? Response.response("删除成功") : Response.responseFail("删除失败");
    }

    @Override
    public Result updateCostInformationById(CostInformation costInformation) {
//根据id修改消费字表信息
        return costInformationMapper.updateByConditionById(costInformation) > 0 ? Response.response("修改成功") : Response.responseFail("修改失败");
    }

    @Override
    public Result addCostInformation(CostInformation costInformation) {
//添加消费信息
        return costInformationMapper.addCostInformation(costInformation) > 0 ? Response.response("添加成功") : Response.responseFail("添加失败");
    }

    @Override
    public Result getCostInformationBydnmId(Integer id) {

        return Response.response(costInformationMapper.getCostInformationBydnmId(id));
    }


}
