package org.springblade.business.service.impl;

import org.springblade.business.entity.ConstructionLedger;
import org.springblade.business.vo.ConstructionLedgerVO;
import org.springblade.business.mapper.ConstructionLedgerMapper;
import org.springblade.business.service.IConstructionLedgerService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2022-05-23
 */
@Service
public class ConstructionLedgerServiceImpl extends BaseServiceImpl<ConstructionLedgerMapper, ConstructionLedger> implements IConstructionLedgerService {

	@Override
	public IPage<ConstructionLedger> selectConstructionLedgerPage(IPage<ConstructionLedger> page, ConstructionLedgerVO constructionLedger) {
		//当前页面数据
		long current = (page.getCurrent() - 1L) * page.getSize();
		return page.setRecords(this.baseMapper.selectConstructionLedgerPage(current, page.getSize(), constructionLedger));
	}

	/**
	 * 根据ID修改信息（部分）
	 * @param constructionLedger 参数
	 * @return 修改结果
	 */
	public boolean updateById(ConstructionLedger constructionLedger){
		Integer result = this.baseMapper.updateByIdNotAll(constructionLedger);
		return result != null && result > 0;
	}

}
