package com.jsh.erp.service;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jsh.erp.datasource.entities.Depot;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.vo.SpinnerVO;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface DepotService extends IService<Depot> {

    /**
     * 获取下拉框
     * @return
     */
    List<SpinnerVO> depotSpinnerList();

    Depot getDepot(long id)throws Exception;

    List<Depot> getDepotListByIds(String ids)throws Exception;

    /**
     * 获取所有仓库
     */
    List<Depot> getDepot()throws Exception;

    List<Depot> getAllList()throws Exception;

    List<DepotEx> select(String name, Integer type, String remark)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int insertDepot(JSONObject obj, HttpServletRequest request)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int updateDepot(JSONObject obj, HttpServletRequest request) throws Exception;

    /**
     * 删除仓库
     * @param id 仓库id
     */
    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int deleteDepot(Long id, HttpServletRequest request)throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int batchDeleteDepotByIds(String ids)throws Exception;

    int checkIsNameExist(Long id, String name)throws Exception;

    List<Depot> findUserDepot()throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int updateIsDefault(Long depotId) throws Exception;

    Long getIdByName(String name);

    List<Long> parseDepotList(Long depotId) throws Exception;

    JSONArray findDepotByCurrentUser() throws Exception;

    String findDepotStrByCurrentUser() throws Exception;

    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
    int batchSetStatus(Boolean status, String ids)throws Exception;
}
