mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-04-26 06:38:35 +08:00
@@ -0,0 +1,115 @@
|
||||
package org.dromara.system.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysClientBo;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.service.ISysClientService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户端管理
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/client")
|
||||
public class SysClientController extends BaseController {
|
||||
|
||||
private final ISysClientService sysClientService;
|
||||
|
||||
/**
|
||||
* 查询客户端管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:client:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysClientVo> list(SysClientBo bo, PageQuery pageQuery) {
|
||||
return sysClientService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客户端管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:client:export")
|
||||
@Log(title = "客户端管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SysClientBo bo, HttpServletResponse response) {
|
||||
List<SysClientVo> list = sysClientService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "客户端管理", SysClientVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户端管理详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:client:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SysClientVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(sysClientService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户端管理
|
||||
*/
|
||||
@SaCheckPermission("system:client:add")
|
||||
@Log(title = "客户端管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysClientBo bo) {
|
||||
return toAjax(sysClientService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户端管理
|
||||
*/
|
||||
@SaCheckPermission("system:client:edit")
|
||||
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysClientBo bo) {
|
||||
return toAjax(sysClientService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@SaCheckPermission("system:client:edit")
|
||||
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public R<Void> changeStatus(@RequestBody SysClientBo bo) {
|
||||
return toAjax(sysClientService.updateUserStatus(bo.getId(), bo.getStatus()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户端管理
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:client:remove")
|
||||
@Log(title = "客户端管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(sysClientService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.dromara.system.controller.system;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.vo.SysSocialVo;
|
||||
import org.dromara.system.service.ISysSocialService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社会化关系
|
||||
*
|
||||
* @author thiszhc
|
||||
* @date 2023-06-16
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/social")
|
||||
public class SysSocialController extends BaseController {
|
||||
|
||||
private final ISysSocialService socialUserService;
|
||||
|
||||
/**
|
||||
* 查询社会化关系列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<SysSocialVo>> list() {
|
||||
return R.ok(socialUserService.queryListByUserId(LoginHelper.getUserId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取社会化关系详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysSocialVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable String id) {
|
||||
return R.ok(socialUserService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 授权管理对象 sys_client
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
* @date 2023-05-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_client")
|
||||
public class SysClient extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户端id
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端key
|
||||
*/
|
||||
private String clientKey;
|
||||
|
||||
/**
|
||||
* 客户端秘钥
|
||||
*/
|
||||
private String clientSecret;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
private String grantType;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* token活跃超时时间
|
||||
*/
|
||||
private Long activeTimeout;
|
||||
|
||||
/**
|
||||
* token固定超时时间
|
||||
*/
|
||||
private Long timeout;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 社会化关系对象 sys_social
|
||||
*
|
||||
* @author thiszhc
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_social")
|
||||
public class SysSocial extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 的唯一ID
|
||||
*/
|
||||
private String authId;
|
||||
|
||||
/**
|
||||
* 用户来源
|
||||
*/
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌的有效期,部分平台可能没有
|
||||
*/
|
||||
private int expireIn;
|
||||
|
||||
/**
|
||||
* 刷新令牌,部分平台可能没有
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 用户的 open id
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 授权的第三方账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 授权的第三方昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 授权的第三方邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 授权的第三方头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
private String accessCode;
|
||||
|
||||
/**
|
||||
* 用户的 unionid
|
||||
*/
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 授予的权限,部分平台可能没有
|
||||
*/
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 个别平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
private String tokenType;
|
||||
|
||||
/**
|
||||
* id token,部分平台可能没有
|
||||
*/
|
||||
private String idToken;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String macAlgorithm;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String macKey;
|
||||
|
||||
/**
|
||||
* 用户的授权code,部分平台可能没有
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String oauthToken;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String oauthTokenSecret;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.system.domain.SysClient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 授权管理业务对象 sys_client
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SysClient.class, reverseConvertGenerate = false)
|
||||
public class SysClientBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户端id
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端key
|
||||
*/
|
||||
@NotBlank(message = "客户端key不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String clientKey;
|
||||
|
||||
/**
|
||||
* 客户端秘钥
|
||||
*/
|
||||
@NotBlank(message = "客户端秘钥不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String clientSecret;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
@NotNull(message = "授权类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private List<String> grantTypeList;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
private String grantType;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* token活跃超时时间
|
||||
*/
|
||||
private Long activeTimeout;
|
||||
|
||||
/**
|
||||
* token固定超时时间
|
||||
*/
|
||||
private Long timeout;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import org.dromara.system.domain.SysSocial;
|
||||
|
||||
/**
|
||||
* 社会化关系业务对象 sys_social
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SysSocial.class, reverseConvertGenerate = false)
|
||||
public class SysSocialBo extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 的唯一ID
|
||||
*/
|
||||
@NotBlank(message = "的唯一ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String authId;
|
||||
|
||||
/**
|
||||
* 用户来源
|
||||
*/
|
||||
@NotBlank(message = "用户来源不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌
|
||||
*/
|
||||
@NotBlank(message = "用户的授权令牌不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌的有效期,部分平台可能没有
|
||||
*/
|
||||
private int expireIn;
|
||||
|
||||
/**
|
||||
* 刷新令牌,部分平台可能没有
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 平台唯一id
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 用户的 ID
|
||||
*/
|
||||
@NotBlank(message = "用户的 ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
private String accessCode;
|
||||
|
||||
/**
|
||||
* 用户的 unionid
|
||||
*/
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 授予的权限,部分平台可能没有
|
||||
*/
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 授权的第三方账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 授权的第三方昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 授权的第三方邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 授权的第三方头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 个别平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
private String tokenType;
|
||||
|
||||
/**
|
||||
* id token,部分平台可能没有
|
||||
*/
|
||||
private String idToken;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String macAlgorithm;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String macKey;
|
||||
|
||||
/**
|
||||
* 用户的授权code,部分平台可能没有
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String oauthToken;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
private String oauthTokenSecret;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.system.domain.SysClient;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 授权管理视图对象 sys_client
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysClient.class)
|
||||
public class SysClientVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户端id
|
||||
*/
|
||||
@ExcelProperty(value = "客户端id")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端key
|
||||
*/
|
||||
@ExcelProperty(value = "客户端key")
|
||||
private String clientKey;
|
||||
|
||||
/**
|
||||
* 客户端秘钥
|
||||
*/
|
||||
@ExcelProperty(value = "客户端秘钥")
|
||||
private String clientSecret;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
@ExcelProperty(value = "授权类型")
|
||||
private List<String> grantTypeList;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
private String grantType;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* token活跃超时时间
|
||||
*/
|
||||
@ExcelProperty(value = "token活跃超时时间")
|
||||
private Long activeTimeout;
|
||||
|
||||
/**
|
||||
* token固定超时时间
|
||||
*/
|
||||
@ExcelProperty(value = "token固定超时时间")
|
||||
private Long timeout;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.system.domain.SysSocial;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 社会化关系视图对象 sys_social
|
||||
*
|
||||
* @author thiszhc
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysSocial.class)
|
||||
public class SysSocialVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ExcelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 的唯一ID
|
||||
*/
|
||||
@ExcelProperty(value = "授权UUID")
|
||||
private String authId;
|
||||
|
||||
/**
|
||||
* 用户来源
|
||||
*/
|
||||
@ExcelProperty(value = "用户来源")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌
|
||||
*/
|
||||
@ExcelProperty(value = "用户的授权令牌")
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌的有效期,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "用户的授权令牌的有效期,部分平台可能没有")
|
||||
private int expireIn;
|
||||
|
||||
/**
|
||||
* 刷新令牌,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "刷新令牌,部分平台可能没有")
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 用户的 open id
|
||||
*/
|
||||
@ExcelProperty(value = "平台的唯一id")
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 授权的第三方账号
|
||||
*/
|
||||
@ExcelProperty(value = "授权的第三方账号")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 授权的第三方昵称
|
||||
*/
|
||||
@ExcelProperty(value = "授权的第三方昵称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 授权的第三方邮箱
|
||||
*/
|
||||
@ExcelProperty(value = "授权的第三方邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 授权的第三方头像地址
|
||||
*/
|
||||
@ExcelProperty(value = "授权的第三方头像地址")
|
||||
private String avatar;
|
||||
|
||||
|
||||
/**
|
||||
* 平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "平台的授权信息,部分平台可能没有")
|
||||
private String accessCode;
|
||||
|
||||
/**
|
||||
* 用户的 unionid
|
||||
*/
|
||||
@ExcelProperty(value = "用户的 unionid")
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 授予的权限,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "授予的权限,部分平台可能没有")
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 个别平台的授权信息,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "个别平台的授权信息,部分平台可能没有")
|
||||
private String tokenType;
|
||||
|
||||
/**
|
||||
* id token,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "id token,部分平台可能没有")
|
||||
private String idToken;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "小米平台用户的附带属性,部分平台可能没有")
|
||||
private String macAlgorithm;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "小米平台用户的附带属性,部分平台可能没有")
|
||||
private String macKey;
|
||||
|
||||
/**
|
||||
* 用户的授权code,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "用户的授权code,部分平台可能没有")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "Twitter平台用户的附带属性,部分平台可能没有")
|
||||
private String oauthToken;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性,部分平台可能没有
|
||||
*/
|
||||
@ExcelProperty(value = "Twitter平台用户的附带属性,部分平台可能没有")
|
||||
private String oauthTokenSecret;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.dromara.system.dubbo;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.system.api.RemoteClientService;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.service.ISysClientService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 客户端服务
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@DubboService
|
||||
public class RemoteClientServiceImpl implements RemoteClientService {
|
||||
|
||||
private final ISysClientService sysClientService;
|
||||
|
||||
/**
|
||||
* 根据客户端id获取客户端详情
|
||||
*/
|
||||
@Override
|
||||
public RemoteClientVo queryByClientId(String clientId) {
|
||||
SysClientVo vo = sysClientService.queryByClientId(clientId);
|
||||
return MapstructUtils.convert(vo, RemoteClientVo.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.dromara.system.dubbo;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.system.api.RemoteSocialService;
|
||||
import org.dromara.system.api.domain.bo.RemoteSocialBo;
|
||||
import org.dromara.system.api.domain.vo.RemoteSocialVo;
|
||||
import org.dromara.system.domain.bo.SysSocialBo;
|
||||
import org.dromara.system.domain.vo.SysSocialVo;
|
||||
import org.dromara.system.service.ISysSocialService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 社会化关系服务
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@DubboService
|
||||
public class RemoteSocialServiceImpl implements RemoteSocialService {
|
||||
|
||||
private final ISysSocialService sysSocialService;
|
||||
|
||||
/**
|
||||
* 根据 authId 查询用户信息
|
||||
*/
|
||||
@Override
|
||||
public RemoteSocialVo selectByAuthId(String authId) {
|
||||
SysSocialVo socialVo = sysSocialService.selectByAuthId(authId);
|
||||
return MapstructUtils.convert(socialVo, RemoteSocialVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存社会化关系
|
||||
*/
|
||||
@Override
|
||||
public void insertByBo(RemoteSocialBo bo) {
|
||||
sysSocialService.insertByBo(MapstructUtils.convert(bo, SysSocialBo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除社会化关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidById(Long socialId) {
|
||||
return sysSocialService.deleteWithValidById(socialId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,9 @@ import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.enums.UserStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.exception.user.UserException;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.ServletUtils;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.bo.RemoteUserBo;
|
||||
@@ -55,7 +57,10 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
}
|
||||
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||
return buildLoginUser(userMapper.selectTenantUserByUserName(username, tenantId));
|
||||
if (TenantHelper.isEnable()) {
|
||||
return buildLoginUser(userMapper.selectTenantUserByUserName(username, tenantId));
|
||||
}
|
||||
return buildLoginUser(userMapper.selectUserByUserName(username));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +77,10 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
}
|
||||
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||
return buildLoginUser(userMapper.selectTenantUserByPhonenumber(phonenumber, tenantId));
|
||||
if (TenantHelper.isEnable()) {
|
||||
return buildLoginUser(userMapper.selectTenantUserByPhonenumber(phonenumber, tenantId));
|
||||
}
|
||||
return buildLoginUser(userMapper.selectUserByPhonenumber(phonenumber));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +97,10 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
}
|
||||
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||
return buildLoginUser(userMapper.selectTenantUserByEmail(email, tenantId));
|
||||
if (TenantHelper.isEnable()) {
|
||||
return buildLoginUser(userMapper.selectTenantUserByEmail(email, tenantId));
|
||||
}
|
||||
return buildLoginUser(userMapper.selectUserByEmail(email));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,4 +160,19 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@Override
|
||||
public void recordLoginInfo(Long userId) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(userId);
|
||||
sysUser.setLoginIp(ServletUtils.getClientIP());
|
||||
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||
sysUser.setUpdateBy(userId);
|
||||
userMapper.updateById(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysClient;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
|
||||
/**
|
||||
* 授权管理Mapper接口
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
public interface SysClientMapper extends BaseMapperPlus<SysClient, SysClientVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysSocial;
|
||||
import org.dromara.system.domain.vo.SysSocialVo;
|
||||
|
||||
/**
|
||||
* 社会化关系Mapper接口
|
||||
*
|
||||
* @author thiszhc
|
||||
*/
|
||||
public interface SysSocialMapper extends BaseMapperPlus<SysSocial, SysSocialVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SysClientBo;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户端管理Service接口
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
public interface ISysClientService {
|
||||
|
||||
/**
|
||||
* 查询客户端管理
|
||||
*/
|
||||
SysClientVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询客户端信息基于客户端id
|
||||
*/
|
||||
SysClientVo queryByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询客户端管理列表
|
||||
*/
|
||||
TableDataInfo<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询客户端管理列表
|
||||
*/
|
||||
List<SysClientVo> queryList(SysClientBo bo);
|
||||
|
||||
/**
|
||||
* 新增客户端管理
|
||||
*/
|
||||
Boolean insertByBo(SysClientBo bo);
|
||||
|
||||
/**
|
||||
* 修改客户端管理
|
||||
*/
|
||||
Boolean updateByBo(SysClientBo bo);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
int updateUserStatus(Long id, String status);
|
||||
|
||||
/**
|
||||
* 校验并批量删除客户端管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.system.domain.bo.SysSocialBo;
|
||||
import org.dromara.system.domain.vo.SysSocialVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社会化关系Service接口
|
||||
*
|
||||
* @author thiszhc
|
||||
*/
|
||||
public interface ISysSocialService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询社会化关系
|
||||
*/
|
||||
SysSocialVo queryById(String id);
|
||||
|
||||
/**
|
||||
* 查询社会化关系列表
|
||||
*/
|
||||
List<SysSocialVo> queryList();
|
||||
|
||||
/**
|
||||
* 查询社会化关系列表
|
||||
*/
|
||||
List<SysSocialVo> queryListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 新增授权关系
|
||||
*/
|
||||
Boolean insertByBo(SysSocialBo bo);
|
||||
|
||||
|
||||
/**
|
||||
* 删除社会化关系信息
|
||||
*/
|
||||
Boolean deleteWithValidById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 根据 authId 查询 SysSocial 表和 SysUser 表,返回 SysSocialAuthResult 映射的对象
|
||||
* @param authId 认证ID
|
||||
* @return SysSocial
|
||||
*/
|
||||
SysSocialVo selectByAuthId(String authId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package org.dromara.system.service.impl;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.SysClient;
|
||||
import org.dromara.system.domain.bo.SysClientBo;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.mapper.SysClientMapper;
|
||||
import org.dromara.system.service.ISysClientService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 客户端管理Service业务层处理
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysClientServiceImpl implements ISysClientService {
|
||||
|
||||
private final SysClientMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询客户端管理
|
||||
*/
|
||||
@Override
|
||||
public SysClientVo queryById(Long id) {
|
||||
SysClientVo vo = baseMapper.selectVoById(id);
|
||||
vo.setGrantTypeList(List.of(vo.getGrantType().split(",")));
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询客户端管理
|
||||
*/
|
||||
@Override
|
||||
public SysClientVo queryByClientId(String clientId) {
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户端管理列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
||||
Page<SysClientVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(r -> r.setGrantTypeList(List.of(r.getGrantType().split(","))));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户端管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysClientVo> queryList(SysClientBo bo) {
|
||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysClient> buildQueryWrapper(SysClientBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysClient> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), SysClient::getClientId, bo.getClientId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getClientKey()), SysClient::getClientKey, bo.getClientKey());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getClientSecret()), SysClient::getClientSecret, bo.getClientSecret());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysClient::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户端管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SysClientBo bo) {
|
||||
SysClient add = MapstructUtils.convert(bo, SysClient.class);
|
||||
validEntityBeforeSave(add);
|
||||
add.setGrantType(String.join(",", bo.getGrantTypeList()));
|
||||
// 生成clientid
|
||||
String clientKey = bo.getClientKey();
|
||||
String clientSecret = bo.getClientSecret();
|
||||
add.setClientId(SecureUtil.md5(clientKey + clientSecret));
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户端管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SysClientBo bo) {
|
||||
SysClient update = MapstructUtils.convert(bo, SysClient.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
@Override
|
||||
public int updateUserStatus(Long id, String status) {
|
||||
return baseMapper.update(null,
|
||||
new LambdaUpdateWrapper<SysClient>()
|
||||
.set(SysClient::getStatus, status)
|
||||
.eq(SysClient::getId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysClient entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除客户端管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package org.dromara.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.system.domain.SysSocial;
|
||||
import org.dromara.system.domain.bo.SysSocialBo;
|
||||
import org.dromara.system.domain.vo.SysSocialVo;
|
||||
import org.dromara.system.mapper.SysSocialMapper;
|
||||
import org.dromara.system.service.ISysSocialService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社会化关系Service业务层处理
|
||||
*
|
||||
* @author thiszhc
|
||||
* @date 2023-06-12
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysSocialServiceImpl implements ISysSocialService {
|
||||
|
||||
private final SysSocialMapper baseMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询社会化关系
|
||||
*/
|
||||
@Override
|
||||
public SysSocialVo queryById(String id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysSocialVo> queryList() {
|
||||
return baseMapper.selectVoList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysSocialVo> queryListByUserId(Long userId) {
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getUserId, userId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增社会化关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SysSocialBo bo) {
|
||||
SysSocial add = MapstructUtils.convert(bo, SysSocial.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
if (add != null) {
|
||||
bo.setId(add.getId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysSocial entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除社会化关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidById(Long id) {
|
||||
return baseMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据 authId 查询用户信息
|
||||
*
|
||||
* @param authId 认证id
|
||||
* @return 授权信息
|
||||
*/
|
||||
@Override
|
||||
public SysSocialVo selectByAuthId(String authId) {
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getAuthId, authId));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user