package com.bonus.material.ma.mapper;

import com.bonus.common.biz.domain.MaTypeProperty;
import com.bonus.material.ma.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * 工机具类型管理 数据层
 *
 * @author ruoyi
 */
@Mapper
public interface MaTypeMapper {

    List<MaType> selectMaTypeList(String typeName);

    /**
     * 查询机具类型管理ma_type
     *
     * @param typeId 机具类型管理ma_type主键
     * @return 机具类型管理ma_type
     */
    public MaType selectMaTypeByTypeId(Long typeId);


    /**
     * 新增机具类型管理ma_type
     *
     * @param maType 机具类型管理ma_type
     * @return 结果
     */
    public int insertType(MaType maType);

    /**
     * 修改机具类型管理ma_type
     *
     * @param maType 机具类型管理ma_type
     * @return 结果
     */
    public int updateType(MaType maType);

    /**
     * 删除机具类型管理ma_type
     *
     * @param typeId 机具类型管理ma_type主键
     * @return 结果
     */
    public int deleteTypeById(Long typeId);

    int insertKeeper(MaTypeKeeper typeKeeper);

    int insertRepair(MaTypeRepair typeRepair);

    int insertMaPropSet(MaPropSet propSet);

    int updateKeeperByTypeId(MaTypeKeeper typeKeeper);

    int updateRepairByTypeId(MaTypeRepair typeRepair);

    int updatePropSetByTypeId(MaPropSet propSet);

    MaType selectTypeByTypeId(long typeId);

    List<MaType> selectMaTypeTree(String parentId);

    List<MaType> getListByParentId(@Param("typeId") Long typeId, @Param("typeName") String typeName);

    List<MaType> selectMaTypeTreeByLevel(String id);

    List<MaType> selectMaTypeListByLevelNotFour(@Param("parentId") String parentId, @Param("keyword") String keyword);

    List<MaType> getMaTypeSelect(String parentId);

    int deleteTypeByTypeId(Long typeId);

    int deleteKeeperByTypeId(Long typeId);

    int deletePropSetByTypeId(Long typeId);

    int updateTypeNum(MaMachine maMachine);

    List<MaTypeKeeper> selectMaTypeByUserId(Long userId);

    List<Integer> selectParentId(@Param("typeId") Long typeId, @Param("level") Integer level);

    Integer updateLeasePrice(@Param("typeIds") List<Integer> typeIds, @Param("leasePrice") BigDecimal leasePrice);

    List<MaTypeProperty> selectMaTypePropertyNames();

    int deleteMaTypePropertyNames(@Param("typeId") Long typeId);

    int insertMaTypePropertyNames(@Param("typeId") Long typeId, @Param("list") List<MaTypeProperty> properties);

    List<MaType> getList(@Param("typeName") String typeName, @Param("level") Integer level, @Param("parentId") Integer parentId, @Param("keyWord") String keyWord);

    List<MaType> selectMaTypeTreeBy5Level(Integer type);

    List<MaType> selectMaTypeTreeBy5Level2(Integer type);

    List<Map<String, Object>> getUsageStatistics(@Param("type") Integer type, @Param("deptId") Long deptId);


    List<Map<String, Object>> getUsageStatisticsDetails();

    List<Map<String, Object>> getEquipmentUse(@Param("proCode") List<String> proCode, @Param("proType") String proType);


    List<Map<String, Object>> getEquipmentDetails(String proName);

    Integer getProNum(@Param("proType") String proType);

    Integer getEquipmentNum(@Param("proType") String proType);

    List<Map<String, Object>> getDeptEquipment();
}
