package com.enterprise.manage.modules.system.service.impl;

import com.enterprise.manage.common.base.BaseServiceImpl;
import com.enterprise.manage.modules.system.mapper.DictItemMapper;
import org.springframework.stereotype.Service;
import com.enterprise.manage.modules.system.mapper.DictMapper;
import com.enterprise.manage.modules.system.domain.po.Dict;
import com.enterprise.manage.modules.system.service.IDictService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * system dictionary service implementation class
 *
 * @author WangJia
 * 2021-05-13 14:26
 */
@Service
public class DictServiceImpl extends BaseServiceImpl<DictMapper, Dict> implements IDictService {

    @Resource
    private DictMapper dictMapper;

    @Resource
    private DictItemMapper dictItemMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delete(Long id) {
        dictItemMapper.delItemByParentId(id);
        return baseMapper.delete(id) > 0;
    }

    @Override
    public List<Dict> selectList() {
        return dictMapper.selectList() ;
    }
}
