package com.cool.store.dao;

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

import javax.annotation.Resource;

/**
 * @Author: WangShuo
 * @Date: 2024/10/09/下午3:00
 * @Version 1.0
 * @注释:
 */
@Repository
public class PosAndOrderInfoDAO {
    @Resource
    private PosAndOrderInfoMapper posAndOrderInfoMapper;
    public Integer insertSelective(PosAndOrderInfoDO posAndOrderInfoDO) {
        if (posAndOrderInfoDO == null) {
            return 0;
        }
        return posAndOrderInfoMapper.insertSelective(posAndOrderInfoDO);
    }

    public Integer updateByShopIdSelective(PosAndOrderInfoDO posAndOrderInfoDO) {
        if (posAndOrderInfoDO == null) {
            return 0;
        }
        Example example = new Example(PosAndOrderInfoDO.class);
        example.createCriteria()
                .andEqualTo("shopId", posAndOrderInfoDO.getShopId())
                .andEqualTo("type",posAndOrderInfoDO.getType());
        return posAndOrderInfoMapper.updateByExampleSelective(posAndOrderInfoDO,example);
    }
    public PosAndOrderInfoDO selectOneByShopId(Long shopId,Integer type) {
        Example example = new Example(PosAndOrderInfoDO.class);
        example.createCriteria().andEqualTo("shopId",shopId).andEqualTo("type",type);
        return posAndOrderInfoMapper.selectOneByExample(example);
    }
}
