chenlu
2024-06-07 2f640b1038fa331954f78ed1f4317212cf5bb34d
north-glass-erp/src/main/java/com/example/erp/service/userInfo/RoleService.java
New file
@@ -0,0 +1,31 @@
package com.example.erp.service.userInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.entity.userInfo.Role;
import com.example.erp.mapper.userInfo.RoleMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@DS("user_info")
public class RoleService {
    private final RoleMapper roleMapper;
    public RoleService(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }
    public List<Role> findAll() {
        return roleMapper.selectList(
                new QueryWrapper<Role>()
                        .ne("role","admin")
        );
    }
    public Boolean add(Role role) {
        return roleMapper.insert(role) > 0;
    }
}