1.初始化版本,2.引入thirdpart模块,引入canteen模块,初始化菜品分类,spu
This commit is contained in:
commit
aff77150d6
1595 files changed
+168833
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-app-server</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-app-server-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--core 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis plus extension,包含了mybatis plus core-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring</artifactId>
|
||||
</dependency>
|
||||
<!--feign 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 -->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-excel</artifactId>
|
||||
</dependency>
|
||||
<!-- 脱敏工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.bsd.pjcloud.app.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "APP用户传输对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppUserDTO extends AppUser {
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@Schema(description = "角色id集合")
|
||||
private List<Long> role;
|
||||
|
||||
/**
|
||||
* 新密码
|
||||
*/
|
||||
@Schema(description = "新密码")
|
||||
private String newpassword1;
|
||||
|
||||
@Schema(description = "验证码")
|
||||
private String mobileCode;
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2017/11/11
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户信息")
|
||||
public class AppUserInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户基本信息
|
||||
*/
|
||||
@Schema(description = "用户基本信息")
|
||||
private AppUser appUser;
|
||||
|
||||
/**
|
||||
* 权限标识集合
|
||||
*/
|
||||
@Schema(description = "权限标识集合")
|
||||
private String[] permissions;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private Long[] roles;
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 文章分类表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:28:03
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_article_category")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "文章分类表")
|
||||
public class AppArticleCategoryEntity extends Model<AppArticleCategoryEntity> {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否显示: 0=否, 1=是
|
||||
*/
|
||||
@Schema(description = "是否显示: 0=否, 1=是")
|
||||
private Integer isShow;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除: 0=否, 1=是
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "是否删除: 0=否, 1=是")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 文章收藏表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-16 14:33:41
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_article_collect")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "文章收藏表")
|
||||
public class AppArticleCollectEntity extends Model<AppArticleCollectEntity> {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 文章ID
|
||||
*/
|
||||
@Schema(description = "文章ID")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 文章标题
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "是否删除")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 文章资讯
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:32:35
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@FieldNameConstants
|
||||
@TableName("app_article")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "文章资讯")
|
||||
public class AppArticleEntity extends Model<AppArticleEntity> {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@Schema(description = "分类")
|
||||
private Long cid;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@Schema(description = "简介")
|
||||
private String intro;
|
||||
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
@Schema(description = "摘要")
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
@Schema(description = "封面")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@Schema(description = "作者")
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 浏览
|
||||
*/
|
||||
@Schema(description = "浏览")
|
||||
private Integer visit;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标志")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 当前用户是否已收藏
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private boolean collect;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String cname;
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 页面
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023-06-08 11:19:23
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_page")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "页面")
|
||||
public class AppPageEntity extends Model<AppPageEntity> {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面类型
|
||||
*/
|
||||
@Schema(description = "页面类型")
|
||||
private Integer pageType;
|
||||
|
||||
/**
|
||||
* 页面名称
|
||||
*/
|
||||
@Schema(description = "页面名称")
|
||||
private String pageName;
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
*/
|
||||
@Schema(description = "页面数据")
|
||||
private String pageData;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.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 com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* app角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_role")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "app角色表")
|
||||
public class AppRole extends Model<AppRole> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* roleId
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "roleId")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* roleName
|
||||
*/
|
||||
@Schema(description = "roleName")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* roleCode
|
||||
*/
|
||||
@Schema(description = "roleCode")
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* roleDesc
|
||||
*/
|
||||
@Schema(description = "roleDesc")
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* createTime
|
||||
*/
|
||||
@Schema(description = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* updateTime
|
||||
*/
|
||||
@Schema(description = "updateTime")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* delFlag
|
||||
*/
|
||||
@Schema(description = "delFlag")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* tenantId
|
||||
*/
|
||||
@Schema(description = "tenantId", hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.ValidGroup;
|
||||
import com.bsd.pjcloud.common.sensitive.annotation.Sensitive;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* app 社交账号登录
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "第三方账号信息")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppSocialDetails extends Model<AppSocialDetails> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主鍵
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@NotBlank(message = "类型不能为空")
|
||||
@Schema(description = "账号类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* appid
|
||||
*/
|
||||
@Sensitive(prefixNoMaskLen = 4, suffixNoMaskLen = 4)
|
||||
@NotBlank(message = "账号不能为空")
|
||||
@Schema(description = "appId")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* app_secret
|
||||
*/
|
||||
@Sensitive(prefixNoMaskLen = 4, suffixNoMaskLen = 4)
|
||||
@NotBlank(message = "密钥不能为空", groups = { ValidGroup.Insert.class })
|
||||
@Schema(description = "app secret")
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
@Schema(description = "回调地址")
|
||||
private String redirectUrl;
|
||||
|
||||
/**
|
||||
* 拓展字段
|
||||
*/
|
||||
@Schema(description = "拓展字段")
|
||||
private String ext;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记,1:已删除,0:正常")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonRawValue;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 导航栏
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023-06-08 11:18:46
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_tabbar")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "导航栏")
|
||||
public class AppTabbarEntity extends Model<AppTabbarEntity> {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 导航名称
|
||||
*/
|
||||
@Schema(description = "导航名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 未选图标
|
||||
*/
|
||||
@Schema(description = "未选图标")
|
||||
private String selected;
|
||||
|
||||
/**
|
||||
* 已选图标
|
||||
*/
|
||||
@Schema(description = "已选图标")
|
||||
private String unselected;
|
||||
|
||||
/**
|
||||
* 链接地址
|
||||
*/
|
||||
@Schema(description = "链接地址")
|
||||
@JsonRawValue
|
||||
@JsonDeserialize()
|
||||
private String link;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* app用户表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_user")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "app用户表")
|
||||
public class AppUser extends Model<AppUser> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* userId
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "userId")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Schema(description = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 随机盐
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Schema(description = "随机盐")
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "拓展字段:昵称")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "拓展字段:姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Schema(description = "拓展字段:邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(description = "修改人")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@Schema(description = "删除标记,1:已删除,0:正常")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 所属租户
|
||||
*/
|
||||
@Schema(description = "所属租户", hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 最后一次密码修改时间
|
||||
*/
|
||||
@Schema(description = "最后一次密码修改时间")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
* 锁定标记
|
||||
*/
|
||||
@Schema(description = "锁定标记")
|
||||
private String lockFlag;
|
||||
|
||||
/**
|
||||
* 微信小程序登录openId
|
||||
*/
|
||||
@Schema(description = "微信小程序登录openId")
|
||||
private String wxOpenid;
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.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.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Data
|
||||
@TableName("app_user_role")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "用户角色表")
|
||||
public class AppUserRole extends Model<AppUserRole> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@Schema(description = "角色ID")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteAppUserService", value = ServiceNameConstants.APP_SERVER)
|
||||
public interface RemoteAppUserService {
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户、角色信息
|
||||
* @param username 用户名
|
||||
* @param from 调用标志
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/appuser/info/{username}")
|
||||
R<AppUserInfo> info(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
* @param inStr appid@code
|
||||
* @param from 调用标志
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/appsocial/info/{inStr}")
|
||||
R<AppUserInfo> social(@PathVariable("inStr") String inStr);
|
||||
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.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.bsd.pjcloud.common.excel.annotation.ExcelLine;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2020/2/10
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "前端角色展示对象")
|
||||
@ColumnWidth(30)
|
||||
public class AppRoleExcelVO {
|
||||
|
||||
/**
|
||||
* 导入时候回显行号
|
||||
*/
|
||||
@ExcelLine
|
||||
@ExcelIgnore
|
||||
private Long lineNum;
|
||||
|
||||
/**
|
||||
* roleName
|
||||
*/
|
||||
@ExcelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* roleCode
|
||||
*/
|
||||
@ExcelProperty("角色标识")
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* roleDesc
|
||||
*/
|
||||
@ExcelProperty("角色描述")
|
||||
private String roleDesc;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2020/2/10
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "前端角色展示对象")
|
||||
public class AppRoleVO {
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*/
|
||||
private String menuIds;
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.bsd.pjcloud.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.bsd.pjcloud.common.excel.annotation.ExcelLine;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.bsd.pjcloud.app.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.common.sensitive.annotation.Sensitive;
|
||||
import com.bsd.pjcloud.common.sensitive.core.SensitiveTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AppUserVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Schema(description = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
@Sensitive(type = SensitiveTypeEnum.MOBILE_PHONE)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "拓展字段:昵称")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "拓展字段:姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Schema(description = "拓展字段:邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@Schema(description = "删除标记,1:已删除,0:正常")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 所属租户
|
||||
*/
|
||||
@Schema(description = "所属租户")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 最后一次密码修改时间
|
||||
*/
|
||||
@Schema(description = "最后一次密码修改时间")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
* 锁定标记
|
||||
*/
|
||||
@Schema(description = "锁定标记")
|
||||
private String lockFlag;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*/
|
||||
@Schema(description = "拥有的角色列表")
|
||||
private List<AppRole> roleList;
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
com.bsd.pjcloud.app.api.feign.RemoteAppUserService
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis
|
||||
|
||||
MAINTAINER wangiegie@gmail.com
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV LANG C.UTF-8
|
||||
ENV JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom"
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN mkdir -p /pjcloud-app-server
|
||||
|
||||
WORKDIR /pjcloud-app-server
|
||||
|
||||
EXPOSE 7060
|
||||
|
||||
ADD ./target/pjcloud-app-server-biz.jar ./
|
||||
|
||||
CMD sleep 60;java $JAVA_OPTS -jar pjcloud-app-server-biz.jar
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-app-server</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-app-server-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--必备: undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--必备: spring boot web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 操作数据源相关-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-data</artifactId>
|
||||
</dependency>
|
||||
<!--必备:pjcloud安全模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-security</artifactId>
|
||||
</dependency>
|
||||
<!--必备:xss 过滤模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-xss</artifactId>
|
||||
</dependency>
|
||||
<!--必备: sentinel 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!--必备: feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 依赖api模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-app-server-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<!--必备: log 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-log</artifactId>
|
||||
</dependency>
|
||||
<!--选配: mybatis 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
<!--选配: druid 连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
</dependency>
|
||||
<!--选配: mysql 数据库驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<!--选配: swagger文档-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-swagger</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>cloud</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<loaderImplementation>CLASSIC</loaderImplementation>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>boot</id>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.app;
|
||||
|
||||
import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients;
|
||||
import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer;
|
||||
import com.bsd.pjcloud.common.swagger.annotation.EnableOpenApi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* @author pjcloud archetype
|
||||
* <p>
|
||||
* 项目启动类
|
||||
*/
|
||||
@EnableOpenApi("app")
|
||||
@EnablePjcloudFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@EnablePjcloudResourceServer
|
||||
@SpringBootApplication
|
||||
public class PjcloudAppApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PjcloudAppApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
|
||||
import com.bsd.pjcloud.app.service.AppArticleCategoryService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章分类表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:28:03
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appArticleCategory")
|
||||
@Tag(description = "appArticleCategory", name = "文章分类表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppArticleCategoryController {
|
||||
|
||||
private final AppArticleCategoryService appArticleCategoryService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appArticleCategory 文章分类表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@HasPermission("app_appArticleCategory_view")
|
||||
public R getAppArticleCategoryPage(@ParameterObject Page page,
|
||||
@ParameterObject AppArticleCategoryEntity appArticleCategory) {
|
||||
LambdaQueryWrapper<AppArticleCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(appArticleCategory.getName()), AppArticleCategoryEntity::getName,
|
||||
appArticleCategory.getName());
|
||||
return R.ok(appArticleCategoryService.page(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询文章分类表
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@HasPermission("app_appArticleCategory_view")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(appArticleCategoryService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过查询文章分类
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "查询文章分类", description = "查询文章分类")
|
||||
@Inner(value = false)
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
return R.ok(appArticleCategoryService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章分类表
|
||||
* @param appArticleCategory 文章分类表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增文章分类表", description = "新增文章分类表")
|
||||
@SysLog("新增文章分类表")
|
||||
@PostMapping
|
||||
@HasPermission("app_appArticleCategory_add")
|
||||
public R save(@RequestBody AppArticleCategoryEntity appArticleCategory) {
|
||||
return R.ok(appArticleCategoryService.save(appArticleCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章分类表
|
||||
* @param appArticleCategory 文章分类表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改文章分类表", description = "修改文章分类表")
|
||||
@SysLog("修改文章分类表")
|
||||
@PutMapping
|
||||
@HasPermission("app_appArticleCategory_edit")
|
||||
public R updateById(@RequestBody AppArticleCategoryEntity appArticleCategory) {
|
||||
return R.ok(appArticleCategoryService.updateById(appArticleCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除文章分类表
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除文章分类表", description = "通过id删除文章分类表")
|
||||
@SysLog("通过id删除文章分类表")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_appArticleCategory_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appArticleCategoryService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appArticleCategory 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_appArticleCategory_export")
|
||||
public List<AppArticleCategoryEntity> export(AppArticleCategoryEntity appArticleCategory) {
|
||||
return appArticleCategoryService.list(Wrappers.query(appArticleCategory));
|
||||
}
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
import com.bsd.pjcloud.app.service.AppArticleCollectService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章收藏表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-16 14:33:41
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/collect")
|
||||
@Tag(description = "collect", name = "文章收藏表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppArticleCollectController {
|
||||
|
||||
private final AppArticleCollectService appArticleCollectService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appArticleCollect 文章收藏表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getAppArticleCollectPage(@ParameterObject Page page) {
|
||||
MPJLambdaWrapper<AppArticleCollectEntity> wrapper = new MPJLambdaWrapper<AppArticleCollectEntity>()
|
||||
.selectAll(AppArticleCollectEntity.class)
|
||||
.select(AppArticleEntity::getTitle)
|
||||
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
|
||||
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
|
||||
return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询文章收藏表
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(appArticleCollectService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章收藏表
|
||||
* @param appArticleCollect 文章收藏表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增文章收藏表", description = "新增文章收藏表")
|
||||
@SysLog("新增文章收藏表")
|
||||
@PostMapping
|
||||
public R save(@RequestBody AppArticleCollectEntity appArticleCollect) {
|
||||
return R.ok(appArticleCollectService.saveArticleCollect(appArticleCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章收藏表
|
||||
* @param appArticleCollect 文章收藏表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改文章收藏表", description = "修改文章收藏表")
|
||||
@SysLog("修改文章收藏表")
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody AppArticleCollectEntity appArticleCollect) {
|
||||
return R.ok(appArticleCollectService.updateById(appArticleCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除文章收藏表
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除文章收藏表", description = "通过id删除文章收藏表")
|
||||
@SysLog("通过id删除文章收藏表")
|
||||
@DeleteMapping
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appArticleCollectService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过文章id删除文章收藏表", description = "通过文章id删除文章收藏表")
|
||||
@SysLog("通过文章id删除文章收藏表")
|
||||
@DeleteMapping("/{articleId}")
|
||||
public R removeByArticleId(@PathVariable String articleId) {
|
||||
Long id = SecurityUtils.getUser().getId();
|
||||
return R.ok(appArticleCollectService.remove(Wrappers.<AppArticleCollectEntity>lambdaQuery()
|
||||
.eq(AppArticleCollectEntity::getUserId, id)
|
||||
.eq(AppArticleCollectEntity::getArticleId, articleId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appArticleCollect 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_collect_export")
|
||||
public List<AppArticleCollectEntity> export(AppArticleCollectEntity appArticleCollect) {
|
||||
return appArticleCollectService.list(Wrappers.query(appArticleCollect));
|
||||
}
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
import com.bsd.pjcloud.app.service.AppArticleService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章资讯
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:32:35
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appArticle")
|
||||
@Tag(description = "appArticle", name = "文章资讯管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppArticleController {
|
||||
|
||||
private final AppArticleService appArticleService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appArticle 文章资讯
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@Inner(value = false)
|
||||
@GetMapping("/page")
|
||||
public R getAppArticlePage(@ParameterObject Page page, @ParameterObject AppArticleEntity appArticle) {
|
||||
return R.ok(appArticleService.pageAndCname(page, appArticle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询文章资讯
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/details/{id}/{userId}")
|
||||
public R getById(@PathVariable("id") Long id, @PathVariable(required = false) Long userId) {
|
||||
return R.ok(appArticleService.getArticleAndIncrById(id, userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章资讯
|
||||
* @param appArticle 文章资讯
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增文章资讯", description = "新增文章资讯")
|
||||
@SysLog("新增文章资讯")
|
||||
@PostMapping
|
||||
@HasPermission("app_appArticle_add")
|
||||
public R save(@RequestBody AppArticleEntity appArticle) {
|
||||
return R.ok(appArticleService.save(appArticle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章资讯
|
||||
* @param appArticle 文章资讯
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改文章资讯", description = "修改文章资讯")
|
||||
@SysLog("修改文章资讯")
|
||||
@PutMapping
|
||||
@HasPermission("app_appArticle_edit")
|
||||
public R updateById(@RequestBody AppArticleEntity appArticle) {
|
||||
return R.ok(appArticleService.updateById(appArticle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除文章资讯
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除文章资讯", description = "通过id删除文章资讯")
|
||||
@SysLog("通过id删除文章资讯")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_appArticle_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appArticleService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appArticle 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_appArticle_export")
|
||||
public List<AppArticleEntity> export(AppArticleEntity appArticle) {
|
||||
return appArticleService.list(Wrappers.query(appArticle));
|
||||
}
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
import com.bsd.pjcloud.app.service.AppIndexService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* app 首页控制
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/index")
|
||||
@Tag(description = "App 页面控制", name = "app index")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppIndexController {
|
||||
|
||||
private final AppIndexService indexService;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
* @return Object
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@GetMapping("/index")
|
||||
public R index() {
|
||||
Map<String, Object> detail = indexService.index();
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
@Inner(value = false)
|
||||
@GetMapping("/config")
|
||||
public R config() {
|
||||
Map<String, Object> map = indexService.config();
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
@Inner(value = false)
|
||||
@GetMapping("/decorate")
|
||||
public R decorate(@Validated @RequestParam("id") Integer id) {
|
||||
AppPageEntity detail = indexService.decorate(id);
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import com.bsd.pjcloud.app.service.AppMobileService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/14
|
||||
* <p>
|
||||
* 手机验证码
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/appmobile")
|
||||
@Tag(description = "mobile", name = "手机管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppMobileController {
|
||||
|
||||
private final AppMobileService appMobileService;
|
||||
|
||||
@Inner(value = false)
|
||||
@GetMapping("/{mobile}")
|
||||
public R sendSmsCode(@PathVariable String mobile) {
|
||||
return appMobileService.sendSmsCode(mobile);
|
||||
}
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
import com.bsd.pjcloud.app.service.AppPageService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 页面管理
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:32:35
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appPage")
|
||||
@Tag(description = "appPage", name = "页面管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppPageController {
|
||||
|
||||
private final AppPageService pageService;
|
||||
|
||||
/**
|
||||
* 查询文章资讯
|
||||
*
|
||||
* @param pageType pageType
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过页面类型查询", description = "通过页面类型查询")
|
||||
@GetMapping("/{pageType}")
|
||||
public R getByPageType(@PathVariable("pageType") Long pageType) {
|
||||
AppPageEntity appPage = pageService.getOne(Wrappers.<AppPageEntity>lambdaQuery().eq(AppPageEntity::getPageType, pageType));
|
||||
return R.ok(appPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param page 页面
|
||||
* @return {@link R }
|
||||
*/
|
||||
@Operation(summary = "更新页面", description = "更新页面")
|
||||
@PutMapping
|
||||
public R update(@RequestBody AppPageEntity page) {
|
||||
return R.ok(pageService.saveOrUpdate(page));
|
||||
}
|
||||
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
|
||||
import com.bsd.pjcloud.app.service.AppRoleService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/approle")
|
||||
@Tag(description = "approle", name = "app角色表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppRoleController {
|
||||
|
||||
private final AppRoleService appRoleService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appRole app角色表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getAppRolePage(Page page, AppRole appRole) {
|
||||
return R.ok(appRoleService.page(page, Wrappers.<AppRole>lambdaQuery()
|
||||
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部角色
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询全部", description = "查询全部")
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
return R.ok(appRoleService.list(Wrappers.emptyWrapper()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询app角色表
|
||||
* @param roleId id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{roleId}")
|
||||
public R getById(@PathVariable("roleId") Long roleId) {
|
||||
return R.ok(appRoleService.getById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过roleName查询app角色表
|
||||
* @param roleName roleName
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/details/{roleName}")
|
||||
public R getByUserName(@PathVariable("roleName") String roleName) {
|
||||
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleName, roleName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过roleCode查询app角色表
|
||||
* @param roleCode roleCode
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过roleCode查询", description = "通过roleCode查询")
|
||||
@GetMapping("/detailsByCode/{roleCode}")
|
||||
public R getByPhone(@PathVariable("roleCode") String roleCode) {
|
||||
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleCode, roleCode)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app角色表
|
||||
* @param appRole app角色表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增app角色表", description = "新增app角色表")
|
||||
@SysLog("新增app角色表")
|
||||
@PostMapping
|
||||
@HasPermission("app_approle_add")
|
||||
public R save(@RequestBody AppRole appRole) {
|
||||
return R.ok(appRoleService.save(appRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app角色表
|
||||
* @param appRole app角色表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改app角色表", description = "修改app角色表")
|
||||
@SysLog("修改app角色表")
|
||||
@PutMapping
|
||||
@HasPermission("app_approle_edit")
|
||||
public R updateById(@RequestBody AppRole appRole) {
|
||||
return R.ok(appRoleService.updateById(appRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ids批量删除app角色表
|
||||
* @param ids roleIds
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过ids批量删除app角色表", description = "通过ids批量删除app角色表")
|
||||
@SysLog("通过ids批量删除app角色表")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_approle_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appRoleService.deleteRoleByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appRole 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_approle_export")
|
||||
public List<AppRole> export(AppRole appRole) {
|
||||
return appRoleService.list(Wrappers.query(appRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入角色
|
||||
* @param excelVOList 角色列表
|
||||
* @param bindingResult 错误信息列表
|
||||
* @return ok fail
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
@HasPermission("app_approle_export")
|
||||
public R importRole(@RequestExcel List<AppRoleExcelVO> excelVOList, BindingResult bindingResult) {
|
||||
return appRoleService.importRole(excelVOList, bindingResult);
|
||||
}
|
||||
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
|
||||
import com.bsd.pjcloud.app.service.AppSocialDetailsService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.core.util.ValidGroup;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/appsocial")
|
||||
@AllArgsConstructor
|
||||
@Tag(description = "social", name = "三方账号管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppSocialDetailsController {
|
||||
|
||||
private final AppSocialDetailsService appSocialDetailsService;
|
||||
|
||||
/**
|
||||
* 社交登录账户简单分页查询
|
||||
* @param page 分页对象
|
||||
* @param appSocialDetails 社交登录
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getSocialDetailsPage(Page page, AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.page(page, Wrappers.query(appSocialDetails)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R getinfo(@PathVariable("id") Long id) {
|
||||
return R.ok(appSocialDetailsService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param appSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("保存三方信息")
|
||||
@PostMapping
|
||||
@HasPermission("app_social_details_add")
|
||||
public R save(@Valid @RequestBody AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.save(appSocialDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param appSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("修改三方信息")
|
||||
@PutMapping
|
||||
@HasPermission("app_social_details_edit")
|
||||
public R updateById(@Validated({ ValidGroup.Update.class }) @RequestBody AppSocialDetails appSocialDetails) {
|
||||
appSocialDetailsService.updateById(appSocialDetails);
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除三方信息")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_social_details_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appSocialDetailsService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过社交账号、手机号查询用户、角色信息
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/info/{inStr}")
|
||||
public R getUserInfo(@PathVariable String inStr) {
|
||||
return R.ok(appSocialDetailsService.getUserInfo(inStr));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
* @param state 类型
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public R bindSocial(String state, String code) {
|
||||
return R.ok(appSocialDetailsService.bindSocial(state, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel
|
||||
public List<AppSocialDetails> export(AppSocialDetails appSocialDetails) {
|
||||
return appSocialDetailsService.list(Wrappers.query(appSocialDetails));
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
|
||||
import com.bsd.pjcloud.app.service.AppTabbarService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 底部导航
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:32:35
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appTabbar")
|
||||
@Tag(description = "appTabbar", name = "底部导航")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppTabbarController {
|
||||
|
||||
private final AppTabbarService tabbarService;
|
||||
|
||||
/**
|
||||
* 查询导航列表
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "查询导航列表", description = "查询导航列表")
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
return R.ok(tabbarService.list());
|
||||
}
|
||||
|
||||
@Operation(summary = "更新导航", description = "更新导航")
|
||||
@PutMapping
|
||||
public R update(@RequestBody List<AppTabbarEntity> tabbarEntityList) {
|
||||
// 删除不在新增范围的导航菜单
|
||||
List<Long> idList = tabbarService.list().stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
|
||||
List<Long> newIdList = tabbarEntityList.stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
|
||||
|
||||
// 计算需要删除的 ID 列表
|
||||
List<Long> idsToRemove = CollUtil.subtractToList(idList, newIdList);
|
||||
|
||||
// 如果有需要删除的菜单,则批量删除
|
||||
if (CollUtil.isNotEmpty(idsToRemove)) {
|
||||
tabbarService.removeBatchByIds(idsToRemove);
|
||||
}
|
||||
|
||||
return R.ok(tabbarService.saveOrUpdateBatch(tabbarEntityList));
|
||||
}
|
||||
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserDTO;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
|
||||
import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app用户表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appuser")
|
||||
@Tag(description = "appuser", name = "app用户表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppUserController {
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
@Inner
|
||||
@GetMapping("/info/{username}")
|
||||
public R info(@PathVariable String username) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query()
|
||||
.lambda()
|
||||
.eq(AppUser::getUsername, username)
|
||||
.or()
|
||||
.eq(AppUser::getPhone, username));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户全部信息
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping(value = { "/info" })
|
||||
public R info() {
|
||||
String username = SecurityUtils.getUser().getUsername();
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getUsername, username));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appUserDTO app用户表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getAppUserPage(Page page, AppUserDTO appUserDTO) {
|
||||
return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询app用户表
|
||||
* @param userId id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/details/{userId}")
|
||||
public R getById(@PathVariable("userId") Long userId) {
|
||||
return R.ok(appUserService.selectUserVoById(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过userName查询", description = "通过userName查询")
|
||||
@GetMapping("/details")
|
||||
public R getByUserName(AppUser user) {
|
||||
AppUser one = appUserService.getOne(Wrappers.query(user), false);
|
||||
return R.ok(one == null ? null : CommonConstants.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app用户表
|
||||
* @param appUser app用户表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增app用户表", description = "新增app用户表")
|
||||
@SysLog("新增app用户表")
|
||||
@PostMapping
|
||||
@HasPermission("app_appuser_add")
|
||||
public R save(@RequestBody AppUserDTO appUser) {
|
||||
appUserService.saveUser(appUser);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app用户表
|
||||
* @param appUser app用户表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改app用户表", description = "修改app用户表")
|
||||
@SysLog("修改app用户表")
|
||||
@PutMapping
|
||||
@HasPermission("app_appuser_edit")
|
||||
public R updateById(@RequestBody AppUserDTO appUser) {
|
||||
return R.ok(appUserService.updateUser(appUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除app用户表
|
||||
* @param ids userIds
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表")
|
||||
@SysLog("通过id删除app用户表")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_appuser_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appUserService.deleteAppUserByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appUser 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_appuser_export")
|
||||
public List<AppUserExcelVO> export(AppUserDTO appUser) {
|
||||
return appUserService.listUser(appUser);
|
||||
}
|
||||
|
||||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) {
|
||||
if (UserTypeEnum.TOC.getStatus().equals(SecurityUtils.getUser().getUserType())) {
|
||||
userDto.setUserId(SecurityUtils.getUser().getId());
|
||||
// TOC 以手机号为key
|
||||
userDto.setUsername(SecurityUtils.getUser().getUsername());
|
||||
}
|
||||
return appUserService.updateUserInfo(userDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入用户
|
||||
* @param excelVOList 用户列表
|
||||
* @param bindingResult 错误信息列表
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
@HasPermission("app_appuser_export")
|
||||
public R importUser(@RequestExcel List<AppUserExcelVO> excelVOList, BindingResult bindingResult) {
|
||||
return appUserService.importUser(excelVOList, bindingResult);
|
||||
}
|
||||
|
||||
@Operation(summary = "注册app用户表", description = "注册app用户表")
|
||||
@SysLog("注册app用户表")
|
||||
@Inner(value = false)
|
||||
@PostMapping("/register")
|
||||
public R register(@RequestBody AppUserDTO appUser) {
|
||||
return appUserService.registerAppUser(appUser);
|
||||
}
|
||||
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUserRole;
|
||||
import com.bsd.pjcloud.app.service.AppUserRoleService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/appuserrole")
|
||||
@Tag(description = "appuserrole", name = "用户角色表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppUserRoleController {
|
||||
|
||||
private final AppUserRoleService appUserRoleService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appUserRole 用户角色表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@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
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{userId}")
|
||||
@HasPermission("app_appuserrole_view")
|
||||
public R getById(@PathVariable("userId") Long userId) {
|
||||
return R.ok(appUserRoleService.getById(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户角色表
|
||||
* @param appUserRole 用户角色表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增用户角色表", description = "新增用户角色表")
|
||||
@SysLog("新增用户角色表")
|
||||
@PostMapping
|
||||
@HasPermission("app_appuserrole_add")
|
||||
public R save(@RequestBody AppUserRole appUserRole) {
|
||||
return R.ok(appUserRoleService.save(appUserRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户角色表
|
||||
* @param appUserRole 用户角色表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改用户角色表", description = "修改用户角色表")
|
||||
@SysLog("修改用户角色表")
|
||||
@PutMapping
|
||||
@HasPermission("app_appuserrole_edit")
|
||||
public R updateById(@RequestBody AppUserRole appUserRole) {
|
||||
return R.ok(appUserRoleService.updateById(appUserRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除用户角色表
|
||||
* @param userId id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除用户角色表", description = "通过id删除用户角色表")
|
||||
@SysLog("通过id删除用户角色表")
|
||||
@DeleteMapping("/{userId}")
|
||||
@HasPermission("app_appuserrole_del")
|
||||
public R removeById(@PathVariable Long userId) {
|
||||
return R.ok(appUserRoleService.removeById(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param appUserRole 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@HasPermission("app_appuserrole_export")
|
||||
public List<AppUserRole> export(AppUserRole appUserRole) {
|
||||
return appUserRoleService.list(Wrappers.query(appUserRole));
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.handler;
|
||||
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/18
|
||||
*/
|
||||
public abstract class AbstractLoginHandler implements LoginHandler {
|
||||
|
||||
/***
|
||||
* 数据合法性校验
|
||||
* @param loginStr 通过用户传入获取唯一标识
|
||||
* @return 默认不校验
|
||||
*/
|
||||
@Override
|
||||
public Boolean check(String loginStr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理方法
|
||||
* @param loginStr 登录参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppUserInfo handle(String loginStr) {
|
||||
if (!check(loginStr)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String identify = identify(loginStr);
|
||||
return info(identify);
|
||||
}
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.handler;
|
||||
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/18
|
||||
* <p>
|
||||
* 登录处理器
|
||||
*/
|
||||
public interface LoginHandler {
|
||||
|
||||
/***
|
||||
* 数据合法性校验
|
||||
* @param loginStr 通过用户传入获取唯一标识
|
||||
* @return
|
||||
*/
|
||||
Boolean check(String loginStr);
|
||||
|
||||
/**
|
||||
* 通过用户传入获取唯一标识
|
||||
* @param loginStr
|
||||
* @return
|
||||
*/
|
||||
String identify(String loginStr);
|
||||
|
||||
/**
|
||||
* 通过openId 获取用户信息
|
||||
* @param identify
|
||||
* @return
|
||||
*/
|
||||
AppUserInfo info(String identify);
|
||||
|
||||
/**
|
||||
* 处理方法
|
||||
* @param loginStr 登录参数
|
||||
* @return
|
||||
*/
|
||||
AppUserInfo handle(String loginStr);
|
||||
|
||||
/**
|
||||
* 绑定逻辑
|
||||
* @param user 用户实体
|
||||
* @param identify 渠道返回唯一标识
|
||||
* @return
|
||||
*/
|
||||
default Boolean bind(AppUser user, String identify) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.handler;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.mapper.AppSocialDetailsMapper;
|
||||
import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.SecurityConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2019年11月02日
|
||||
* <p>
|
||||
* 微信小程序
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("APP-MINI")
|
||||
@AllArgsConstructor
|
||||
public class MiniAppLoginHandler extends AbstractLoginHandler {
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
private final AppSocialDetailsMapper appSocialDetailsMapper;
|
||||
|
||||
/**
|
||||
* 小程序登录传入code
|
||||
* <p>
|
||||
* 通过code 调用qq 获取唯一标识
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String identify(String code) {
|
||||
AppSocialDetails condition = new AppSocialDetails();
|
||||
condition.setType(LoginTypeEnum.MINI_APP.getType());
|
||||
AppSocialDetails socialDetails = appSocialDetailsMapper.selectOne(new QueryWrapper<>(condition));
|
||||
|
||||
String url = String.format(SecurityConstants.MINI_APP_AUTHORIZATION_CODE_URL, socialDetails.getAppId(),
|
||||
socialDetails.getAppSecret(), code);
|
||||
String result = HttpUtil.get(url);
|
||||
log.debug("微信小程序响应报文:{}", result);
|
||||
|
||||
if (JSONUtil.parseObj(result).containsKey("openid")) {
|
||||
return JSONUtil.parseObj(result).get("openid").toString();
|
||||
} else {
|
||||
log.error("微信小程序登录失败:{}", result);
|
||||
throw new CheckedException("微信小程序登录失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* openId 获取用户信息
|
||||
*
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppUserInfo info(String openId) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getWxOpenid, openId));
|
||||
|
||||
// 未注册用户自动注册
|
||||
if (Objects.isNull(user)) {
|
||||
log.info("微信小程序未绑定:{},创建新的用户", openId);
|
||||
AppUser appUser = new AppUser();
|
||||
appUser.setWxOpenid(openId);
|
||||
appUser.setUsername(openId);
|
||||
appUser.setCreateBy(openId);
|
||||
appUser.setUpdateBy(openId);
|
||||
appUserService.saveOrUpdate(appUser);
|
||||
|
||||
AppUserInfo appUserDTO = new AppUserInfo();
|
||||
appUserDTO.setAppUser(appUser);
|
||||
return appUserDTO;
|
||||
}
|
||||
|
||||
return appUserService.findUserInfo(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定逻辑
|
||||
*
|
||||
* @param user 用户实体
|
||||
* @param identify 渠道返回唯一标识
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bind(AppUser user, String identify) {
|
||||
user.setWxOpenid(identify);
|
||||
appUserService.updateById(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.mapper.AppUserMapper;
|
||||
import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/18
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("APP-SMS")
|
||||
@AllArgsConstructor
|
||||
public class SmsLoginHandler extends AbstractLoginHandler {
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
/**
|
||||
* 验证码登录传入为手机号 不用不处理
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String identify(String mobile) {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过mobile 获取用户信息
|
||||
* @param identify
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppUserInfo info(String identify) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getPhone, identify));
|
||||
|
||||
// 未注册用户自动注册
|
||||
if (Objects.isNull(user)) {
|
||||
log.info("手机号未注册:{}", identify);
|
||||
AppUser appUser = new AppUser();
|
||||
appUser.setUsername(identify);
|
||||
appUser.setPhone(identify);
|
||||
appUser.setCreateBy(identify);
|
||||
appUser.setUpdateBy(identify);
|
||||
appUserService.save(appUser);
|
||||
AppUserInfo appUserDTO = new AppUserInfo();
|
||||
appUserDTO.setAppUser(appUser);
|
||||
return appUserDTO;
|
||||
}
|
||||
|
||||
// 返回用户信息
|
||||
return appUserService.findUserInfo(user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绑定逻辑
|
||||
* @param user 用户实体
|
||||
* @param identify 渠道返回唯一标识
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bind(AppUser user, String identify) {
|
||||
user.setPhone(identify);
|
||||
appUserService.updateById(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppArticleCategoryMapper extends PjcloudBaseMapper<AppArticleCategoryEntity> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppArticleCollectMapper extends PjcloudBaseMapper<AppArticleCollectEntity> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppArticleMapper extends PjcloudBaseMapper<AppArticleEntity> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppPageMapper extends PjcloudBaseMapper<AppPageEntity> {
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
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 PjcloudBaseMapper<AppRole> {
|
||||
|
||||
List<AppRole> listRolesByUserId(Long userId);
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统社交登录账号表
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2018-08-16 21:30:41
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppSocialDetailsMapper extends PjcloudBaseMapper<AppSocialDetails> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppTabbarMapper extends PjcloudBaseMapper<AppTabbarEntity> {
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserDTO;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
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 PjcloudBaseMapper<AppUser> {
|
||||
|
||||
IPage<AppUserVO> getUserVosPage(Page page, @Param("query") AppUserDTO appUserDTO);
|
||||
|
||||
AppUserVO getUserVoById(Long userId);
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.mapper;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppUserRole;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppUserRoleMapper extends PjcloudBaseMapper<AppUserRole> {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
|
||||
|
||||
public interface AppArticleCategoryService extends IService<AppArticleCategoryEntity> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
|
||||
|
||||
public interface AppArticleCollectService extends MPJBaseService<AppArticleCollectEntity> {
|
||||
|
||||
Boolean saveArticleCollect(AppArticleCollectEntity appArticleCollect);
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
|
||||
public interface AppArticleService extends IService<AppArticleEntity> {
|
||||
|
||||
/**
|
||||
* 获取文章并使阅读数+1
|
||||
* @param id id
|
||||
* @return
|
||||
*/
|
||||
AppArticleEntity getArticleAndIncrById(Long id, Long userId);
|
||||
|
||||
/**
|
||||
* 分页查询文章列表 包含分类名称
|
||||
* @param page 分页参数
|
||||
* @param appArticle 文章查询条件
|
||||
* @return
|
||||
*/
|
||||
Page pageAndCname(Page page, AppArticleEntity appArticle);
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* app 页面控制
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
public interface AppIndexService {
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
Map<String, Object> index();
|
||||
|
||||
/**
|
||||
* 配置
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> config();
|
||||
|
||||
/**
|
||||
* 装修
|
||||
* @param id 装修ID
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
AppPageEntity decorate(Integer id);
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/14
|
||||
*/
|
||||
public interface AppMobileService {
|
||||
|
||||
/**
|
||||
* 发送手机验证码
|
||||
* @param mobile mobile
|
||||
* @return code
|
||||
*/
|
||||
R<Boolean> sendSmsCode(String mobile);
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
|
||||
public interface AppPageService extends IService<AppPageEntity> {
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
public interface AppRoleService extends IService<AppRole> {
|
||||
|
||||
List<AppRole> findRolesByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 删除用户的同时,把role_menu关系删除
|
||||
* @param ids RoleIds
|
||||
*/
|
||||
Boolean deleteRoleByIds(Long[] ids);
|
||||
|
||||
R importRole(List<AppRoleExcelVO> excelVOList, BindingResult bindingResult);
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
|
||||
|
||||
/**
|
||||
* 系统社交登录账号表
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2018-08-16 21:30:41
|
||||
*/
|
||||
public interface AppSocialDetailsService extends IService<AppSocialDetails> {
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
* @param state 类型
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
Boolean bindSocial(String state, String code);
|
||||
|
||||
/**
|
||||
* 根据入参查询用户信息
|
||||
* @param inStr
|
||||
* @return
|
||||
*/
|
||||
AppUserInfo getUserInfo(String inStr);
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
|
||||
|
||||
public interface AppTabbarService extends IService<AppTabbarEntity> {
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUserRole;
|
||||
|
||||
/**
|
||||
* 用户角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
public interface AppUserRoleService extends IService<AppUserRole> {
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.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.bsd.pjcloud.app.api.dto.AppUserDTO;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app用户表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
public interface AppUserService extends IService<AppUser> {
|
||||
|
||||
Boolean updateUser(AppUserDTO appUser);
|
||||
|
||||
Boolean saveUser(AppUserDTO appUser);
|
||||
|
||||
List<AppUserExcelVO> listUser(AppUserDTO appUser);
|
||||
|
||||
IPage getUsersWithRolePage(Page page, AppUserDTO appUserDTO);
|
||||
|
||||
AppUserInfo findUserInfo(AppUser user);
|
||||
|
||||
R updateUserInfo(AppUserDTO userDto);
|
||||
|
||||
AppUserVO selectUserVoById(Long userId);
|
||||
|
||||
Boolean deleteAppUserByIds(Long[] ids);
|
||||
|
||||
R importUser(List<AppUserExcelVO> excelVOList, BindingResult bindingResult);
|
||||
|
||||
R registerAppUser(AppUserDTO appUser);
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppArticleCategoryMapper;
|
||||
import com.bsd.pjcloud.app.service.AppArticleCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 文章分类表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:28:03
|
||||
*/
|
||||
@Service
|
||||
public class AppArticleCategoryServiceImpl extends ServiceImpl<AppArticleCategoryMapper, AppArticleCategoryEntity>
|
||||
implements AppArticleCategoryService {
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppArticleCollectMapper;
|
||||
import com.bsd.pjcloud.app.service.AppArticleCollectService;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 文章收藏表
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-16 14:33:41
|
||||
*/
|
||||
@Service
|
||||
public class AppArticleCollectServiceImpl extends ServiceImpl<AppArticleCollectMapper, AppArticleCollectEntity>
|
||||
implements AppArticleCollectService {
|
||||
|
||||
@Override
|
||||
public Boolean saveArticleCollect(AppArticleCollectEntity appArticleCollect) {
|
||||
Long id = SecurityUtils.getUser().getId();
|
||||
appArticleCollect.setUserId(id);
|
||||
|
||||
if (baseMapper.exists(Wrappers.<AppArticleCollectEntity>lambdaQuery()
|
||||
.eq(AppArticleCollectEntity::getUserId, id)
|
||||
.eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()))) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
return this.save(appArticleCollect);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppArticleCollectMapper;
|
||||
import com.bsd.pjcloud.app.mapper.AppArticleMapper;
|
||||
import com.bsd.pjcloud.app.service.AppArticleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文章资讯
|
||||
*
|
||||
* @author pig
|
||||
* @date 2023-06-07 16:32:35
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArticleEntity>
|
||||
implements AppArticleService {
|
||||
|
||||
private final AppArticleCollectMapper collectMapper;
|
||||
|
||||
/**
|
||||
* 获取文章并使阅读数+1
|
||||
* @param id id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppArticleEntity getArticleAndIncrById(Long id, Long userId) {
|
||||
AppArticleEntity appArticleEntity = baseMapper.selectById(id);
|
||||
// 查询是否收藏了
|
||||
if (Objects.nonNull(userId)) {
|
||||
boolean exists = collectMapper.exists(Wrappers.<AppArticleCollectEntity>lambdaQuery()//
|
||||
.eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
|
||||
.eq(AppArticleCollectEntity::getUserId, userId));
|
||||
appArticleEntity.setCollect(exists);
|
||||
}
|
||||
|
||||
// TODO 更新条件需要根据其他指数限制
|
||||
Integer nowVisit = appArticleEntity.getVisit();
|
||||
appArticleEntity.setVisit(nowVisit + 1);
|
||||
// 乐观锁
|
||||
baseMapper.update(appArticleEntity,
|
||||
Wrappers.<AppArticleEntity>lambdaQuery()
|
||||
.eq(AppArticleEntity::getId, id)
|
||||
.eq(AppArticleEntity::getVisit, nowVisit));
|
||||
return appArticleEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询文章列表 包含分类名称
|
||||
* @param page 分页参数
|
||||
* @param appArticle 文章查询条件
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page pageAndCname(Page page, AppArticleEntity appArticle) {
|
||||
MPJLambdaWrapper<AppArticleEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAll(AppArticleEntity.class)
|
||||
.selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
|
||||
.leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
|
||||
.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
|
||||
.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
|
||||
.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
|
||||
return this.page(page, wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppArticleMapper;
|
||||
import com.bsd.pjcloud.app.mapper.AppPageMapper;
|
||||
import com.bsd.pjcloud.app.mapper.AppTabbarMapper;
|
||||
import com.bsd.pjcloud.app.service.AppIndexService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* app 页面控制
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppIndexServiceImpl implements AppIndexService {
|
||||
|
||||
private final AppArticleMapper appArticleMapper;
|
||||
|
||||
private final AppTabbarMapper appTabbarMapper;
|
||||
|
||||
private final AppPageMapper appPageMapper;
|
||||
|
||||
/**
|
||||
* 商城首页 首页数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> index() {
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
AppPageEntity appPageEntity = appPageMapper.selectById(1);
|
||||
List<AppArticleEntity> articleList = appArticleMapper
|
||||
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
|
||||
response.put("pages", appPageEntity);
|
||||
response.put("article", articleList);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> config() {
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
List<AppTabbarEntity> tabbarEntityList = appTabbarMapper.selectList(Wrappers.emptyWrapper());
|
||||
response.put("tabbar", tabbarEntityList);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 装修
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public AppPageEntity decorate(Integer id) {
|
||||
return appPageMapper.selectById(id);
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.bsd.pjcloud.app.service.AppMobileService;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.SecurityConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018/11/14
|
||||
* <p>
|
||||
* 手机登录相关业务实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppMobileServiceImpl implements AppMobileService {
|
||||
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
|
||||
* @param mobile mobile
|
||||
* @return code
|
||||
*/
|
||||
@Override
|
||||
public R<Boolean> sendSmsCode(String mobile) {
|
||||
String codeObj = redisTemplate.opsForValue()
|
||||
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
|
||||
|
||||
if (StrUtil.isNotBlank(codeObj)) {
|
||||
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
|
||||
return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN));
|
||||
}
|
||||
|
||||
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
|
||||
log.debug("手机号生成验证码成功:{},{}", mobile, code);
|
||||
redisTemplate.opsForValue()
|
||||
.set(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
|
||||
SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
|
||||
return R.ok(Boolean.TRUE, code);
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppPageEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppPageMapper;
|
||||
import com.bsd.pjcloud.app.service.AppPageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 页面
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023-06-08 11:19:23
|
||||
*/
|
||||
@Service
|
||||
public class AppPageServiceImpl extends ServiceImpl<AppPageMapper, AppPageEntity> implements AppPageService {
|
||||
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
|
||||
import com.bsd.pjcloud.app.mapper.AppRoleMapper;
|
||||
import com.bsd.pjcloud.app.service.AppRoleService;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* app角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppRoleServiceImpl extends ServiceImpl<AppRoleMapper, AppRole> implements AppRoleService {
|
||||
|
||||
@Override
|
||||
public List<AppRole> findRolesByUserId(Long userId) {
|
||||
return baseMapper.listRolesByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户的同时,把role_menu关系删除
|
||||
* @param ids roleIds
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteRoleByIds(Long[] ids) {
|
||||
this.removeBatchByIds(CollUtil.toList(ids));
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入角色
|
||||
* @param excelVOList
|
||||
* @param bindingResult
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R importRole(List<AppRoleExcelVO> excelVOList, BindingResult bindingResult) {
|
||||
// 通用校验获取失败的数据
|
||||
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
|
||||
|
||||
// 个性化校验逻辑
|
||||
List<AppRole> roleList = this.list();
|
||||
|
||||
// 执行数据插入操作 组装 RoleDto
|
||||
for (AppRoleExcelVO excel : excelVOList) {
|
||||
Set<String> errorMsg = new HashSet<>();
|
||||
// 检验角色名称或者角色编码是否存在
|
||||
boolean existRole = roleList.stream()
|
||||
.anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
|
||||
|| excel.getRoleCode().equals(appRole.getRoleCode()));
|
||||
|
||||
if (existRole) {
|
||||
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_NAMEORCODE_EXISTING, excel.getRoleName(),
|
||||
excel.getRoleCode()));
|
||||
}
|
||||
|
||||
// 数据合法情况
|
||||
if (CollUtil.isEmpty(errorMsg)) {
|
||||
insertExcelRole(excel);
|
||||
}
|
||||
else {
|
||||
// 数据不合法情况
|
||||
errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(errorMessageList)) {
|
||||
return R.failed(errorMessageList);
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
private void insertExcelRole(AppRoleExcelVO excel) {
|
||||
AppRole appRole = new AppRole();
|
||||
appRole.setRoleName(excel.getRoleName());
|
||||
appRole.setRoleDesc(excel.getRoleDesc());
|
||||
appRole.setRoleCode(excel.getRoleCode());
|
||||
this.save(appRole);
|
||||
}
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.handler.LoginHandler;
|
||||
import com.bsd.pjcloud.app.mapper.AppSocialDetailsMapper;
|
||||
import com.bsd.pjcloud.app.mapper.AppUserMapper;
|
||||
import com.bsd.pjcloud.app.service.AppSocialDetailsService;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2018年08月16日
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@Service("appSocialDetailsService")
|
||||
public class AppSocialDetailsServiceImpl extends ServiceImpl<AppSocialDetailsMapper, AppSocialDetails>
|
||||
implements AppSocialDetailsService {
|
||||
|
||||
private final Map<String, LoginHandler> loginHandlerMap;
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
private final AppUserMapper appUserMapper;
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
* @param type type
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindSocial(String type, String code) {
|
||||
LoginHandler loginHandler = loginHandlerMap.get(type);
|
||||
// 绑定逻辑
|
||||
String identify = loginHandler.identify(code);
|
||||
AppUser user = appUserMapper.selectById(SecurityUtils.getUser().getId());
|
||||
loginHandler.bind(user, identify);
|
||||
|
||||
// 更新緩存
|
||||
cacheManager.getCache(CacheConstants.USER_DETAILS_MINI).evict(user.getUsername());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据入参查询用户信息
|
||||
* @param inStr TYPE@code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppUserInfo getUserInfo(String inStr) {
|
||||
String[] inStrs = inStr.split(StringPool.AT);
|
||||
String type = inStrs[0];
|
||||
String loginStr = inStr.substring(type.length() + 1);
|
||||
return loginHandlerMap.get(type).handle(loginStr);
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
|
||||
import com.bsd.pjcloud.app.mapper.AppTabbarMapper;
|
||||
import com.bsd.pjcloud.app.service.AppTabbarService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 导航栏
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2023-06-08 11:18:46
|
||||
*/
|
||||
@Service
|
||||
public class AppTabbarServiceImpl extends ServiceImpl<AppTabbarMapper, AppTabbarEntity> implements AppTabbarService {
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUserRole;
|
||||
import com.bsd.pjcloud.app.mapper.AppUserRoleMapper;
|
||||
import com.bsd.pjcloud.app.service.AppUserRoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户角色表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Service
|
||||
public class AppUserRoleServiceImpl extends ServiceImpl<AppUserRoleMapper, AppUserRole> implements AppUserRoleService {
|
||||
|
||||
}
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
*/
|
||||
package com.bsd.pjcloud.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
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.bsd.pjcloud.app.api.dto.AppUserDTO;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppRole;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUserRole;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserVO;
|
||||
import com.bsd.pjcloud.app.mapper.AppUserMapper;
|
||||
import com.bsd.pjcloud.app.service.AppRoleService;
|
||||
import com.bsd.pjcloud.app.service.AppUserRoleService;
|
||||
import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* app用户表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements AppUserService {
|
||||
|
||||
private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
|
||||
|
||||
private final AppUserRoleService appUserRoleService;
|
||||
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
private final AppRoleService appRoleService;
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
* @param userDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDTO.username")
|
||||
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.<AppUserRole>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<AppUserRole> userRoleList = userDTO.getRole().stream().map(roleId -> {
|
||||
AppUserRole userRole = new AppUserRole();
|
||||
userRole.setUserId(appUser.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
appUserRoleService.saveBatch(userRoleList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部的用户
|
||||
* @param appUser
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AppUserExcelVO> listUser(AppUserDTO appUser) {
|
||||
List<AppUser> appUsers = baseMapper.selectList(null);
|
||||
List<AppUserExcelVO> 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 AppUserInfo findUserInfo(AppUser user) {
|
||||
AppUserInfo info = new AppUserInfo();
|
||||
info.setAppUser(user);
|
||||
// 设置角色列表 (ID)
|
||||
List<Long> roleIds = appRoleService.findRolesByUserId(user.getUserId())
|
||||
.stream()
|
||||
.map(AppRole::getRoleId)
|
||||
.collect(Collectors.toList());
|
||||
info.setRoles(ArrayUtil.toArray(roleIds, Long.class));
|
||||
|
||||
// 设置权限列表(menu.permission)
|
||||
Set<String> permissions = new HashSet<>();
|
||||
info.setPermissions(ArrayUtil.toArray(permissions, String.class));
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDto.username")
|
||||
public R updateUserInfo(AppUserDTO userDto) {
|
||||
// C端客户修改手机号需要判断验证码是否正确
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
if (UserTypeEnum.TOC.getStatus().equals(user.getUserType()) && StrUtil.isNotBlank(userDto.getPhone())) {
|
||||
String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT
|
||||
+ userDto.getPhone();
|
||||
String codeObj = redisTemplate.opsForValue().get(key);
|
||||
|
||||
if (!userDto.getMobileCode().equals(codeObj)) {
|
||||
return R.failed("验证码错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 更新密码
|
||||
if (StrUtil.isNotBlank(userDto.getPassword())) {
|
||||
userDto.setPassword(ENCODER.encode(userDto.getPassword()));
|
||||
}
|
||||
|
||||
AppUser appUser = baseMapper.selectById(userDto.getUserId());
|
||||
BeanUtils.copyProperties(userDto, appUser);
|
||||
return R.ok(this.updateById(appUser));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserVO selectUserVoById(Long userId) {
|
||||
return baseMapper.getUserVoById(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除user用户同时删除user-role关系表
|
||||
* @param ids userIds
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteAppUserByIds(Long[] ids) {
|
||||
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS_MINI);
|
||||
for (AppUser appUser : baseMapper.selectBatchIds(CollUtil.toList(ids))) {
|
||||
cache.evict(appUser.getUsername());
|
||||
}
|
||||
// 删除用户关联表
|
||||
this.appUserRoleService
|
||||
.remove(Wrappers.<AppUserRole>lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
|
||||
|
||||
this.removeBatchByIds(CollUtil.toList(ids));
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public R registerAppUser(AppUserDTO appUser) {
|
||||
List<AppUser> appUserList = baseMapper
|
||||
.selectList(Wrappers.<AppUser>lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
|
||||
|
||||
if (CollUtil.isNotEmpty(appUserList)) {
|
||||
return R.failed("手机号已注册,请使用验证码直接登录");
|
||||
}
|
||||
|
||||
String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT
|
||||
+ appUser.getPhone();
|
||||
String codeObj = redisTemplate.opsForValue().get(key);
|
||||
|
||||
if (!appUser.getMobileCode().equals(codeObj)) {
|
||||
return R.failed("验证码错误");
|
||||
}
|
||||
|
||||
AppUser app = new AppUser();
|
||||
BeanUtils.copyProperties(appUser, app);
|
||||
appUser.setUsername(app.getPhone());
|
||||
appUser.setDelFlag(CommonConstants.STATUS_NORMAL);
|
||||
appUser.setPassword(ENCODER.encode(appUser.getPassword()));
|
||||
baseMapper.insert(appUser);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param excelVOList
|
||||
* @param bindingResult
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R importUser(List<AppUserExcelVO> excelVOList, BindingResult bindingResult) {
|
||||
// 通用校验获取失败的数据
|
||||
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
|
||||
|
||||
// 执行数据插入操作 组装 UserDto
|
||||
for (AppUserExcelVO excel : excelVOList) {
|
||||
// 个性化校验逻辑
|
||||
List<AppUser> userList = this.list();
|
||||
List<AppRole> roleList = appRoleService.list();
|
||||
|
||||
Set<String> errorMsg = new HashSet<>();
|
||||
// 校验用户名是否存在
|
||||
boolean exsitUserName = userList.stream()
|
||||
.anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
|
||||
|
||||
if (exsitUserName) {
|
||||
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername()));
|
||||
}
|
||||
|
||||
// 判断输入的角色名称列表是否合法
|
||||
List<String> roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
|
||||
List<AppRole> roleCollList = roleList.stream()
|
||||
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (roleCollList.size() != roleNameList.size()) {
|
||||
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList()));
|
||||
}
|
||||
// 数据合法情况
|
||||
if (CollUtil.isEmpty(errorMsg)) {
|
||||
insertExcelUser(excel, roleCollList);
|
||||
}
|
||||
else {
|
||||
// 数据不合法情况
|
||||
errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(errorMessageList)) {
|
||||
return R.failed(errorMessageList);
|
||||
}
|
||||
return R.ok(null, MsgUtils.getMessage(ErrorCodes.SYS_USER_IMPORT_SUCCEED));
|
||||
|
||||
}
|
||||
|
||||
private void insertExcelUser(AppUserExcelVO excel, List<AppRole> roleCollList) {
|
||||
AppUserDTO userDTO = new AppUserDTO();
|
||||
userDTO.setUsername(excel.getUsername());
|
||||
userDTO.setPhone(excel.getPhone());
|
||||
userDTO.setNickname(excel.getNickname());
|
||||
userDTO.setName(excel.getName());
|
||||
userDTO.setEmail(excel.getEmail());
|
||||
// 批量导入初始密码为手机号
|
||||
userDTO.setPassword(userDTO.getPhone());
|
||||
// 根据角色名称查询角色ID
|
||||
List<Long> roleIdList = roleCollList.stream().map(AppRole::getRoleId).collect(Collectors.toList());
|
||||
userDTO.setRole(roleIdList);
|
||||
// 插入用户
|
||||
this.saveUser(userDTO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 7060
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pjcloud-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
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
|
||||
<properties>
|
||||
<log-path>/Users/pjcloud</log-path>
|
||||
</properties>
|
||||
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
|
||||
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
|
||||
-->
|
||||
<configuration debug="false" scan="false">
|
||||
<property name="log.path" value="logs/${project.artifactId}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<logger name="org.activiti.engine.impl.db" level="DEBUG">
|
||||
<appender-ref ref="debug"/>
|
||||
</logger>
|
||||
|
||||
<!--nacos 心跳 INFO 屏蔽-->
|
||||
<logger name="com.alibaba.nacos" level="OFF">
|
||||
<appender-ref ref="error"/>
|
||||
</logger>
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="debug"/>
|
||||
</root>
|
||||
</configuration>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppArticleCategoryMapper">
|
||||
|
||||
<resultMap id="appArticleCategoryMap" type="com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="isShow" column="is_show"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppArticleCollectMapper">
|
||||
|
||||
<resultMap id="appArticleCollectMap" type="com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="articleId" column="article_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppArticleMapper">
|
||||
|
||||
<resultMap id="appArticleMap" type="com.bsd.pjcloud.app.api.entity.AppArticleEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="cid" column="cid"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="intro" column="intro"/>
|
||||
<result property="summary" column="summary"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="author" column="author"/>
|
||||
<result property="visit" column="visit"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppPageMapper">
|
||||
|
||||
<resultMap id="appPageMap" type="com.bsd.pjcloud.app.api.entity.AppPageEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="pageType" column="page_type"/>
|
||||
<result property="pageName" column="page_name"/>
|
||||
<result property="pageData" column="page_data"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
~
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppRoleMapper">
|
||||
|
||||
<resultMap id="appRoleMap" type="com.bsd.pjcloud.app.api.entity.AppRole">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleCode" column="role_code"/>
|
||||
<result property="roleDesc" column="role_desc"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<select id="listRolesByUserId" resultType="com.bsd.pjcloud.app.api.entity.AppRole">
|
||||
SELECT app_role.role_id,
|
||||
app_role.role_name,
|
||||
app_role.role_code,
|
||||
app_role.role_desc,
|
||||
app_role.create_time,
|
||||
app_role.update_time,
|
||||
app_role.del_flag
|
||||
FROM app_role,
|
||||
app_user_role
|
||||
WHERE app_role.role_id = app_user_role.role_id
|
||||
AND app_role.del_flag = '0'
|
||||
and app_user_role.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppTabbarMapper">
|
||||
|
||||
<resultMap id="appTabbarMap" type="com.bsd.pjcloud.app.api.entity.AppTabbarEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="selected" column="selected"/>
|
||||
<result property="unselected" column="unselected"/>
|
||||
<result property="link" column="link"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
~
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppUserMapper">
|
||||
|
||||
<resultMap id="appUserMap" type="com.bsd.pjcloud.app.api.vo.AppUserVO">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="nickname" column="nickname"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time"/>
|
||||
<collection property="roleList" ofType="com.bsd.pjcloud.app.api.entity.AppRole"
|
||||
select="com.bsd.pjcloud.app.mapper.AppRoleMapper.listRolesByUserId" column="user_id">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="getUserVosPage" resultMap="appUserMap">
|
||||
select
|
||||
u.user_id,
|
||||
u.username,
|
||||
u.password,
|
||||
u.phone,
|
||||
u.avatar,
|
||||
u.create_time,
|
||||
u.del_flag,
|
||||
u.lock_flag,
|
||||
u.tenant_id,
|
||||
u.nickname,
|
||||
u.name,
|
||||
u.email
|
||||
from app_user u
|
||||
<where>
|
||||
u.del_flag = '0'
|
||||
<if test="query.username != null and query.username != ''">
|
||||
<bind name="usernameLike" value="'%'+query.username+'%'"/>
|
||||
AND u.username LIKE #{usernameLike}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<sql id="userRoleDeptSql">
|
||||
u.user_id,
|
||||
u.username,
|
||||
u.password,
|
||||
u.salt,
|
||||
u.phone,
|
||||
u.avatar,
|
||||
u.wx_openid,
|
||||
u.del_flag,
|
||||
u.lock_flag,
|
||||
u.tenant_id,
|
||||
u.nickname,
|
||||
u.name,
|
||||
u.email,
|
||||
u.create_by,
|
||||
u.create_time ucreate_time,
|
||||
u.update_time uupdate_time,
|
||||
r.role_id
|
||||
</sql>
|
||||
|
||||
<select id="getUserVoById" resultMap="appUserMap">
|
||||
SELECT
|
||||
<include refid="userRoleDeptSql"/>
|
||||
FROM
|
||||
app_user u
|
||||
LEFT JOIN app_user_role urole ON urole.user_id = u.user_id
|
||||
LEFT JOIN app_role r ON r.role_id = urole.role_id
|
||||
WHERE
|
||||
u.user_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ Copyright (c) 2018-2025, pjcloud 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: pjcloud
|
||||
~
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.app.mapper.AppUserRoleMapper">
|
||||
|
||||
<resultMap id="appUserRoleMap" type="com.bsd.pjcloud.app.api.entity.AppUserRole">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-app-server</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!--项目子模块-->
|
||||
<modules>
|
||||
<module>pjcloud-app-server-api</module>
|
||||
<module>pjcloud-app-server-biz</module>
|
||||
</modules>
|
||||
</project>
|
||||
Reference in new issue
Block a user