package com.zioinfo.signage.service;

import com.zioinfo.signage.domain.StoreGroupVo;
import com.zioinfo.signage.mapper.StoreGroupMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
@RequiredArgsConstructor
public class StoreGroupService {
    private final StoreGroupMapper mapper;

    public List<StoreGroupVo> list(String tenantCode) { return mapper.findAll(tenantCode); }
    public StoreGroupVo get(Long id) { return mapper.findById(id); }

    public StoreGroupVo create(StoreGroupVo v) {
        mapper.insert(v);
        return mapper.findById(v.getId());
    }

    public StoreGroupVo update(Long id, StoreGroupVo v) {
        v.setId(id);
        mapper.update(v);
        return mapper.findById(id);
    }

    public void delete(Long id) { mapper.delete(id); }
}
