All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openea.eap.module.system.service.sys.SystemServiceImpl Maven / Gradle / Ivy

Go to download

system 模块下,我们放通用业务,支撑上层的核心业务。 例如说:用户、部门、权限、数据字典等等

The newest version!
package org.openea.eap.module.system.service.sys;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import org.openea.eap.module.system.controller.admin.sys.vo.*;
import org.openea.eap.module.system.dal.dataobject.sys.SystemDO;
import org.openea.eap.framework.common.pojo.PageResult;
import org.openea.eap.framework.common.pojo.PageParam;
import org.openea.eap.framework.common.util.object.BeanUtils;

import org.openea.eap.module.system.dal.mysql.sys.SystemMapper;

import static org.openea.eap.framework.common.exception.util.ServiceExceptionUtil.exception;
import static org.openea.eap.module.system.enums.ErrorCodeConstants.*;

/**
 * 系统应用 Service 实现类
 *
 * @author eap
 */
@Service
@Validated
public class SystemServiceImpl implements SystemService {

    @Resource
    private SystemMapper systemMapper;

    @Override
    public Long createSystem(SystemSaveReqVO createReqVO) {
        // 插入
        SystemDO system = BeanUtils.toBean(createReqVO, SystemDO.class);
        systemMapper.insert(system);
        // 返回
        return system.getId();
    }

    @Override
    public void updateSystem(SystemSaveReqVO updateReqVO) {
        // 校验存在
        validateSystemExists(updateReqVO.getId());
        // 更新
        SystemDO updateObj = BeanUtils.toBean(updateReqVO, SystemDO.class);
        systemMapper.updateById(updateObj);
    }

    @Override
    public void deleteSystem(Long id) {
        // 校验存在
        validateSystemExists(id);
        // 删除
        systemMapper.deleteById(id);
    }

    private void validateSystemExists(Long id) {
        if (systemMapper.selectById(id) == null) {
            throw exception(SYSTEM_NOT_EXISTS);
        }
    }

    @Override
    public SystemDO getSystem(Long id) {
        return systemMapper.selectById(id);
    }

    @Override
    public PageResult getSystemPage(SystemPageReqVO pageReqVO) {
        return systemMapper.selectPage(pageReqVO);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy