package com.unis.crk.business.kcgl.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.unis.crk.business.kcgl.entity.DataKcglXckcDefault;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.unis.crk.enums.StoreWorkType;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 库存管理-形成库存表 Mapper 接口
 * </p>
 *
 * @author TangSong
 * @since 2021-10-11
 */
public interface DataKcglXckcDefaultMapper extends BaseMapper<DataKcglXckcDefault> {
        /**
         * 自定义sql分页
         * @param page
         * @param queryWrapper 看这里看这里，如果自定义的方法中需要用到wrapper查询条件，需要这样写
         * @return
         */
        IPage<Map<String,Object>> selectMyMapsPage(IPage<DataKcglXckcDefault> page, @Param(Constants.WRAPPER) QueryWrapper<DataKcglXckcDefault> queryWrapper);




        /**
         * 直接进行sqls查询
         * @param sql
         * @return
         */
        List<Map<String,Object>> selectSql(@Param("sql") String sql );

    /**
     * 汽车入库称皮重环节生成形成库存
     * @param dataId
     * @param loginName
     * @param sum
     * @param flowName
     * @param storeWorkType
     * @param rkCpz
     * @return
     */
    int addInStock(@Param("dataId")String dataId, @Param("loginName")String loginName, @Param("sum")String sum, @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("rkCpz")String rkCpz);
    /**
     * 汽车出库称皮重生成形成库存
     * @param dataId
     * @param loginName
     * @param flowName
     * @param storeWorkType
     * @param ckCmz
     * @return
     */
    int addOutStock(@Param("dataId")String dataId, @Param("loginName")String loginName, @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("ckCmz")String ckCmz);

    /**
     * 通过期初库存生成库存明细
     * @param dataId
     * @param loginName
     * @param flowName
     * @param storeWorkType
     * @param qckc
     * @return
     */
    int addQckcStock(@Param("dataId")String dataId, @Param("loginName")String loginName,  @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("qckc")String qckc);

    /**
     * 通过库存变动生成形成库存
     * @param dataId
     * @param loginName
     * @param flowName
     * @param storeWorkType
     * @param type
     * @return
     */
    int addKcbdStock(@Param("dataId")String dataId, @Param("loginName")String loginName,  @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("type")String type);
    /**
     * 通过库存变动移仓生成形成库存
     * @param reverseDataId
     * @param dataId
     * @param loginName
     * @param flowName
     * @param storeWorkType
     * @param type
     * @return
     */
    int addKcbdYcStock(@Param("reverseDataId") String reverseDataId,@Param("dataId")String dataId, @Param("loginName")String loginName,  @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("type")String type);
    /**
     * 通过库存变动性质变动生成形成库存
     * @param reverseDataId
     * @param dataId
     * @param loginName
     * @param flowName
     * @param storeWorkType
     * @param type
     * @return
     */
    int addKcbdXzbhStock(@Param("reverseDataId") String reverseDataId,@Param("dataId")String dataId, @Param("loginName")String loginName,  @Param("flowName")String flowName, @Param("storeWorkType")Short storeWorkType, @Param("type")String type);


    IPage<Map<String,Object>> findPageBgtz(Page<DataKcglXckcDefault> p, @Param(Constants.WRAPPER) QueryWrapper<DataKcglXckcDefault> queryWrapper);
}
