package com.handong.smartservice.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface GoodsMapper {
    List<Map<String, Object>> selectGoods(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, Long device_id,
        Long state, String code, String name, String vendor, String date_start, String date_end);
    
    List<Map<String, Object>> selectGoodsByBizGroupId(Long biz_group_id);
    List<Map<String, Object>> selectGoodsByDevice(Boolean is_group_access, Long device_id);

    Map<String, Object> selectExistGoods(Long biz_group_id, String code, String name);
    
    Map<String, Object> selectGoodsByUid1(String uid1, Long uid1_type, String slot);
    
    int insertGoods(Map<String, Object> params);

    int updateGoods(Long biz_group_id, Long goods_id, String code, String name, Long price, Long inventory, String vendor, Long gid);
    
    int deleteGoods(List<Long> ids);

    //
    List<Map<String, Object>> selectDeviceGoods(Long device_id, String slot, Long goods_id);
    int insertDeviceGoods(Long device_id, List<Map<String, String>> device_goods);
    int updateDeviceGoodsPlusInventory(String approval);
    int updateDeviceGoodsMinusInventory(Long device_id, String slot);
    int deleteDeviceGoods(Long device_id, List<Map<String, String>> device_goods);

    List<Map<String, Object>> selectGoodsTemplateByBizGroupId(Long biz_group_id);
    List<Map<String, Object>> selectGoodsTemplateById(Long goods_template_id);
    
    Long selectGoodsTemplateCount(Long biz_group_id);
    int insertGoodsTemplate(Map<String, Object> params);
    int insertGoodsTemplateElements(Long goods_template_id, List<Map<String, String>> goods_template_elements);
    
    int updateGoodsTemplate(Long goods_template_id, String name);
    int deleteGoodsTemplateElements(Long goods_template_id);
    int deleteGoodsTemplate(Long goods_template_id);
}
