package cn.ysk.cashier.mybatis.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ysk.cashier.mybatis.mapper.TagProductDeptsMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import cn.ysk.cashier.mybatis.service.TagProductDeptsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TagProductDepts)表服务实现类
 *
 * @author ww
 * @since 2024-05-23 14:21:29
 */
@Service
public class TagProductDeptsServiceImpl extends ServiceImpl<TagProductDeptsMapper, TagProductDepts> implements TagProductDeptsService {

    @Autowired
    private TagProductDeptsMapper productDeptsMapper;

    @Override
    public void setTag(Integer tagId,Integer productId) {
        productDeptsMapper.delByProductIdAfter(productId);
        TagProductDepts tagProduct=new TagProductDepts(tagId,productId);
        productDeptsMapper.insert(tagProduct);
    }
    @Override
    public List<TagProductDepts> queryAllByProductId(Integer productId){
//        productDeptsMapper.select
        return productDeptsMapper.queryAllByProductId(productId);
    }
}

