package com.cool.store.dao;

import com.cool.store.entity.BuildInformationDO;
import com.cool.store.entity.PlatformBuildDO;
import com.cool.store.mapper.PlatformBuildMapper;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * @Author: WangShuo
 * @Date: 2024/10/09/下午2:58
 * @Version 1.0
 * @注释:
 */
@Repository
public class PlatformBuildDAO {
    @Resource
    private PlatformBuildMapper platformBuildMapper;


    public Integer insertSelective(PlatformBuildDO platformBuildDO) {
        if (platformBuildDO == null) {
            return 0;
        }
        return platformBuildMapper.insertSelective(platformBuildDO);
    }

    public Integer updateByShopIdAndTypeSelective(PlatformBuildDO platformBuildDO) {
        if (platformBuildDO == null) {
            return 0;
        }
        Example example = new Example(PlatformBuildDO.class);
        example.createCriteria()
                .andEqualTo("shopId", platformBuildDO.getShopId())
                .andEqualTo("type",platformBuildDO.getType());
        return platformBuildMapper.updateByExampleSelective(platformBuildDO,example);
    }
    public PlatformBuildDO selectOneByShopId(Long shopId,Integer type) {
        Example example = new Example(PlatformBuildDO.class);
        example.createCriteria().andEqualTo("shopId",shopId).andEqualTo("type",type);
        return platformBuildMapper.selectOneByExample(example);
    }
}
