package com.neusoft.smart.pos.org.service;

import com.neusoft.smart.pos.framework.exception.BusinessCommonException;
import com.neusoft.smart.pos.org.persistent.domain.TableGroups;
import com.neusoft.smart.pos.org.persistent.mapper.TableGroupsMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TableGroupService {
    @Resource
    TableGroupsMapper tableGroupsMapper;

    public void insert(TableGroups record) {
        final int i = tableGroupsMapper.countByGroupName(record.getGroupName(), record.getShopId());
        if (i > 0) {
            throw new BusinessCommonException("500", "重复的组别");
        }
        tableGroupsMapper.insert(record);
    }
}
