package com.yunfeiyun.agmp.fms.mapper;

import com.yunfeiyun.agmp.fms.domain.FmsBlock;
import com.yunfeiyun.agmp.fms.domain.FmsLand;
import com.yunfeiyun.agmp.fms.domain.reqvo.FmsBlockReqVo;
import com.yunfeiyun.agmp.fms.domain.resvo.FmsBlockResVo;

import java.math.BigDecimal;
import java.util.List;

/**
 * 地块Mapper接口
 * 
 * @author 杨晓辉
 * @date 2023-05-15
 */
public interface FmsBlockMapper 
{
    /**
     * 查询地块
     * 
     * @param blockId 地块主键
     * @return 地块
     */
    public FmsBlock selectFmsBlockByBlockId(String blockId);

    public FmsBlockResVo selectFmsBlockInfoByBlockId(String blockId);


    /**
     * 查询地块列表
     * 
     * @param fmsBlock 地块
     * @return 地块集合
     */
    public List<FmsBlock> selectFmsBlockList(FmsBlock fmsBlock);


    public Integer selectCountByLandId(String landId);

    public BigDecimal selectSumAreaByLandId(FmsLand fmsLand);

    public BigDecimal selectSumArea(FmsBlockReqVo reqVo);
    /**
     * 查询地块，返回包含计划的作物
     * @param reqVo
     * @return
     */
    public List<FmsBlockResVo> selectFmsBlockHasPlan(FmsBlockReqVo reqVo);


    /**
     * 新增地块
     * 
     * @param fmsBlock 地块
     * @return 结果
     */
    public int insertFmsBlock(FmsBlock fmsBlock);

    /**
     * 修改地块
     * 
     * @param fmsBlock 地块
     * @return 结果
     */
    public int updateFmsBlock(FmsBlock fmsBlock);
    public int updateFmsBlockBatch(List<FmsBlock> fmsBlocks);

    /**
     * 删除地块
     * 
     * @param blockId 地块主键
     * @return 结果
     */
    public int deleteFmsBlockByBlockId(String blockId);

    /**
     * 批量删除地块
     * 
     * @param blockIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFmsBlockByBlockIds(String[] blockIds);

    public int selectValidDataNumber(String blockId);

    public List<FmsLand> selectFmsLandByBlockIds(String[] blockIds);
}
