Convert Figma logo to code with AI

pig-mesh logopig

↥ ↥ ↥ 点击关注更新,基于 Spring Cloud 2023 、Spring Boot 3.3、 OAuth2 的 RBAC 权限管理系统

5,824
939
5,824
280

Top Related Projects

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.

77,638

mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。

🔥 官方推荐 🔥 RuoYi-Vue 全新 Pro 版本,优化重构所有功能。基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 微信小程序,支持 RBAC 动态权限、数据权限、SaaS 多租户、Flowable 工作流、三方登录、支付、短信、商城、CRM、ERP、AI 大模型等功能。你的 ⭐️ Star ⭐️,是作者生发的动力!

21,181

eladmin jpa 版本:项目基于 Spring Boot 2.6.4、 Jpa、 Spring Security、Redis、Vue的前后端分离的后台管理系统,项目采用分模块开发方式, 权限控制采用 RBAC,支持数据字典与数据权限管理,支持一键生成前后端代码,支持动态路由

基于SpringCloud2.1的微服务开发脚手架,整合了spring-security-oauth2、nacos、feign、sentinel、springcloud-gateway等。服务治理方面引入elasticsearch、skywalking、springboot-admin、zipkin等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中

40,000

🔥「企业级低代码平台」前后端分离架构SpringBoot 2.x/3.x,SpringCloud,Ant Design&Vue3,Mybatis,Shiro,JWT。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领新的开发模式OnlineCoding->代码生成->手工MERGE,帮助Java项目解决70%重复工作,让开发更关注业务,既能快速提高效率,帮助公司节省成本,同时又不失灵活性。

Quick Overview

The pig-mesh/pig repository is a lightweight, fast, and flexible web framework for building modern web applications in Go. It provides a simple and intuitive API for handling HTTP requests, routing, middleware, and more, making it a great choice for developers looking to build scalable and efficient web applications.

Pros

  • Simplicity: Pig is designed to be easy to use and understand, with a clean and concise API that makes it easy to get started.
  • Performance: Pig is built on top of the high-performance net/http package, and is optimized for speed and efficiency.
  • Flexibility: Pig is highly customizable and can be easily extended with middleware and other plugins.
  • Scalability: Pig is designed to be scalable and can handle high-traffic web applications with ease.

Cons

  • Limited Documentation: While the Pig project has a good amount of documentation, it may not be as comprehensive as some other web frameworks.
  • Smaller Community: Pig has a smaller community compared to some of the more popular Go web frameworks, which may make it harder to find support and resources.
  • Fewer Features: Pig is a relatively lightweight framework, which means it may not have as many built-in features as some of the more feature-rich web frameworks.
  • Lack of Widespread Adoption: Pig is not as widely used as some of the more popular Go web frameworks, which may make it harder to find developers who are familiar with the project.

Code Examples

Here are a few examples of how to use Pig in your Go web applications:

  1. Basic HTTP Handler:
package main

import (
    "fmt"
    "net/http"

    "github.com/pig-mesh/pig"
)

func main() {
    r := pig.New()

    r.Get("/", func(c *pig.Context) error {
        _, err := fmt.Fprintf(c.Writer, "Hello, World!")
        return err
    })

    http.ListenAndServe(":8080", r)
}
  1. Routing and Parameters:
package main

import (
    "fmt"
    "net/http"

    "github.com/pig-mesh/pig"
)

func main() {
    r := pig.New()

    r.Get("/users/:id", func(c *pig.Context) error {
        id := c.Param("id")
        _, err := fmt.Fprintf(c.Writer, "User ID: %s", id)
        return err
    })

    http.ListenAndServe(":8080", r)
}
  1. Middleware:
package main

import (
    "fmt"
    "net/http"

    "github.com/pig-mesh/pig"
)

func main() {
    r := pig.New()

    r.Use(func(next pig.HandlerFunc) pig.HandlerFunc {
        return func(c *pig.Context) error {
            fmt.Println("Before request")
            err := next(c)
            fmt.Println("After request")
            return err
        }
    })

    r.Get("/", func(c *pig.Context) error {
        _, err := fmt.Fprintf(c.Writer, "Hello, World!")
        return err
    })

    http.ListenAndServe(":8080", r)
}

Getting Started

To get started with Pig, you can follow these steps:

  1. Install Go on your system if you haven't already.
  2. Create a new Go module for your project:
go mod init your-project
  1. Install the Pig package:
go get github.com/pig-mesh/pig
  1. Create a new file (e.g., main.go) and add the following code:
package main

import (
    "fmt"
    "net/http"

    "github.com/pig-mesh/pig"
)

func main() {
    r := pig.New()

    r.Get("/", func(c *pig.Context) error {
        _, err := fmt.Fprintf(c.Writer, "Hello, Worl

Competitor Comparisons

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.

Pros of spring-cloud-alibaba

  • More comprehensive ecosystem with a wider range of components for microservices
  • Stronger community support and regular updates from Alibaba
  • Better integration with Alibaba Cloud services

Cons of spring-cloud-alibaba

  • Steeper learning curve due to its extensive feature set
  • Potentially heavier resource consumption for smaller projects
  • Some components may be more tailored for Alibaba Cloud, limiting flexibility

Code Comparison

spring-cloud-alibaba:

@SpringBootApplication
@EnableDiscoveryClient
public class ProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApplication.class, args);
    }
}

pig:

@SpringBootApplication
@EnablePigFeignClients
@EnablePigResourceServer
public class PigAdminApplication {
    public static void main(String[] args) {
        SpringApplication.run(PigAdminApplication.class, args);
    }
}

Both projects use Spring Boot annotations, but spring-cloud-alibaba focuses on service discovery, while pig includes custom annotations for Feign clients and resource server configuration.

77,638

mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。

Pros of mall

  • More comprehensive e-commerce solution with front-end and back-end components
  • Extensive documentation and learning resources for developers
  • Larger community and more frequent updates

Cons of mall

  • Steeper learning curve due to its complexity
  • May be overkill for smaller projects or simpler e-commerce needs
  • Potentially higher resource requirements for deployment

Code Comparison

mall (Java):

@ApiOperation("Add product to cart")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody OmsCartItem cartItem) {
    int count = cartItemService.add(cartItem);
    if (count > 0) {
        return CommonResult.success(count);
    }
    return CommonResult.failed();
}

pig (Java):

@Inner(false)
@GetMapping("/info/{username}")
public R<UserInfo> info(@PathVariable String username) {
    SysUser user = sysUserService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username));
    if (user == null) {
        return R.failed(String.format("用户信息为空 %s", username));
    }
    return R.ok(sysUserService.getUserInfo(user));
}

Both projects use Spring Boot and similar annotation-based approaches, but mall focuses on e-commerce functionality while pig emphasizes microservices and security features.

🔥 官方推荐 🔥 RuoYi-Vue 全新 Pro 版本,优化重构所有功能。基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 微信小程序,支持 RBAC 动态权限、数据权限、SaaS 多租户、Flowable 工作流、三方登录、支付、短信、商城、CRM、ERP、AI 大模型等功能。你的 ⭐️ Star ⭐️,是作者生发的动力!

Pros of ruoyi-vue-pro

  • More comprehensive documentation and tutorials
  • Larger community and more frequent updates
  • Extensive integration with popular third-party services

Cons of ruoyi-vue-pro

  • Steeper learning curve due to its extensive features
  • Potentially heavier resource consumption
  • May be overly complex for smaller projects

Code Comparison

ruoyi-vue-pro:

@PreAuthorize("@ss.hasPermission('system:user:list')")
@GetMapping("/page")
public CommonResult<PageResult<UserPageItemRespVO>> getUserPage(@Valid UserPageReqVO reqVO) {
    PageResult<AdminUserDO> pageResult = userService.getUserPage(reqVO);
    return success(UserConvert.INSTANCE.convertPage(pageResult));
}

pig:

@GetMapping("/page")
public R getUserPage(Page page, UserDTO userDTO) {
    return R.ok(userService.getUserWithRolePage(page, userDTO));
}

The ruoyi-vue-pro example shows more detailed permission handling and request validation, while pig's code is more concise but may require additional security measures elsewhere in the application.

21,181

eladmin jpa 版本:项目基于 Spring Boot 2.6.4、 Jpa、 Spring Security、Redis、Vue的前后端分离的后台管理系统,项目采用分模块开发方式, 权限控制采用 RBAC,支持数据字典与数据权限管理,支持一键生成前后端代码,支持动态路由

Pros of eladmin

  • More comprehensive documentation and detailed user guide
  • Extensive built-in components and modules for rapid development
  • Active community with frequent updates and bug fixes

Cons of eladmin

  • Steeper learning curve due to its extensive feature set
  • Potentially heavier resource usage for smaller projects
  • Less flexibility for customization compared to Pig's modular approach

Code Comparison

eladmin (Entity class example):

@Entity
@Data
@Table(name="sys_user")
public class User implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String username;
    private String email;
}

Pig (Entity class example):

@Data
@TableName("sys_user")
public class SysUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.ASSIGN_ID)
    private Long userId;
    private String username;
    private String email;
}

Both projects use similar annotations for entity classes, but Pig uses MyBatis-Plus annotations while eladmin uses JPA annotations. eladmin's approach may be more familiar to developers with a Spring Data background, while Pig's approach aligns with MyBatis-Plus conventions.

基于SpringCloud2.1的微服务开发脚手架,整合了spring-security-oauth2、nacos、feign、sentinel、springcloud-gateway等。服务治理方面引入elasticsearch、skywalking、springboot-admin、zipkin等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中

Pros of SpringCloud

  • More comprehensive microservices architecture demonstration
  • Includes detailed documentation and diagrams for system design
  • Implements a wider range of Spring Cloud components

Cons of SpringCloud

  • Less frequent updates and maintenance compared to Pig
  • May be more complex for beginners to understand and implement
  • Lacks some modern features and integrations present in Pig

Code Comparison

SpringCloud (auth-server module):

@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private UserDetailsService userDetailsService;

Pig (auth module):

@Configuration
@EnableAuthorizationServer
@RequiredArgsConstructor
public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
    private final DataSource dataSource;
    private final PigUserDetailsService pigUserDetailsService;

Both projects use Spring Cloud for microservices architecture, but Pig demonstrates a more modern approach with Lombok annotations and constructor injection. SpringCloud provides a more traditional setup, which may be easier for developers familiar with older Spring versions. Pig also includes additional security features and integrations with tools like Swagger and MyBatis-Plus, making it more feature-rich for enterprise applications.

40,000

🔥「企业级低代码平台」前后端分离架构SpringBoot 2.x/3.x,SpringCloud,Ant Design&Vue3,Mybatis,Shiro,JWT。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领新的开发模式OnlineCoding->代码生成->手工MERGE,帮助Java项目解决70%重复工作,让开发更关注业务,既能快速提高效率,帮助公司节省成本,同时又不失灵活性。

Pros of JeecgBoot

  • More comprehensive documentation and tutorials
  • Stronger focus on low-code development and code generation
  • Larger community and more frequent updates

Cons of JeecgBoot

  • Steeper learning curve due to more complex architecture
  • Potentially slower performance in some scenarios
  • Less emphasis on microservices architecture

Code Comparison

JeecgBoot:

@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    @GetMapping("/hello")
    public Result<String> hello() {
        return Result.OK("Hello JeecgBoot!");
    }
}

Pig:

@RestController
@RequestMapping("/test")
@RequiredArgsConstructor
public class TestController {
    @GetMapping("/hello")
    public R<String> hello() {
        return R.ok("Hello Pig!");
    }
}

Both projects use similar Spring Boot annotations and controller structures. JeecgBoot uses a custom Result class, while Pig uses R for wrapping responses. Pig also utilizes Lombok's @RequiredArgsConstructor for dependency injection, whereas JeecgBoot uses @Slf4j for logging.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Build Status Coverage Status Downloads Downloads

系统说明

  • 基于 Spring Cloud 、Spring Boot、 OAuth2 的 RBAC **企业快速开发平台**, 同时支持微服务架构和单体架构
  • 提供对 Spring Authorization Server 生产级实践,支持多种安全授权模式
  • 提供对常见容器化方案支持 Kubernetes、Rancher2 、Kubesphere、EDAS、SAE 支持

分支说明

  • jdk17: java17/21 + springboot 3.3 + springcloud 2023
  • master: java8 + springboot 2.7 + springcloud 2021

文档视频

其他产品

微信群 [禁广告]

1717136749

快速开始

核心依赖

依赖版本
Spring Boot3.3.2
Spring Cloud2023.0.3
Spring Cloud Alibaba2023.0.1.2
Spring Authorization Server1.3.1
Mybatis Plus3.5.7
Vue3.4
Element Plus2.7

模块说明

pig-ui  -- https://gitee.com/log4j/pig-ui

pig
├── pig-boot -- 单体模式启动器[9999]
├── pig-auth -- 授权服务提供[3000]
└── pig-common -- 系统公共模块
     ├── pig-common-bom -- 全局依赖管理控制
     ├── pig-common-core -- 公共工具类核心包
     ├── pig-common-datasource -- 动态数据源包
     ├── pig-common-log -- 日志服务
     ├── pig-common-oss -- 文件上传工具类
     ├── pig-common-mybatis -- mybatis 扩展封装
     ├── pig-common-seata -- 分布式事务
     ├── pig-common-security -- 安全工具类
     ├── pig-common-swagger -- 接口文档
     ├── pig-common-feign -- feign 扩展封装
     └── pig-common-xss -- xss 安全封装
├── pig-register -- Nacos Server[8848]
├── pig-gateway -- Spring Cloud Gateway网关[9999]
└── pig-upms -- 通用用户权限管理模块
     └── pig-upms-api -- 通用用户权限管理系统公共api模块
     └── pig-upms-biz -- 通用用户权限管理系统业务处理模块[4000]
└── pig-visual
     └── pig-monitor -- 服务监控 [5001]
     ├── pig-codegen -- 图形化代码生成 [5002]
     └── pig-quartz -- 定时任务管理台 [5007]

本地开发 运行

pig 提供了详细的部署文档 wiki.pig4cloud.com,包括开发环境安装、服务端代码运行、前端代码运行等。

请务必**完全按照**文档部署运行章节 进行操作,减少踩坑弯路!!

Docker 运行

# 下载并运行服务端代码
git clone https://gitee.com/log4j/pig.git -b jdk17

cd pig && mvn clean install && docker compose up -d

# 下载并运行前端UI
git clone https://gitee.com/log4j/pig-ui.git

cd pig-ui && npm install  --registry=https://registry.npmmirror.com

npm install && npm run build:docker && cd docker && docker compose up -d

免费公开课

开源共建

开源协议

pig 开源软件遵循 Apache 2.0 协议。 允许商业使用,但务必保留类作者、Copyright 信息。

其他说明

  1. 欢迎提交 PR,注意对应提交对应 dev 分支 代码规范 spring-javaformat

    代码规范说明
    1. 由于 spring-javaformat 强制所有代码按照指定格式排版,未按此要求提交的代码将不能通过合并(打包)
    2. 如果使用 IntelliJ IDEA 开发,请安装自动格式化软件 spring-javaformat-intellij-idea-plugin
    3. 其他开发工具,请参考 spring-javaformat 说明,或提交代码前在项目根目录运行下列命令(需要开发者电脑支持mvn命令)进行代码格式化
      mvn spring-javaformat:apply
      
  2. 欢迎提交 issue,请写清楚遇到问题的原因、开发环境、复显步骤。