diff --git a/pigx-app-server/pigx-app-server-api/pom.xml b/pigx-app-server/pigx-app-server-api/pom.xml new file mode 100644 index 000000000..c90a07fbe --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + com.pig4cloud + pigx-app-server + 4.5.0 + + + pigx-app-server-api + + + + + com.pig4cloud + pigx-common-core + + + + com.baomidou + mybatis-plus-extension + + + + com.pig4cloud + pigx-common-feign + + + + com.pig4cloud + pigx-common-excel + + + diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java new file mode 100644 index 000000000..237e2c19f --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java @@ -0,0 +1,22 @@ +package com.pig4cloud.pigx.app.api.dto; + +import com.pig4cloud.pigx.app.api.entity.AppUser; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@ApiModel(value = "APP用户传输对象") +@EqualsAndHashCode(callSuper = true) +public class AppUserDTO extends AppUser { + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色id集合") + private List role; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java new file mode 100644 index 000000000..600905885 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 菜单权限表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Data +@TableName("app_menu") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "菜单权限表") +public class AppMenu extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "菜单ID") + private Long menuId; + + /** + * name + */ + @ApiModelProperty(value = "name") + private String name; + + /** + * permission + */ + @ApiModelProperty(value = "permission") + private String permission; + + /** + * path + */ + @ApiModelProperty(value = "path") + private String path; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long parentId; + + /** + * 是否显示 + */ + @ApiModelProperty(value = "是否显示") + private String visible; + + /** + * 排序值 + */ + @ApiModelProperty(value = "排序值") + private Integer sortOrder; + + /** + * menuType + */ + @ApiModelProperty(value = "menuType") + private String menuType; + + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty(value = "修改人") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + /** + * delFlag + */ + @ApiModelProperty(value = "delFlag") + private String delFlag; + + /** + * 租户ID + */ + @ApiModelProperty(value = "租户ID", hidden = true) + private Long tenantId; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRole.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRole.java new file mode 100644 index 000000000..ccf9e312d --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRole.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * app角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Data +@TableName("app_role") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "app角色表") +public class AppRole extends Model { + + private static final long serialVersionUID = 1L; + + /** + * roleId + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "roleId") + private Long roleId; + + /** + * roleName + */ + @ApiModelProperty(value = "roleName") + private String roleName; + + /** + * roleCode + */ + @ApiModelProperty(value = "roleCode") + private String roleCode; + + /** + * roleDesc + */ + @ApiModelProperty(value = "roleDesc") + private String roleDesc; + + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String createBy; + + /** + * 修改人 + */ + @ApiModelProperty(value = "修改人") + private String updateBy; + + /** + * createTime + */ + @ApiModelProperty(value = "createTime") + private LocalDateTime createTime; + + /** + * updateTime + */ + @ApiModelProperty(value = "updateTime") + private LocalDateTime updateTime; + + /** + * delFlag + */ + @ApiModelProperty(value = "delFlag") + private String delFlag; + + /** + * tenantId + */ + @ApiModelProperty(value = "tenantId", hidden = true) + private Long tenantId; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java new file mode 100644 index 000000000..28e650023 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色菜单表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Data +@TableName("app_role_menu") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "角色菜单表") +public class AppRoleMenu extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "角色ID") + private Long roleId; + + /** + * 菜单ID + */ + @ApiModelProperty(value = "菜单ID") + private Long menuId; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUser.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUser.java new file mode 100644 index 000000000..715dfc8a8 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUser.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * app用户表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Data +@TableName("app_user") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "app用户表") +public class AppUser extends Model { + + private static final long serialVersionUID = 1L; + + /** + * userId + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "userId") + private Long userId; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + private String password; + + /** + * 随机盐 + */ + @JsonIgnore + @ApiModelProperty(value = "随机盐") + private String salt; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phone; + + /** + * 头像 + */ + @ApiModelProperty(value = "头像") + private String avatar; + + /** + * 昵称 + */ + @ApiModelProperty(value = "拓展字段:昵称") + private String nickname; + + /** + * 姓名 + */ + @ApiModelProperty(value = "拓展字段:姓名") + private String name; + + /** + * 邮箱 + */ + @ApiModelProperty(value = "拓展字段:邮箱") + private String email; + + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 修改人 + */ + @ApiModelProperty(value = "修改人") + @TableField(fill = FieldFill.UPDATE) + private String updateBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 删除标记 + */ + @ApiModelProperty(value = "删除标记,1:已删除,0:正常") + @TableField(fill = FieldFill.INSERT) + @TableLogic + private String delFlag; + + /** + * 所属租户 + */ + @ApiModelProperty(value = "所属租户", hidden = true) + private Long tenantId; + + /** + * 最后一次密码修改时间 + */ + @ApiModelProperty(value = "最后一次密码修改时间") + private LocalDateTime lastModifiedTime; + + /** + * 锁定标记 + */ + @ApiModelProperty(value = "锁定标记") + private String lockFlag; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUserRole.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUserRole.java new file mode 100644 index 000000000..0e2eea27c --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppUserRole.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Data +@TableName("app_user_role") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "用户角色表") +public class AppUserRole extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "用户ID") + private Long userId; + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID") + private Long roleId; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserExcelVO.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserExcelVO.java new file mode 100644 index 000000000..8b847f95b --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserExcelVO.java @@ -0,0 +1,83 @@ +package com.pig4cloud.pigx.app.api.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.pig4cloud.pigx.common.excel.annotation.ExcelLine; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +@Data +@ColumnWidth(30) +public class AppUserExcelVO { + + /** + * 导入时候回显行号 + */ + @ExcelLine + @ExcelIgnore + private Long lineNum; + + /** + * 主键ID + */ + @ExcelProperty("用户编号") + private Long userId; + + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + @ExcelProperty("用户名") + private String username; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + @ExcelProperty("手机号") + private String phone; + + /** + * 手机号 + */ + @NotBlank(message = "昵称不能为空") + @ExcelProperty("昵称") + private String nickname; + + /** + * 手机号 + */ + @NotBlank(message = "姓名不能为空") + @ExcelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @NotBlank(message = "邮箱不能为空") + @ExcelProperty("邮箱") + private String email; + + /** + * 角色列表 + */ + @NotBlank(message = "角色不能为空") + @ExcelProperty("角色") + private String roleNameList; + + /** + * 锁定标记 + */ + @ExcelProperty("锁定标记,0:正常,9:已锁定") + private String lockFlag; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private LocalDateTime createTime; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserVo.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserVo.java new file mode 100644 index 000000000..2b7a4fa08 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/vo/AppUserVo.java @@ -0,0 +1,101 @@ +package com.pig4cloud.pigx.app.api.vo; + +import com.pig4cloud.pigx.app.api.entity.AppRole; +import com.pig4cloud.pigx.common.core.sensitive.Sensitive; +import com.pig4cloud.pigx.common.core.sensitive.SensitiveTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class AppUserVo implements Serializable { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private Long userId; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + private String password; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + @Sensitive(type = SensitiveTypeEnum.MOBILE_PHONE) + private String phone; + + /** + * 头像 + */ + @ApiModelProperty(value = "头像") + private String avatar; + + /** + * 昵称 + */ + @ApiModelProperty(value = "拓展字段:昵称") + private String nickname; + + /** + * 姓名 + */ + @ApiModelProperty(value = "拓展字段:姓名") + private String name; + + /** + * 邮箱 + */ + @ApiModelProperty(value = "拓展字段:邮箱") + private String email; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + /** + * 删除标记 + */ + @ApiModelProperty(value = "删除标记,1:已删除,0:正常") + private String delFlag; + + /** + * 所属租户 + */ + @ApiModelProperty(value = "所属租户") + private Long tenantId; + + /** + * 最后一次密码修改时间 + */ + @ApiModelProperty(value = "最后一次密码修改时间") + private LocalDateTime lastModifiedTime; + + /** + * 锁定标记 + */ + @ApiModelProperty(value = "锁定标记") + private String lockFlag; + + /** + * 角色列表 + */ + @ApiModelProperty(value = "拥有的角色列表") + private List roleList; + +} diff --git a/pigx-app-server/pigx-app-server-biz/pom.xml b/pigx-app-server/pigx-app-server-biz/pom.xml new file mode 100644 index 000000000..b2a89162b --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + + com.pig4cloud + pigx-app-server + 4.5.0 + + + pigx-app-server-biz + + + + + org.springframework.boot + spring-boot-starter-undertow + + + + org.springframework.boot + spring-boot-starter-web + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.pig4cloud + pigx-common-data + + + + com.pig4cloud + pigx-common-security + + + + com.pig4cloud + pigx-common-xss + + + + com.pig4cloud + pigx-common-sentinel + + + + com.pig4cloud + pigx-common-feign + + + + com.pig4cloud + pigx-app-server-api + 4.5.0 + + + + com.pig4cloud + pigx-common-log + + + + com.baomidou + mybatis-plus-boot-starter + + + + com.alibaba + druid-spring-boot-starter + + + + mysql + mysql-connector-java + + + + com.pig4cloud + pigx-common-swagger + + + + org.springframework.boot + spring-boot-starter-test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/PigxAppApplication.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/PigxAppApplication.java new file mode 100644 index 000000000..5d737d3ed --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/PigxAppApplication.java @@ -0,0 +1,26 @@ +package com.pig4cloud.pigx.app; + +import com.pig4cloud.pigx.common.feign.annotation.EnablePigxFeignClients; +import com.pig4cloud.pigx.common.security.annotation.EnablePigxResourceServer; +import com.pig4cloud.pigx.common.swagger.annotation.EnablePigxSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +/** + * @author pigx archetype + *

+ * 项目启动类 + */ +@EnablePigxSwagger2 +@EnablePigxFeignClients +@EnableDiscoveryClient +@EnablePigxResourceServer +@SpringBootApplication +public class PigxAppApplication { + + public static void main(String[] args) { + SpringApplication.run(PigxAppApplication.class, args); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java new file mode 100644 index 000000000..378d3e693 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.app.api.entity.AppMenu; +import com.pig4cloud.pigx.app.service.AppMenuService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 菜单权限表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appmenu") +@Api(value = "appmenu", tags = "菜单权限表管理") +public class AppMenuController { + + private final AppMenuService appMenuService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appMenu 菜单权限表 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('app_appmenu_view')") + public R getAppMenuPage(Page page, AppMenu appMenu) { + return R.ok(appMenuService.page(page, Wrappers.query(appMenu))); + } + + /** + * 通过id查询菜单权限表 + * @param menuId id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{menuId}") + @PreAuthorize("@pms.hasPermission('app_appmenu_view')") + public R getById(@PathVariable("menuId") Long menuId) { + return R.ok(appMenuService.getById(menuId)); + } + + /** + * 新增菜单权限表 + * @param appMenu 菜单权限表 + * @return R + */ + @ApiOperation(value = "新增菜单权限表", notes = "新增菜单权限表") + @SysLog("新增菜单权限表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appmenu_add')") + public R save(@RequestBody AppMenu appMenu) { + return R.ok(appMenuService.save(appMenu)); + } + + /** + * 修改菜单权限表 + * @param appMenu 菜单权限表 + * @return R + */ + @ApiOperation(value = "修改菜单权限表", notes = "修改菜单权限表") + @SysLog("修改菜单权限表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appmenu_edit')") + public R updateById(@RequestBody AppMenu appMenu) { + return R.ok(appMenuService.updateById(appMenu)); + } + + /** + * 通过id删除菜单权限表 + * @param menuId id + * @return R + */ + @ApiOperation(value = "通过id删除菜单权限表", notes = "通过id删除菜单权限表") + @SysLog("通过id删除菜单权限表") + @DeleteMapping("/{menuId}") + @PreAuthorize("@pms.hasPermission('app_appmenu_del')") + public R removeById(@PathVariable Long menuId) { + return R.ok(appMenuService.removeById(menuId)); + } + + /** + * 导出excel 表格 + * @param appMenu 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appmenu_export')") + public List export(AppMenu appMenu) { + return appMenuService.list(Wrappers.query(appMenu)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java new file mode 100644 index 000000000..4ffc99d5d --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.app.api.entity.AppRole; +import com.pig4cloud.pigx.app.service.AppRoleService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * app角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/approle") +@Api(value = "approle", tags = "app角色表管理") +public class AppRoleController { + + private final AppRoleService appRoleService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appRole app角色表 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('app_approle_view')") + public R getAppRolePage(Page page, AppRole appRole) { + return R.ok(appRoleService.page(page, Wrappers.query(appRole))); + } + + /** + * 查询全部角色 + * @return + */ + @ApiOperation(value = "查询全部", notes = "查询全部") + @GetMapping("/list") + public R list() { + return R.ok(appRoleService.list(Wrappers.emptyWrapper())); + } + + /** + * 通过id查询app角色表 + * @param roleId id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{roleId}") + @PreAuthorize("@pms.hasPermission('app_approle_view')") + public R getById(@PathVariable("roleId") Long roleId) { + return R.ok(appRoleService.getById(roleId)); + } + + /** + * 新增app角色表 + * @param appRole app角色表 + * @return R + */ + @ApiOperation(value = "新增app角色表", notes = "新增app角色表") + @SysLog("新增app角色表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_approle_add')") + public R save(@RequestBody AppRole appRole) { + return R.ok(appRoleService.save(appRole)); + } + + /** + * 修改app角色表 + * @param appRole app角色表 + * @return R + */ + @ApiOperation(value = "修改app角色表", notes = "修改app角色表") + @SysLog("修改app角色表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_approle_edit')") + public R updateById(@RequestBody AppRole appRole) { + return R.ok(appRoleService.updateById(appRole)); + } + + /** + * 通过id删除app角色表 + * @param roleId id + * @return R + */ + @ApiOperation(value = "通过id删除app角色表", notes = "通过id删除app角色表") + @SysLog("通过id删除app角色表") + @DeleteMapping("/{roleId}") + @PreAuthorize("@pms.hasPermission('app_approle_del')") + public R removeById(@PathVariable Long roleId) { + return R.ok(appRoleService.removeById(roleId)); + } + + /** + * 导出excel 表格 + * @param appRole 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_approle_export')") + public List export(AppRole appRole) { + return appRoleService.list(Wrappers.query(appRole)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java new file mode 100644 index 000000000..158ee7576 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; +import com.pig4cloud.pigx.app.service.AppRoleMenuService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 角色菜单表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/approlemenu") +@Api(value = "approlemenu", tags = "角色菜单表管理") +public class AppRoleMenuController { + + private final AppRoleMenuService appRoleMenuService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appRoleMenu 角色菜单表 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('app_approlemenu_view')") + public R getAppRoleMenuPage(Page page, AppRoleMenu appRoleMenu) { + return R.ok(appRoleMenuService.page(page, Wrappers.query(appRoleMenu))); + } + + /** + * 通过id查询角色菜单表 + * @param roleId id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{roleId}") + @PreAuthorize("@pms.hasPermission('app_approlemenu_view')") + public R getById(@PathVariable("roleId") Long roleId) { + return R.ok(appRoleMenuService.getById(roleId)); + } + + /** + * 新增角色菜单表 + * @param appRoleMenu 角色菜单表 + * @return R + */ + @ApiOperation(value = "新增角色菜单表", notes = "新增角色菜单表") + @SysLog("新增角色菜单表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_approlemenu_add')") + public R save(@RequestBody AppRoleMenu appRoleMenu) { + return R.ok(appRoleMenuService.save(appRoleMenu)); + } + + /** + * 修改角色菜单表 + * @param appRoleMenu 角色菜单表 + * @return R + */ + @ApiOperation(value = "修改角色菜单表", notes = "修改角色菜单表") + @SysLog("修改角色菜单表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_approlemenu_edit')") + public R updateById(@RequestBody AppRoleMenu appRoleMenu) { + return R.ok(appRoleMenuService.updateById(appRoleMenu)); + } + + /** + * 通过id删除角色菜单表 + * @param roleId id + * @return R + */ + @ApiOperation(value = "通过id删除角色菜单表", notes = "通过id删除角色菜单表") + @SysLog("通过id删除角色菜单表") + @DeleteMapping("/{roleId}") + @PreAuthorize("@pms.hasPermission('app_approlemenu_del')") + public R removeById(@PathVariable Long roleId) { + return R.ok(appRoleMenuService.removeById(roleId)); + } + + /** + * 导出excel 表格 + * @param appRoleMenu 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_approlemenu_export')") + public List export(AppRoleMenu appRoleMenu) { + return appRoleMenuService.list(Wrappers.query(appRoleMenu)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java new file mode 100644 index 000000000..3c37a259b --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.app.api.dto.AppUserDTO; +import com.pig4cloud.pigx.app.api.vo.AppUserExcelVO; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.app.api.entity.AppUser; +import com.pig4cloud.pigx.app.service.AppUserService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * app用户表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appuser") +@Api(value = "appuser", tags = "app用户表管理") +public class AppUserController { + + private final AppUserService appUserService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appUserDTO app用户表 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + public R getAppUserPage(Page page, AppUserDTO appUserDTO) { + return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO)); + } + + /** + * 通过id查询app用户表 + * @param userId id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{userId}") + public R getById(@PathVariable("userId") Long userId) { + return R.ok(appUserService.getById(userId)); + } + + /** + * 新增app用户表 + * @param appUser app用户表 + * @return R + */ + @ApiOperation(value = "新增app用户表", notes = "新增app用户表") + @SysLog("新增app用户表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appuser_add')") + public R save(@RequestBody AppUserDTO appUser) { + return R.ok(appUserService.saveUser(appUser)); + } + + /** + * 修改app用户表 + * @param appUser app用户表 + * @return R + */ + @ApiOperation(value = "修改app用户表", notes = "修改app用户表") + @SysLog("修改app用户表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appuser_edit')") + public R updateById(@RequestBody AppUserDTO appUser) { + return R.ok(appUserService.updateUser(appUser)); + } + + /** + * 通过id删除app用户表 + * @param userId id + * @return R + */ + @ApiOperation(value = "通过id删除app用户表", notes = "通过id删除app用户表") + @SysLog("通过id删除app用户表") + @DeleteMapping("/{userId}") + @PreAuthorize("@pms.hasPermission('app_appuser_del')") + public R removeById(@PathVariable Long userId) { + return R.ok(appUserService.deleteUserById(userId)); + } + + /** + * 导出excel 表格 + * @param appUser 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appuser_export')") + public List export(AppUserDTO appUser) { + return appUserService.listUser(appUser); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserRoleController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserRoleController.java new file mode 100644 index 000000000..e1e0b1e23 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserRoleController.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.app.api.entity.AppUserRole; +import com.pig4cloud.pigx.app.service.AppUserRoleService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 用户角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appuserrole") +@Api(value = "appuserrole", tags = "用户角色表管理") +public class AppUserRoleController { + + private final AppUserRoleService appUserRoleService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appUserRole 用户角色表 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('app_appuserrole_view')") + public R getAppUserRolePage(Page page, AppUserRole appUserRole) { + return R.ok(appUserRoleService.page(page, Wrappers.query(appUserRole))); + } + + /** + * 通过id查询用户角色表 + * @param userId id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{userId}") + @PreAuthorize("@pms.hasPermission('app_appuserrole_view')") + public R getById(@PathVariable("userId") Long userId) { + return R.ok(appUserRoleService.getById(userId)); + } + + /** + * 新增用户角色表 + * @param appUserRole 用户角色表 + * @return R + */ + @ApiOperation(value = "新增用户角色表", notes = "新增用户角色表") + @SysLog("新增用户角色表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appuserrole_add')") + public R save(@RequestBody AppUserRole appUserRole) { + return R.ok(appUserRoleService.save(appUserRole)); + } + + /** + * 修改用户角色表 + * @param appUserRole 用户角色表 + * @return R + */ + @ApiOperation(value = "修改用户角色表", notes = "修改用户角色表") + @SysLog("修改用户角色表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appuserrole_edit')") + public R updateById(@RequestBody AppUserRole appUserRole) { + return R.ok(appUserRoleService.updateById(appUserRole)); + } + + /** + * 通过id删除用户角色表 + * @param userId id + * @return R + */ + @ApiOperation(value = "通过id删除用户角色表", notes = "通过id删除用户角色表") + @SysLog("通过id删除用户角色表") + @DeleteMapping("/{userId}") + @PreAuthorize("@pms.hasPermission('app_appuserrole_del')") + public R removeById(@PathVariable Long userId) { + return R.ok(appUserRoleService.removeById(userId)); + } + + /** + * 导出excel 表格 + * @param appUserRole 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appuserrole_export')") + public List export(AppUserRole appUserRole) { + return appUserRoleService.list(Wrappers.query(appUserRole)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java new file mode 100644 index 000000000..d015ef12c --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import com.pig4cloud.pigx.app.api.entity.AppMenu; +import org.apache.ibatis.annotations.Mapper; + +/** + * 菜单权限表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Mapper +public interface AppMenuMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMapper.java new file mode 100644 index 000000000..895e84211 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMapper.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import com.pig4cloud.pigx.app.api.entity.AppRole; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * app角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Mapper +public interface AppRoleMapper extends PigxBaseMapper { + + List listRolesByUserId(Long userId); + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java new file mode 100644 index 000000000..f5631ef38 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色菜单表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Mapper +public interface AppRoleMenuMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserMapper.java new file mode 100644 index 000000000..9b70a8b70 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserMapper.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.app.api.dto.AppUserDTO; +import com.pig4cloud.pigx.app.api.vo.AppUserVo; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import com.pig4cloud.pigx.app.api.entity.AppUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * app用户表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Mapper +public interface AppUserMapper extends PigxBaseMapper { + + IPage getUserVosPage(Page page, @Param("query") AppUserDTO appUserDTO); + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserRoleMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserRoleMapper.java new file mode 100644 index 000000000..249df7e42 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppUserRoleMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import com.pig4cloud.pigx.app.api.entity.AppUserRole; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Mapper +public interface AppUserRoleMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java new file mode 100644 index 000000000..e491e0b72 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppMenu; + +/** + * 菜单权限表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +public interface AppMenuService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java new file mode 100644 index 000000000..18d8590bf --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; + +/** + * 角色菜单表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +public interface AppRoleMenuService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java new file mode 100644 index 000000000..595723d4a --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppRole; + +/** + * app角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +public interface AppRoleService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserRoleService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserRoleService.java new file mode 100644 index 000000000..23c941411 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserRoleService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppUserRole; + +/** + * 用户角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +public interface AppUserRoleService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java new file mode 100644 index 000000000..67f97ceeb --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.dto.AppUserDTO; +import com.pig4cloud.pigx.app.api.entity.AppUser; +import com.pig4cloud.pigx.app.api.vo.AppUserExcelVO; + +import java.util.List; + +/** + * app用户表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +public interface AppUserService extends IService { + + Boolean updateUser(AppUserDTO appUser); + + Boolean saveUser(AppUserDTO appUser); + + List listUser(AppUserDTO appUser); + + IPage getUsersWithRolePage(Page page, AppUserDTO appUserDTO); + + Boolean deleteUserById(Long userId); + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java new file mode 100644 index 000000000..e787cfa15 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppMenu; +import com.pig4cloud.pigx.app.mapper.AppMenuMapper; +import com.pig4cloud.pigx.app.service.AppMenuService; +import org.springframework.stereotype.Service; + +/** + * 菜单权限表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Service +public class AppMenuServiceImpl extends ServiceImpl implements AppMenuService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java new file mode 100644 index 000000000..e17370a43 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; +import com.pig4cloud.pigx.app.mapper.AppRoleMenuMapper; +import com.pig4cloud.pigx.app.service.AppRoleMenuService; +import org.springframework.stereotype.Service; + +/** + * 角色菜单表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Service +public class AppRoleMenuServiceImpl extends ServiceImpl implements AppRoleMenuService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java new file mode 100644 index 000000000..ee855f4af --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppRole; +import com.pig4cloud.pigx.app.mapper.AppRoleMapper; +import com.pig4cloud.pigx.app.service.AppRoleService; +import org.springframework.stereotype.Service; + +/** + * app角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Service +public class AppRoleServiceImpl extends ServiceImpl implements AppRoleService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserRoleServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserRoleServiceImpl.java new file mode 100644 index 000000000..bc31adebc --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserRoleServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppUserRole; +import com.pig4cloud.pigx.app.mapper.AppUserRoleMapper; +import com.pig4cloud.pigx.app.service.AppUserRoleService; +import org.springframework.stereotype.Service; + +/** + * 用户角色表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Service +public class AppUserRoleServiceImpl extends ServiceImpl implements AppUserRoleService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java new file mode 100644 index 000000000..b234549cd --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.app.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.admin.api.entity.SysRole; +import com.pig4cloud.pigx.admin.api.entity.SysUserRole; +import com.pig4cloud.pigx.app.api.dto.AppUserDTO; +import com.pig4cloud.pigx.app.api.entity.AppUser; +import com.pig4cloud.pigx.app.api.entity.AppUserRole; +import com.pig4cloud.pigx.app.mapper.AppUserMapper; +import com.pig4cloud.pigx.app.service.AppUserRoleService; +import com.pig4cloud.pigx.app.service.AppUserService; +import com.pig4cloud.pigx.app.api.vo.AppUserExcelVO; +import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.data.resolver.ParamResolver; +import lombok.AllArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * app用户表 + * + * @author aeizzz + * @date 2022-12-07 09:52:03 + */ +@Service +@AllArgsConstructor +public class AppUserServiceImpl extends ServiceImpl implements AppUserService { + + private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder(); + + private final AppUserRoleService appUserRoleService; + + /** + * 更新用户 + * @param userDTO + * @return + */ + @Override + public Boolean updateUser(AppUserDTO userDTO) { + + AppUser appUser = new AppUser(); + BeanUtils.copyProperties(userDTO, appUser); + if (StrUtil.isNotBlank(userDTO.getPassword())) { + appUser.setPassword(ENCODER.encode(userDTO.getPassword())); + } + this.updateById(appUser); + + appUserRoleService.remove(Wrappers.lambdaQuery().eq(AppUserRole::getUserId, appUser.getUserId())); + userDTO.getRole().forEach(roleId -> { + AppUserRole appUserRole = new AppUserRole(); + appUserRole.setRoleId(roleId); + appUserRole.setUserId(userDTO.getUserId()); + appUserRole.insert(); + }); + return Boolean.TRUE; + } + + /** + * 新增用户 + * @param userDTO + * @return + */ + @Override + public Boolean saveUser(AppUserDTO userDTO) { + AppUser appUser = new AppUser(); + BeanUtils.copyProperties(userDTO, appUser); + appUser.setDelFlag(CommonConstants.STATUS_NORMAL); + appUser.setPassword(ENCODER.encode(userDTO.getPassword())); + baseMapper.insert(appUser); + // 如果角色为空,赋默认角色 + if (CollUtil.isNotEmpty(userDTO.getRole())) { + List userRoleList = userDTO.getRole().stream().map(roleId -> { + AppUserRole userRole = new AppUserRole(); + userRole.setUserId(userDTO.getUserId()); + userRole.setRoleId(roleId); + return userRole; + }).collect(Collectors.toList()); + appUserRoleService.saveBatch(userRoleList); + } + return Boolean.TRUE; + } + + /** + * 查询全部的用户 + * @param appUser + * @return + */ + @Override + public List listUser(AppUserDTO appUser) { + List appUsers = baseMapper.selectList(null); + List appUserExcelVOS = appUsers.stream().map(item -> { + AppUserExcelVO appUserExcelVO = new AppUserExcelVO(); + BeanUtils.copyProperties(item, appUserExcelVO); + return appUserExcelVO; + }).collect(Collectors.toList()); + return appUserExcelVOS; + } + + @Override + public IPage getUsersWithRolePage(Page page, AppUserDTO appUserDTO) { + return baseMapper.getUserVosPage(page, appUserDTO); + } + + @Override + public Boolean deleteUserById(Long userId) { + baseMapper.deleteById(userId); + appUserRoleService.removeById(Wrappers.lambdaQuery().eq(AppUserRole::getUserId, userId)); + + return Boolean.TRUE; + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml b/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml new file mode 100644 index 000000000..66d7e45c0 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml @@ -0,0 +1,16 @@ +server: + port: 6060 + +spring: + application: + name: @artifactId@ + cloud: + nacos: + discovery: + server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848} + config: + server-addr: ${spring.cloud.nacos.discovery.server-addr} + config: + import: + - optional:nacos:application-@profiles.active@.yml + - optional:nacos:${spring.application.name}-@profiles.active@.yml diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/logback-spring.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..964ca8735 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/logback-spring.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + + + + + + ${log.path}/debug.log + + ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + + + + + + ${log.path}/error.log + + ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + + + ERROR + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml new file mode 100644 index 000000000..51381d063 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml new file mode 100644 index 000000000..0da7d0018 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml new file mode 100644 index 000000000..e974c1d8f --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserMapper.xml new file mode 100644 index 000000000..c2d0f5d2a --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml new file mode 100644 index 000000000..4f3fba829 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/pigx-app-server/pom.xml b/pigx-app-server/pom.xml new file mode 100644 index 000000000..4afdebf58 --- /dev/null +++ b/pigx-app-server/pom.xml @@ -0,0 +1,21 @@ + + + + 4.0.0 + + + com.pig4cloud + pigx + 4.5.0 + + + pigx-app-server + pom + + + + pigx-app-server-api + pigx-app-server-biz + + diff --git a/pom.xml b/pom.xml index 0caaba0c7..97a4c1b63 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ - - + - + --> 4.0.0 com.pig4cloud @@ -64,29 +61,29 @@ admin Harbor12345 0.33.0 - + false - + org.springframework.boot spring-boot-configuration-processor true - + com.github.ulisesbocchio jasypt-spring-boot-starter ${jasypt.version} - + org.springframework.boot spring-boot-starter-actuator - + de.codecentric spring-boot-admin-starter-client @@ -104,7 +101,7 @@ jaxb-impl ${jaxb.version} - + org.springframework.boot spring-boot-starter-test @@ -119,11 +116,12 @@ pigx-upms pigx-common pigx-visual - + pigx-app-server + - + com.pig4cloud pigx-common-bom @@ -131,7 +129,7 @@ pom import - + org.springframework.boot spring-boot-dependencies @@ -139,7 +137,7 @@ pom import - + org.springframework.cloud spring-cloud-dependencies @@ -155,13 +153,13 @@ pom import - + org.springframework.boot spring-boot-starter-web ${spring-boot.version} - + spring-boot-starter-tomcat org.springframework.boot @@ -181,7 +179,7 @@ - + org.springframework.boot spring-boot-maven-plugin @@ -194,7 +192,7 @@ - + io.fabric8 docker-maven-plugin @@ -221,13 +219,13 @@ - + io.spring.javaformat spring-javaformat-maven-plugin ${spring.checkstyle.version} - + org.apache.maven.plugins maven-compiler-plugin @@ -239,7 +237,7 @@ true - + pl.project13.maven git-commit-id-plugin @@ -248,7 +246,7 @@ - + rdc-releases @@ -288,11 +286,11 @@ dev - + dev - + true