kongzy
2024-07-01 47a751cb301d05276ae5d75145d57b2d090fe4e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.nanometer.smartlab.service;
 
import com.nanometer.smartlab.dao.BaseMetaGroupDao;
import com.nanometer.smartlab.entity.BaseMetaGroup;
import com.nanometer.smartlab.exception.BusinessException;
import com.nanometer.smartlab.exception.ExceptionEnumCode;
import com.nanometer.smartlab.util.MessageUtil;
import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * Created by johnny on 17/8/21.
 */
@Service("baseMetaGroupService")
public class BaseMetaGroupServiceImpl implements BaseMetaGroupService {
 
    private static Logger logger = Logger.getLogger(BaseMetaGroupService.class);
 
    @Resource(name = "baseMetaGroupDao")
    BaseMetaGroupDao baseMetaGroupDao;
 
    @Transactional(propagation = Propagation.REQUIRED)
    public List<BaseMetaGroup> getBaseMetaGroupList() {
        try {
            return baseMetaGroupDao.getBaseMetaGroupList();
        } catch (DataAccessException ex) {
            logger.error(ex.getMessage(), ex);
            throw new BusinessException(ExceptionEnumCode.DB_ERR, MessageUtil.getMessageByCode(ExceptionEnumCode.DB_ERR.getCode()), ex);
        }
    }
 
    @Override
    public BaseMetaGroup getBaseMetaGroupByCode(String code) {
        return baseMetaGroupDao.getBaseMetaGroupByCode(code);
    }
}