package com.sw.mes.auth.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sw.mes.auth.domain.AuthPermission;
import com.sw.mes.auth.service.AuthPermissionService;
import com.sw.mes.auth.mapper.AuthPermissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author JS111816
* @description 针对表【auth_permission(【系统域—系统管理】菜单配置)】的数据库操作Service实现
* @createDate 2022-05-19 13:54:21
*/
@Service
public class AuthPermissionServiceImpl extends ServiceImpl<AuthPermissionMapper, AuthPermission>
    implements AuthPermissionService{
@Autowired
private AuthPermissionMapper authPermissionMapper;

    @Override
    public List<AuthPermission>  getByUserId(Integer userId) {
        return authPermissionMapper.getByUserId(userId);
    }

    @Override
    public List<AuthPermission> listAll() {
        return super.list();
    }

    @Override
    public boolean saveOrUpdate(AuthPermission permission) {
        if (null == permission.getParentId()) {
            permission.setParentId(0);
        }
        return  super.saveOrUpdate(permission);
    }

}




