package com.ruoyi.manage.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.BaseStoreMapper;
import com.ruoyi.manage.domain.BaseStore;
import com.ruoyi.manage.service.IBaseStoreService;
import com.ruoyi.common.core.text.Convert;

/**
 * 仓库信息维护Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-08
 */
@Service("storeService")
public class BaseStoreServiceImpl implements IBaseStoreService {
    @Autowired
    private BaseStoreMapper baseStoreMapper;

    /**
     * 查询仓库信息维护
     *
     * @param storeId 仓库信息维护主键
     * @return 仓库信息维护
     */
    @Override
    public BaseStore selectBaseStoreByStoreId(Long storeId) {
        return baseStoreMapper.selectBaseStoreByStoreId(storeId);
    }

    /**
     * 查询仓库信息维护列表
     *
     * @param baseStore 仓库信息维护
     * @return 仓库信息维护
     */
    @Override
    public List<BaseStore> selectBaseStoreList(BaseStore baseStore) {
        return baseStoreMapper.selectBaseStoreList(baseStore);
    }

    public List<BaseStore> selectStore() {
        return baseStoreMapper.selectStore();
    }

    public List<BaseStore> selectArea() {
        return baseStoreMapper.selectArea();
    }


    /**
     * 新增仓库信息维护
     *
     * @param baseStore 仓库信息维护
     * @return 结果
     */
    @Override
    public int insertBaseStore(BaseStore baseStore) {
        baseStore.setCreateBy(ShiroUtils.getLoginName());
        baseStore.setCreateTime(DateUtils.getNowDate());
        return baseStoreMapper.insertBaseStore(baseStore);
    }

    /**
     * 修改仓库信息维护
     *
     * @param baseStore 仓库信息维护
     * @return 结果
     */
    @Override
    public int updateBaseStore(BaseStore baseStore) {
        baseStore.setUpdateBy(ShiroUtils.getLoginName());
        baseStore.setUpdateTime(DateUtils.getNowDate());
        return baseStoreMapper.updateBaseStore(baseStore);
    }

    /**
     * 批量删除仓库信息维护
     *
     * @param storeIds 需要删除的仓库信息维护主键
     * @return 结果
     */
    @Override
    public int deleteBaseStoreByStoreIds(String storeIds) {
        return baseStoreMapper.deleteBaseStoreByStoreIds(Convert.toStrArray(storeIds));
    }

    /**
     * 删除仓库信息维护信息
     *
     * @param storeId 仓库信息维护主键
     * @return 结果
     */
    @Override
    public int deleteBaseStoreByStoreId(Long storeId) {
        return baseStoreMapper.deleteBaseStoreByStoreId(storeId);
    }
}
