package com.cool.store.dao;

import com.cool.store.entity.MatterConfigDO;
import com.cool.store.mapper.MatterConfigMapper;
import com.cool.store.request.notice.MatterConfigQueryRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;

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

/**
 * @Author suzhuhong
 * @Date 2025/7/24 14:22
 * @Version 1.0
 */
@Slf4j
@Repository
public class MatterConfigDAO {
    
    @Resource
    MatterConfigMapper matterConfigMapper;

    public int insert(MatterConfigDO matterConfigDO){
        return matterConfigMapper.insertSelective(matterConfigDO);
    }

    public int update(MatterConfigDO matterConfigDO){
        return matterConfigMapper.updateByPrimaryKeySelective(matterConfigDO);
    }

    public MatterConfigDO getById(Long id){
        return matterConfigMapper.selectByPrimaryKey(id);
    }

    public int updateForce(MatterConfigDO matterConfigDO){
        return matterConfigMapper.updateForce(matterConfigDO);
    }

    public int batchDelete(List<Long> ids, String userId){
        if (CollectionUtils.isEmpty(ids)){
            return 0;
        }
        return matterConfigMapper.updateDeleteStatus(ids,userId);
    }

    public List<MatterConfigDO> ListByCondition(MatterConfigQueryRequest request){
        return matterConfigMapper.ListByCondition(request);
    }
    
    
}
