package com.cool.store.dao;

import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.request.PlanListRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: WangShuo
 * @Date: 2024/04/22/下午2:14
 * @Version 1.0
 * @注释:开业运营方案
 */
@Slf4j
@Repository
public class OpeningOperationPlanDAO {

    @Resource
    private OpeningOperationPlanMapper openingOperationPlanMapper;

    public  Long insertSelective(@Param("openingOperationPlanDO") OpeningOperationPlanDO openingOperationPlanDO){
        openingOperationPlanMapper.insertSelective(openingOperationPlanDO);
        return openingOperationPlanDO.getId();
    }

    /**
     * @Auther: wangshuo
     * @Date: 2024/4/24
     * @description: 开业运营方案，根据condition获取列表
     */
    public List<OpenPlanShopInfoDTO>getOpenPlanShopListByCondition(PlanListRequest request ){

        return openingOperationPlanMapper.getOpenPlanShopListByCondition(request);
    }

    public Integer updateResultType(Long shopId,Long auditId,Integer resultType){
        return openingOperationPlanMapper.updateByShopId(shopId,auditId,resultType);

    }
    public Long updateSelective( OpeningOperationPlanDO openingOperationPlanDO){
        openingOperationPlanMapper.updateByPrimaryKeySelective(openingOperationPlanDO);
        return openingOperationPlanDO.getId();
    }

    public OpeningOperationPlanDO selectByShopId( Long shopId){
        return openingOperationPlanMapper.selectByShopId(shopId);
    }


}
