package com.liang.service.impl;

import com.liang.entity.PrjProject;
import com.liang.entity.StaFeasibilityreport;
import com.liang.dao.StaFeasibilityreportDao;
import com.liang.service.StaFeasibilityreportService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (StaFeasibilityreport)表服务实现类
 *
 * @author makejava
 * @since 2023-03-03 23:38:24
 */
@Service("staFeasibilityreportService")
public class StaFeasibilityreportServiceImpl implements StaFeasibilityreportService {
    @Resource
    private StaFeasibilityreportDao staFeasibilityreportDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public StaFeasibilityreport queryById(Integer id) {
        return this.staFeasibilityreportDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param staFeasibilityreport 筛选条件
     * @param pageRequest          分页对象
     * @return 查询结果
     */
    @Override
    public Page<StaFeasibilityreport> queryByPage(StaFeasibilityreport staFeasibilityreport, PageRequest pageRequest) {
        long total = this.staFeasibilityreportDao.count(staFeasibilityreport);
        return new PageImpl<>(this.staFeasibilityreportDao.queryAllByLimit(staFeasibilityreport, pageRequest), pageRequest, total);
    }

    /**
     * 新增数据
     *
     * @param staFeasibilityreport 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(StaFeasibilityreport staFeasibilityreport) {
        int ret = this.staFeasibilityreportDao.insert(staFeasibilityreport);
        if (ret > 0)
            return staFeasibilityreport.getId();
        else
            return 0;
    }

    @Override
    public int insertNormal(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.insertNormal(staFeasibilityreport);
    }

    /**
     * 撤销审批状态
     *
     * @param staFeasibilityreport 实例对象
     * @return 实例对象
     */
    @Override
    public int tjrevokeApprove(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.tjrevokeApprove(staFeasibilityreport);
    }

    /**
     * 修改数据
     *
     * @param staFeasibilityreport 实例对象
     * @return 实例对象
     */
    @Override
    public StaFeasibilityreport update(StaFeasibilityreport staFeasibilityreport) {
        this.staFeasibilityreportDao.update(staFeasibilityreport);
        return staFeasibilityreport;
    }

    @Override
    public int updateNormal(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateNormal(staFeasibilityreport);
    }

    @Override
    public int updateMdhyy(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateMdhyy(staFeasibilityreport);
    }

    @Override
    public int updateYjsp(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateYjsp(staFeasibilityreport);
    }

    @Override
    public int updateLlsjyj(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateLlsjyj(staFeasibilityreport);
    }

    @Override
    public int updateYjnr(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateYjnr(staFeasibilityreport);
    }

    @Override
    public int updateJjxcwhgx(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateJjxcwhgx(staFeasibilityreport);
    }

    @Override
    public int updateYqmb(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateYqmb(staFeasibilityreport);
    }

    @Override
    public int updateHzdw(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateHzdw(staFeasibilityreport);
    }

    @Override
    public int updateCddw(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateCddw(staFeasibilityreport);
    }

    @Override
    public int updateScyj(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateScyj(staFeasibilityreport);
    }

    @Override
    public int updateFj(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateFj(staFeasibilityreport);
    }

    @Override
    public int updateQmgz(StaFeasibilityreport staFeasibilityreport) {
        return this.staFeasibilityreportDao.updateQmgz(staFeasibilityreport);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.staFeasibilityreportDao.deleteById(id) > 0;
    }

    @Override
    public List<StaFeasibilityreport> getReportInfoList(Map map) {

        return staFeasibilityreportDao.getReportInfoList(map);
    }

    @Override
    public List<StaFeasibilityreport> getRwsKybgList(Map map) {
        return this.staFeasibilityreportDao.getRwsKybgList(map);
    }

    @Override
    public int updateSpzt(StaFeasibilityreport project) {
        return this.staFeasibilityreportDao.updateSpzt(project);
    }
}
