feat: mybatis-plus --> mybatis-flex
This commit is contained in:
3
schisandra-cloud-storage-auth/mybatis-flex.config
Normal file
3
schisandra-cloud-storage-auth/mybatis-flex.config
Normal file
@@ -0,0 +1,3 @@
|
||||
processor.enable=true
|
||||
processor.allInTables.enable=false
|
||||
processor.allInTables.package=com.schisandra.oss
|
@@ -37,6 +37,11 @@
|
||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.9.0</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -1,14 +1,11 @@
|
||||
package com.schisandra.auth.application.config;
|
||||
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -80,22 +80,29 @@ public class SchisandraAuthUserController {
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @description: 用户登录
|
||||
* @param: [schisandraAuthUserDTO]
|
||||
* @return: com.schisandra.auth.common.entity.Result
|
||||
* @author: landaiqing
|
||||
* @date: 2024/5/31 1:19
|
||||
*/
|
||||
@PostMapping("login")
|
||||
public Result login(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
SchisandraAuthUserBO schisandraAuthUserBO=SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
SchisandraAuthUserDTO schisandraAuthUserDTO1=SchisandraAuthUserDTOConverter.INSTANCE.convertBOToDTO(schisandraAuthUserDomainService.login(schisandraAuthUserBO));
|
||||
map.put("user",schisandraAuthUserDTO1);
|
||||
if(schisandraAuthUserDTO1!=null){
|
||||
if (StpUtil.isLogin(schisandraAuthUserDTO1.getId())){
|
||||
StpUtil.logout(schisandraAuthUserDTO1.getId());
|
||||
StpUtil.login(schisandraAuthUserDTO1.getId());
|
||||
String token=StpUtil.getTokenValueByLoginId(schisandraAuthUserDTO1.getId());
|
||||
SchisandraAuthUserDTO result=SchisandraAuthUserDTOConverter.INSTANCE.convertBOToDTO(schisandraAuthUserDomainService.login(schisandraAuthUserBO));
|
||||
map.put("user",result);
|
||||
if(result!=null){
|
||||
if (StpUtil.isLogin(result.getId())){
|
||||
StpUtil.logout(result.getId());
|
||||
StpUtil.login(result.getId());
|
||||
String token=StpUtil.getTokenValueByLoginId(result.getId());
|
||||
map.put("token",token);
|
||||
return Result.ok(map);
|
||||
}else {
|
||||
StpUtil.login(schisandraAuthUserDTO1.getId());
|
||||
return Result.ok(schisandraAuthUserDTO1);
|
||||
StpUtil.login(result.getId());
|
||||
return Result.ok(result);
|
||||
}
|
||||
}else{
|
||||
return Result.fail("用户名或密码错误");}
|
||||
|
@@ -12,7 +12,6 @@ import java.io.Serializable;
|
||||
* @since 2024-04-17 12:05:46
|
||||
*/
|
||||
@Data
|
||||
//@Builder
|
||||
public class SchisandraAuthPermissionDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
@@ -16,7 +16,6 @@ import java.util.Date;
|
||||
* @Version: v1.0
|
||||
*/
|
||||
@Data
|
||||
//@Builder
|
||||
public class SchisandraAuthRoleDTO implements Serializable {
|
||||
/**
|
||||
* id
|
||||
|
@@ -36,6 +36,11 @@
|
||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.9.0</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.schisandra.auth.domain.bo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -54,8 +53,5 @@ SchisandraAuthPermissionBO implements Serializable {
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@ import java.util.Date;
|
||||
* @Version: v1.0
|
||||
*/
|
||||
@Data
|
||||
//@Builder
|
||||
public class SchisandraAuthRoleBO implements Serializable {
|
||||
/**
|
||||
* id
|
||||
|
@@ -8,7 +8,6 @@ import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.common.enums.IsDeletedFlagEnum;
|
||||
import com.schisandra.auth.common.enums.UserRoleEnum;
|
||||
import com.schisandra.auth.common.enums.UserStatusEnum;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthSocialUserBO;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthSocialUserMapperBO;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
@@ -82,24 +81,31 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 登录
|
||||
* @param: [schisandraAuthUserBO]
|
||||
* @return: com.schisandra.auth.domain.bo.SchisandraAuthUserBO
|
||||
* @author: landaiqing
|
||||
* @date: 2024/5/31 1:22
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUserBO login(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
|
||||
Pattern pattern = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
|
||||
Boolean emailmatch = pattern.matcher(schisandraAuthUserBO.getUserName()).matches();
|
||||
SchisandraAuthUser schisandraAuthUser;
|
||||
if(emailmatch){
|
||||
schisandraAuthUser=schisandraAuthUserService.queryByEmail(schisandraAuthUserBO.getUserName());
|
||||
}else {
|
||||
schisandraAuthUser=schisandraAuthUserService.queryByPhone(schisandraAuthUserBO.getUserName());
|
||||
if (emailmatch) {
|
||||
schisandraAuthUser = schisandraAuthUserService.queryByEmail(schisandraAuthUserBO.getUserName());
|
||||
} else {
|
||||
schisandraAuthUser = schisandraAuthUserService.queryByPhone(schisandraAuthUserBO.getUserName());
|
||||
}
|
||||
if (schisandraAuthUser != null && schisandraAuthUserBO.getPassword() != null){
|
||||
if (schisandraAuthUser.getPassword().equals(schisandraAuthUserBO.getPassword())){
|
||||
if (schisandraAuthUser != null && schisandraAuthUserBO.getPassword() != null) {
|
||||
if (schisandraAuthUser.getPassword().equals(schisandraAuthUserBO.getPassword())) {
|
||||
return SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
||||
}else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +217,7 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
||||
}
|
||||
SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper = new SchisandraAuthSocialUserMapper();
|
||||
schisandraAuthSocialUserMapper.setSocialUserId(authSocialUser.getId());
|
||||
SchisandraAuthSocialUserMapper result = schisandraAuthSocialUserMapperService.queryByCondition(schisandraAuthSocialUserMapper);
|
||||
SchisandraAuthSocialUserMapper result = schisandraAuthSocialUserMapperService.queryBySocialUserId(schisandraAuthSocialUserMapper);
|
||||
if (ObjectUtils.isEmpty(result)) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.error("schisandraAuthSocialUserMapperService.queryByCondition fail, param:{}", JSONObject.toJSONString(schisandraAuthSocialUserMapper));
|
||||
|
@@ -36,11 +36,16 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
<!--mybatis plus-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
|
||||
<version>1.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.schisandra</groupId>
|
||||
|
@@ -3,6 +3,7 @@ package com.schisandra.auth.infra.basic.dao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.List;
|
||||
* @author makejava
|
||||
* @since 2024-04-11 13:00:10
|
||||
*/
|
||||
@Repository
|
||||
public interface SchisandraAuthPermissionDao {
|
||||
|
||||
/**
|
||||
|
@@ -3,6 +3,7 @@ package com.schisandra.auth.infra.basic.dao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthRole;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.List;
|
||||
* @author makejava
|
||||
* @since 2024-03-22 21:35:31
|
||||
*/
|
||||
@Repository
|
||||
public interface SchisandraAuthRoleDao {
|
||||
|
||||
/**
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.schisandra.auth.infra.basic.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 表数据库访问层
|
||||
* 表数据库访问层
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 20:07:57
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.schisandra.auth.infra.basic.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUserMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUserMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 表数据库访问层
|
||||
* 表数据库访问层
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 20:13:10
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.schisandra.auth.infra.basic.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.schisandra.auth.infra.basic.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUserRole;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
@@ -3,6 +3,7 @@ package com.schisandra.auth.infra.basic.dao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.List;
|
||||
* @author makejava
|
||||
* @since 2024-05-11 15:47:58
|
||||
*/
|
||||
@Repository
|
||||
public interface SchisandraSmsConfigDao {
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -14,7 +16,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class SchisandraAuthPermission implements Serializable {
|
||||
|
||||
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -17,6 +19,7 @@ public class SchisandraAuthRole implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@@ -16,151 +16,151 @@ import java.util.Date;
|
||||
* @since 2024-05-23 20:07:57
|
||||
*/
|
||||
@Data
|
||||
@TableName("schisandra_auth_social_user")
|
||||
@Table("schisandra_auth_social_user")
|
||||
public class SchisandraAuthSocialUser implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "`id`", type = IdType.AUTO)
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 第三方系统的唯一ID
|
||||
*/
|
||||
@TableField("`uuid`")
|
||||
@Column("uuid")
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 第三方用户来源
|
||||
*/
|
||||
@TableField("`source`")
|
||||
@Column("source")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 用户的授权令牌
|
||||
*/
|
||||
@TableField("`access_token`")
|
||||
@Column("access_token")
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 第三方用户的授权令牌的有效期
|
||||
*/
|
||||
@TableField("`expire_in`")
|
||||
@Column("expire_in")
|
||||
private Integer expireIn;
|
||||
|
||||
/**
|
||||
* 刷新令牌
|
||||
*/
|
||||
@TableField("`refresh_token`")
|
||||
@Column("refresh_token")
|
||||
private String refreshToken;
|
||||
|
||||
/**
|
||||
* 第三方用户的 open id
|
||||
*/
|
||||
@TableField("`open_id`")
|
||||
@Column("open_id")
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 第三方用户的 ID
|
||||
*/
|
||||
@TableField("`uid`")
|
||||
@Column("uid")
|
||||
private String uid;
|
||||
|
||||
/**
|
||||
* 个别平台的授权信息
|
||||
*/
|
||||
@TableField("`access_code`")
|
||||
@Column("access_code")
|
||||
private String accessCode;
|
||||
|
||||
/**
|
||||
* 第三方用户的 union id
|
||||
*/
|
||||
@TableField("`union_id`")
|
||||
@Column("union_id")
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 第三方用户授予的权限
|
||||
*/
|
||||
@TableField("`scope`")
|
||||
@Column("scope")
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 个别平台的授权信息
|
||||
*/
|
||||
@TableField("`token_type`")
|
||||
@Column("token_type")
|
||||
private String tokenType;
|
||||
|
||||
/**
|
||||
* id token
|
||||
*/
|
||||
@TableField("`id_token`")
|
||||
@Column("id_token")
|
||||
private String idToken;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性
|
||||
*/
|
||||
@TableField("`mac_algorithm`")
|
||||
@Column("mac_algorithm")
|
||||
private String macAlgorithm;
|
||||
|
||||
/**
|
||||
* 小米平台用户的附带属性
|
||||
*/
|
||||
@TableField("`mac_key`")
|
||||
@Column("mac_key")
|
||||
private String macKey;
|
||||
|
||||
/**
|
||||
* 用户的授权code
|
||||
*/
|
||||
@TableField("`code`")
|
||||
@Column("code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性
|
||||
*/
|
||||
@TableField("`oauth_token`")
|
||||
@Column("oauth_token")
|
||||
private String oauthToken;
|
||||
|
||||
/**
|
||||
* Twitter平台用户的附带属性
|
||||
*/
|
||||
@TableField("`oauth_token_secret`")
|
||||
@Column("oauth_token_secret")
|
||||
private String oauthTokenSecret;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField("`status`")
|
||||
@Column("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("`created_by`")
|
||||
@Column("created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("`created_time`")
|
||||
@Column("created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("`update_by`")
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("`update_time`")
|
||||
@Column("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableField("`is_deleted`")
|
||||
@Column("is_deleted")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@@ -16,55 +16,55 @@ import java.util.Date;
|
||||
* @since 2024-05-23 20:13:10
|
||||
*/
|
||||
@Data
|
||||
@TableName("schisandra_auth_social_user_mapper")
|
||||
@Table("schisandra_auth_social_user_mapper")
|
||||
public class SchisandraAuthSocialUserMapper implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "`id`", type = IdType.AUTO)
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 系统用户ID
|
||||
*/
|
||||
@TableField("`user_id`")
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 社会化用户ID
|
||||
*/
|
||||
@TableField("`social_user_id`")
|
||||
@Column("social_user_id")
|
||||
private Long socialUserId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("`created_by`")
|
||||
@Column("created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("`created_time`")
|
||||
@Column("created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("`update_by`")
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("`update_time`")
|
||||
@Column("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`is_deleted`")
|
||||
@Column("is_deleted")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.schisandra.auth.infra.interceptor.EncryptInterceptor;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -17,123 +17,123 @@ import java.util.Date;
|
||||
* @since 2024-05-23 20:00:28
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "schisandra_auth_user",autoResultMap = true)
|
||||
@Table(value = "schisandra_auth_user")
|
||||
public class SchisandraAuthUser implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@TableField(value = "`user_name`")
|
||||
@Column(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@TableField("`nick_name`")
|
||||
@Column("nick_name")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`email`")
|
||||
@Column("email")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`phone`")
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "`password`",typeHandler = EncryptInterceptor.class)
|
||||
@Column(value = "password")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`gender`")
|
||||
@Column("gender")
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`avatar`")
|
||||
@Column("avatar")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`status`")
|
||||
@Column("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`introduce`")
|
||||
@Column("introduce")
|
||||
private String introduce;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`ext_json`")
|
||||
@Column("ext_json")
|
||||
private String extJson;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("`created_by`")
|
||||
@Column("created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("`created_time`")
|
||||
@Column("created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("`update_by`")
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("`update_time`")
|
||||
@Column("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`is_deleted`")
|
||||
@Column("is_deleted")
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`blog`")
|
||||
@Column("blog")
|
||||
private String blog;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`location`")
|
||||
@Column("location")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`company`")
|
||||
@Column("company")
|
||||
private String company;
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -16,55 +17,55 @@ import java.util.Date;
|
||||
* @since 2024-05-25 18:05:40
|
||||
*/
|
||||
@Data
|
||||
@TableName("schisandra_auth_user_role")
|
||||
@Table("schisandra_auth_user_role")
|
||||
public class SchisandraAuthUserRole implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "`id`", type = IdType.AUTO)
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`user_id`")
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`role_id`")
|
||||
@Column("role_id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("`created_by`")
|
||||
@Column("created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("`created_time`")
|
||||
@Column("created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("`update_by`")
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("`update_time`")
|
||||
@Column("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`is_deleted`")
|
||||
@Column("is_deleted")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -17,6 +19,7 @@ public class SchisandraSmsConfig implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(value = "id", keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
/**
|
||||
* 配置id
|
||||
|
@@ -45,7 +45,7 @@ public interface SchisandraAuthSocialUserMapperService {
|
||||
/**
|
||||
* 根据条件查询角色
|
||||
*/
|
||||
SchisandraAuthSocialUserMapper queryByCondition(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper);
|
||||
SchisandraAuthSocialUserMapper queryBySocialUserId(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper);
|
||||
|
||||
int insertAuthSocialUserMapperByOauth(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper);
|
||||
}
|
||||
|
@@ -42,10 +42,6 @@ public interface SchisandraAuthSocialUserService {
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 根据条件查询角色
|
||||
*/
|
||||
SchisandraAuthSocialUser queryByCondition(SchisandraAuthSocialUser schisandraAuthSocialUser);
|
||||
|
||||
SchisandraAuthSocialUser selectByUuidAndType(String uuid,String type);
|
||||
|
||||
|
@@ -42,9 +42,6 @@ public interface SchisandraAuthUserRoleService {
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 根据条件查询角色
|
||||
*/
|
||||
SchisandraAuthUserRole queryByCondition(SchisandraAuthUserRole schisandraAuthUserRole);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -48,10 +48,6 @@ public interface SchisandraAuthUserService {
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 根据条件查询角色
|
||||
*/
|
||||
SchisandraAuthUser queryByCondition(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
int insertAuthUserByOauth(SchisandraAuthUser schisandraAuthUser);
|
||||
}
|
||||
|
@@ -1,18 +1,16 @@
|
||||
package com.schisandra.auth.infra.basic.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.schisandra.auth.infra.basic.dao.SchisandraAuthSocialUserMapperDao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUserMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.table.SchisandraAuthSocialUserMapperTableDef;
|
||||
import com.schisandra.auth.infra.basic.service.SchisandraAuthSocialUserMapperService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 表服务实现类
|
||||
* 表服务实现类
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 20:13:10
|
||||
@@ -31,7 +29,7 @@ public class SchisandraAuthSocialUserMapperServiceImpl implements SchisandraAuth
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthSocialUserMapper queryById(Long id) {
|
||||
return this.schisandraAuthSocialUserMapperDao.selectById(id);
|
||||
return this.schisandraAuthSocialUserMapperDao.selectOneById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +51,7 @@ public class SchisandraAuthSocialUserMapperServiceImpl implements SchisandraAuth
|
||||
*/
|
||||
@Override
|
||||
public int update(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper) {
|
||||
return this.schisandraAuthSocialUserMapperDao.updateById(schisandraAuthSocialUserMapper);
|
||||
return this.schisandraAuthSocialUserMapperDao.update(schisandraAuthSocialUserMapper, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,25 +72,15 @@ public class SchisandraAuthSocialUserMapperServiceImpl implements SchisandraAuth
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthSocialUserMapper queryByCondition(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper) {
|
||||
public SchisandraAuthSocialUserMapper queryBySocialUserId(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper) {
|
||||
|
||||
LambdaQueryWrapper<SchisandraAuthSocialUserMapper> queryWrapper = Wrappers.<SchisandraAuthSocialUserMapper>lambdaQuery()
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getId()), SchisandraAuthSocialUserMapper::getId, schisandraAuthSocialUserMapper.getId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getUserId()), SchisandraAuthSocialUserMapper::getUserId, schisandraAuthSocialUserMapper.getUserId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getSocialUserId()), SchisandraAuthSocialUserMapper::getSocialUserId, schisandraAuthSocialUserMapper.getSocialUserId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getCreatedBy()), SchisandraAuthSocialUserMapper::getCreatedBy, schisandraAuthSocialUserMapper.getCreatedBy())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getCreatedTime()), SchisandraAuthSocialUserMapper::getCreatedTime, schisandraAuthSocialUserMapper.getCreatedTime())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getUpdateBy()), SchisandraAuthSocialUserMapper::getUpdateBy, schisandraAuthSocialUserMapper.getUpdateBy())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getUpdateTime()), SchisandraAuthSocialUserMapper::getUpdateTime, schisandraAuthSocialUserMapper.getUpdateTime())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUserMapper.getIsDeleted()), SchisandraAuthSocialUserMapper::getIsDeleted, schisandraAuthSocialUserMapper.getIsDeleted())
|
||||
;
|
||||
return schisandraAuthSocialUserMapperDao.selectOne(queryWrapper);
|
||||
return schisandraAuthSocialUserMapperDao.selectOneByCondition(SchisandraAuthSocialUserMapperTableDef.SCHISANDRA_AUTH_SOCIAL_USER_MAPPER.SOCIAL_USER_ID.eq(schisandraAuthSocialUserMapper.getSocialUserId()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertAuthSocialUserMapperByOauth(SchisandraAuthSocialUserMapper schisandraAuthSocialUserMapper) {
|
||||
return schisandraAuthSocialUserMapperDao.insert(schisandraAuthSocialUserMapper);
|
||||
return schisandraAuthSocialUserMapperDao.insert(schisandraAuthSocialUserMapper, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,17 +1,13 @@
|
||||
package com.schisandra.auth.infra.basic.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.schisandra.auth.infra.basic.dao.SchisandraAuthSocialUserDao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthSocialUser;
|
||||
import com.schisandra.auth.infra.basic.entity.table.SchisandraAuthSocialUserTableDef;
|
||||
import com.schisandra.auth.infra.basic.service.SchisandraAuthSocialUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 表服务实现类
|
||||
@@ -33,7 +29,7 @@ public class SchisandraAuthSocialUserServiceImpl implements SchisandraAuthSocial
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthSocialUser queryById(Long id) {
|
||||
return this.schisandraAuthSocialUserDao.selectById(id);
|
||||
return this.schisandraAuthSocialUserDao.selectOneById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +51,7 @@ public class SchisandraAuthSocialUserServiceImpl implements SchisandraAuthSocial
|
||||
*/
|
||||
@Override
|
||||
public int update(SchisandraAuthSocialUser schisandraAuthSocialUser) {
|
||||
return this.schisandraAuthSocialUserDao.updateById(schisandraAuthSocialUser);
|
||||
return this.schisandraAuthSocialUserDao.update(schisandraAuthSocialUser, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,48 +65,13 @@ public class SchisandraAuthSocialUserServiceImpl implements SchisandraAuthSocial
|
||||
return this.schisandraAuthSocialUserDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param schisandraAuthSocialUser 条件
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthSocialUser queryByCondition(SchisandraAuthSocialUser schisandraAuthSocialUser) {
|
||||
|
||||
LambdaQueryWrapper<SchisandraAuthSocialUser> queryWrapper = Wrappers.<SchisandraAuthSocialUser>lambdaQuery()
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getId()), SchisandraAuthSocialUser::getId, schisandraAuthSocialUser.getId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getUuid()), SchisandraAuthSocialUser::getUuid, schisandraAuthSocialUser.getUuid())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getSource()), SchisandraAuthSocialUser::getSource, schisandraAuthSocialUser.getSource())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getAccessToken()), SchisandraAuthSocialUser::getAccessToken, schisandraAuthSocialUser.getAccessToken())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getExpireIn()), SchisandraAuthSocialUser::getExpireIn, schisandraAuthSocialUser.getExpireIn())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getRefreshToken()), SchisandraAuthSocialUser::getRefreshToken, schisandraAuthSocialUser.getRefreshToken())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getOpenId()), SchisandraAuthSocialUser::getOpenId, schisandraAuthSocialUser.getOpenId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getUid()), SchisandraAuthSocialUser::getUid, schisandraAuthSocialUser.getUid())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getAccessCode()), SchisandraAuthSocialUser::getAccessCode, schisandraAuthSocialUser.getAccessCode())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getUnionId()), SchisandraAuthSocialUser::getUnionId, schisandraAuthSocialUser.getUnionId())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getScope()), SchisandraAuthSocialUser::getScope, schisandraAuthSocialUser.getScope())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getTokenType()), SchisandraAuthSocialUser::getTokenType, schisandraAuthSocialUser.getTokenType())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getIdToken()), SchisandraAuthSocialUser::getIdToken, schisandraAuthSocialUser.getIdToken())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getMacAlgorithm()), SchisandraAuthSocialUser::getMacAlgorithm, schisandraAuthSocialUser.getMacAlgorithm())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getMacKey()), SchisandraAuthSocialUser::getMacKey, schisandraAuthSocialUser.getMacKey())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getCode()), SchisandraAuthSocialUser::getCode, schisandraAuthSocialUser.getCode())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getOauthToken()), SchisandraAuthSocialUser::getOauthToken, schisandraAuthSocialUser.getOauthToken())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getOauthTokenSecret()), SchisandraAuthSocialUser::getOauthTokenSecret, schisandraAuthSocialUser.getOauthTokenSecret())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getStatus()), SchisandraAuthSocialUser::getStatus, schisandraAuthSocialUser.getStatus())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getCreatedBy()), SchisandraAuthSocialUser::getCreatedBy, schisandraAuthSocialUser.getCreatedBy())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getCreatedTime()), SchisandraAuthSocialUser::getCreatedTime, schisandraAuthSocialUser.getCreatedTime())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getUpdateBy()), SchisandraAuthSocialUser::getUpdateBy, schisandraAuthSocialUser.getUpdateBy())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getUpdateTime()), SchisandraAuthSocialUser::getUpdateTime, schisandraAuthSocialUser.getUpdateTime())
|
||||
.eq(Objects.nonNull(schisandraAuthSocialUser.getIsDeleted()), SchisandraAuthSocialUser::getIsDeleted, schisandraAuthSocialUser.getIsDeleted());
|
||||
return schisandraAuthSocialUserDao.selectOne(queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchisandraAuthSocialUser selectByUuidAndType(String uuid, String type) {
|
||||
return schisandraAuthSocialUserDao.selectOne(new QueryWrapper<SchisandraAuthSocialUser>()
|
||||
.eq("uuid", uuid).eq("source", type).eq("is_deleted", 0));
|
||||
return schisandraAuthSocialUserDao.selectOneByCondition(
|
||||
SchisandraAuthSocialUserTableDef.SCHISANDRA_AUTH_SOCIAL_USER.UUID.eq(uuid)
|
||||
.and(SchisandraAuthSocialUserTableDef.SCHISANDRA_AUTH_SOCIAL_USER.SOURCE.eq(type)
|
||||
.and(SchisandraAuthSocialUserTableDef.SCHISANDRA_AUTH_SOCIAL_USER.IS_DELETED.eq(0))));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,8 +81,7 @@ public class SchisandraAuthSocialUserServiceImpl implements SchisandraAuthSocial
|
||||
|
||||
@Override
|
||||
public int updateByOauth(SchisandraAuthSocialUser schisandraAuthSocialUser) {
|
||||
return schisandraAuthSocialUserDao.update(schisandraAuthSocialUser, new UpdateWrapper<SchisandraAuthSocialUser>()
|
||||
.eq("id", schisandraAuthSocialUser.getId()).eq("is_deleted", 0));
|
||||
return schisandraAuthSocialUserDao.update(schisandraAuthSocialUser, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.schisandra.auth.infra.basic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import com.schisandra.auth.infra.basic.dao.SchisandraAuthUserRoleDao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUserRole;
|
||||
import com.schisandra.auth.infra.basic.service.SchisandraAuthUserRoleService;
|
||||
@@ -31,7 +30,7 @@ public class SchisandraAuthUserRoleServiceImpl implements SchisandraAuthUserRole
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUserRole queryById(Long id) {
|
||||
return this.schisandraAuthUserRoleDao.selectById(id);
|
||||
return this.schisandraAuthUserRoleDao.selectOneById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +52,7 @@ public class SchisandraAuthUserRoleServiceImpl implements SchisandraAuthUserRole
|
||||
*/
|
||||
@Override
|
||||
public int update(SchisandraAuthUserRole schisandraAuthUserRole) {
|
||||
return this.schisandraAuthUserRoleDao.updateById(schisandraAuthUserRole);
|
||||
return this.schisandraAuthUserRoleDao.update(schisandraAuthUserRole,true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,27 +66,5 @@ public class SchisandraAuthUserRoleServiceImpl implements SchisandraAuthUserRole
|
||||
return this.schisandraAuthUserRoleDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param schisandraAuthUserRole 条件
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUserRole queryByCondition(SchisandraAuthUserRole schisandraAuthUserRole) {
|
||||
|
||||
LambdaQueryWrapper<SchisandraAuthUserRole> queryWrapper = Wrappers.<SchisandraAuthUserRole>lambdaQuery()
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getId()), SchisandraAuthUserRole::getId, schisandraAuthUserRole.getId())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getUserId()), SchisandraAuthUserRole::getUserId, schisandraAuthUserRole.getUserId())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getRoleId()), SchisandraAuthUserRole::getRoleId, schisandraAuthUserRole.getRoleId())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getCreatedBy()), SchisandraAuthUserRole::getCreatedBy, schisandraAuthUserRole.getCreatedBy())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getCreatedTime()), SchisandraAuthUserRole::getCreatedTime, schisandraAuthUserRole.getCreatedTime())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getUpdateBy()), SchisandraAuthUserRole::getUpdateBy, schisandraAuthUserRole.getUpdateBy())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getUpdateTime()), SchisandraAuthUserRole::getUpdateTime, schisandraAuthUserRole.getUpdateTime())
|
||||
.eq(Objects.nonNull(schisandraAuthUserRole.getIsDeleted()), SchisandraAuthUserRole::getIsDeleted, schisandraAuthUserRole.getIsDeleted())
|
||||
;
|
||||
return schisandraAuthUserRoleDao.selectOne(queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,15 +1,13 @@
|
||||
package com.schisandra.auth.infra.basic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import com.schisandra.auth.infra.basic.dao.SchisandraAuthUserDao;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import com.schisandra.auth.infra.basic.entity.table.SchisandraAuthUserTableDef;
|
||||
import com.schisandra.auth.infra.basic.service.SchisandraAuthUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUser)表服务实现类
|
||||
@@ -25,12 +23,14 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
|
||||
@Override
|
||||
public SchisandraAuthUser queryByEmail(String email) {
|
||||
return this.schisandraAuthUserDao.selectOne(new QueryWrapper<SchisandraAuthUser>().eq("email",email));
|
||||
return schisandraAuthUserDao.selectOneByCondition(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.EMAIL.eq(email)
|
||||
.and(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.IS_DELETED.eq(0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchisandraAuthUser queryByPhone(String phone) {
|
||||
return this.schisandraAuthUserDao.selectOne(new QueryWrapper<SchisandraAuthUser>().eq("phone", phone).eq("is_deleted", 0));
|
||||
return schisandraAuthUserDao.selectOneByCondition(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.PHONE.eq(phone)
|
||||
.and(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.IS_DELETED.eq(0)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser queryById(Long id) {
|
||||
return this.schisandraAuthUserDao.selectById(id);
|
||||
return this.schisandraAuthUserDao.selectOneById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
*/
|
||||
@Override
|
||||
public int update(SchisandraAuthUser schisandraAuthUser) {
|
||||
return this.schisandraAuthUserDao.updateById(schisandraAuthUser);
|
||||
return this.schisandraAuthUserDao.update(schisandraAuthUser, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,38 +78,6 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
return this.schisandraAuthUserDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param schisandraAuthUser 条件
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser queryByCondition(SchisandraAuthUser schisandraAuthUser) {
|
||||
|
||||
LambdaQueryWrapper<SchisandraAuthUser> queryWrapper = Wrappers.<SchisandraAuthUser>lambdaQuery()
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getId()), SchisandraAuthUser::getId, schisandraAuthUser.getId())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getUserName()), SchisandraAuthUser::getUserName, schisandraAuthUser.getUserName())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getNickName()), SchisandraAuthUser::getNickName, schisandraAuthUser.getNickName())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getEmail()), SchisandraAuthUser::getEmail, schisandraAuthUser.getEmail())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getPhone()), SchisandraAuthUser::getPhone, schisandraAuthUser.getPhone())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getPassword()), SchisandraAuthUser::getPassword, schisandraAuthUser.getPassword())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getGender()), SchisandraAuthUser::getGender, schisandraAuthUser.getGender())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getAvatar()), SchisandraAuthUser::getAvatar, schisandraAuthUser.getAvatar())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getStatus()), SchisandraAuthUser::getStatus, schisandraAuthUser.getStatus())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getIntroduce()), SchisandraAuthUser::getIntroduce, schisandraAuthUser.getIntroduce())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getExtJson()), SchisandraAuthUser::getExtJson, schisandraAuthUser.getExtJson())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getCreatedBy()), SchisandraAuthUser::getCreatedBy, schisandraAuthUser.getCreatedBy())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getCreatedTime()), SchisandraAuthUser::getCreatedTime, schisandraAuthUser.getCreatedTime())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getUpdateBy()), SchisandraAuthUser::getUpdateBy, schisandraAuthUser.getUpdateBy())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getUpdateTime()), SchisandraAuthUser::getUpdateTime, schisandraAuthUser.getUpdateTime())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getIsDeleted()), SchisandraAuthUser::getIsDeleted, schisandraAuthUser.getIsDeleted())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getBlog()), SchisandraAuthUser::getBlog, schisandraAuthUser.getBlog())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getLocation()), SchisandraAuthUser::getLocation, schisandraAuthUser.getLocation())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getCompany()), SchisandraAuthUser::getCompany, schisandraAuthUser.getCompany());
|
||||
return schisandraAuthUserDao.selectOne(queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertAuthUserByOauth(SchisandraAuthUser schisandraAuthUser) {
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package com.schisandra.auth.infra.config;
|
||||
|
||||
import com.mybatisflex.core.audit.AuditManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Classname MyBatisFlexConfiguration
|
||||
* @BelongsProject: schisandra-cloud-storage
|
||||
* @BelongsPackage: com.schisandra.oss.infra.config
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-05-31 16:14
|
||||
* @Description: Mybatis flex 配置类
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class MyBatisFlexConfiguration {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger("mybatis-flex-sql");
|
||||
|
||||
|
||||
public MyBatisFlexConfiguration() {
|
||||
//开启审计功能
|
||||
AuditManager.setAuditEnable(true);
|
||||
|
||||
//设置 SQL 审计收集器
|
||||
AuditManager.setMessageCollector(auditMessage ->
|
||||
logger.info("{},{}ms", auditMessage.getFullSql()
|
||||
, auditMessage.getElapsedTime())
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.schisandra.auth.infra.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisConfiguration {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(){
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new MybatisPlusAllSqlLog());
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
package com.schisandra.auth.infra.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class MybatisPlusAllSqlLog implements InnerInterceptor {
|
||||
public static final Logger log = LoggerFactory.getLogger("sys-sql");
|
||||
|
||||
@Override
|
||||
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
|
||||
logInfo(boundSql, ms, parameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeUpdate(Executor executor, MappedStatement ms, Object parameter) throws SQLException {
|
||||
BoundSql boundSql = ms.getBoundSql(parameter);
|
||||
logInfo(boundSql, ms, parameter);
|
||||
}
|
||||
|
||||
private static void logInfo(BoundSql boundSql, MappedStatement ms, Object parameter) {
|
||||
try {
|
||||
log.info("parameter = " + parameter);
|
||||
// 获取到节点的id,即sql语句的id
|
||||
String sqlId = ms.getId();
|
||||
log.info("sqlId = " + sqlId);
|
||||
// 获取节点的配置
|
||||
Configuration configuration = ms.getConfiguration();
|
||||
// 获取到最终的sql语句
|
||||
String sql = getSql(configuration, boundSql, sqlId);
|
||||
log.info("完整的sql:{}", sql);
|
||||
} catch (Exception e) {
|
||||
log.error("异常:{}", e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 封装了一下sql语句,使得结果返回完整xml路径下的sql语句节点id + sql语句
|
||||
public static String getSql(Configuration configuration, BoundSql boundSql, String sqlId) {
|
||||
return sqlId + ":" + showSql(configuration, boundSql);
|
||||
}
|
||||
|
||||
// 进行?的替换
|
||||
public static String showSql(Configuration configuration, BoundSql boundSql) {
|
||||
// 获取参数
|
||||
Object parameterObject = boundSql.getParameterObject();
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
// sql语句中多个空格都用一个空格代替
|
||||
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
|
||||
if (!CollectionUtils.isEmpty(parameterMappings) && parameterObject != null) {
|
||||
// 获取类型处理器注册器,类型处理器的功能是进行java类型和数据库类型的转换
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
// 如果根据parameterObject.getClass()可以找到对应的类型,则替换
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
sql = sql.replaceFirst("\\?",
|
||||
Matcher.quoteReplacement(getParameterValue(parameterObject)));
|
||||
} else {
|
||||
// MetaObject主要是封装了originalObject对象,提供了get和set的方法用于获取和设置originalObject的属性值,主要支持对JavaBean、Collection、Map三种类型对象的操作
|
||||
MetaObject metaObject = configuration.newMetaObject(parameterObject);
|
||||
for (ParameterMapping parameterMapping : parameterMappings) {
|
||||
String propertyName = parameterMapping.getProperty();
|
||||
if (metaObject.hasGetter(propertyName)) {
|
||||
Object obj = metaObject.getValue(propertyName);
|
||||
sql = sql.replaceFirst("\\?",
|
||||
Matcher.quoteReplacement(getParameterValue(obj)));
|
||||
} else if (boundSql.hasAdditionalParameter(propertyName)) {
|
||||
// 该分支是动态sql
|
||||
Object obj = boundSql.getAdditionalParameter(propertyName);
|
||||
sql = sql.replaceFirst("\\?",
|
||||
Matcher.quoteReplacement(getParameterValue(obj)));
|
||||
} else {
|
||||
// 打印出缺失,提醒该参数缺失并防止错位
|
||||
sql = sql.replaceFirst("\\?", "缺失");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
// 如果参数是String,则添加单引号, 如果是日期,则转换为时间格式器并加单引号; 对参数是null和不是null的情况作了处理
|
||||
private static String getParameterValue(Object obj) {
|
||||
String value;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
|
||||
DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(new Date()) + "'";
|
||||
} else {
|
||||
if (obj != null) {
|
||||
value = obj.toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
@@ -1,52 +0,0 @@
|
||||
package com.schisandra.auth.infra.config;
|
||||
|
||||
import org.apache.ibatis.cache.CacheKey;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@Intercepts({
|
||||
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class,
|
||||
Object.class}),
|
||||
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class,
|
||||
Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class})})
|
||||
public class SqlStatementInterceptor implements Interceptor {
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger("sys-sql");
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
return invocation.proceed();
|
||||
} finally {
|
||||
long timeConsuming = System.currentTimeMillis() - startTime;
|
||||
log.info("执行SQL:{}ms", timeConsuming);
|
||||
if (timeConsuming > 999 && timeConsuming < 5000) {
|
||||
log.info("执行SQL大于1s:{}ms", timeConsuming);
|
||||
} else if (timeConsuming >= 5000 && timeConsuming < 10000) {
|
||||
log.info("执行SQL大于5s:{}ms", timeConsuming);
|
||||
} else if (timeConsuming >= 10000) {
|
||||
log.info("执行SQL大于10s:{}ms", timeConsuming);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
package com.schisandra.auth.infra.interceptor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.common.utils.AESUtils;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
public class EncryptInterceptor<T> extends BaseTypeHandler<T> {
|
||||
@Resource
|
||||
RedisUtil redisUtil;
|
||||
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
|
||||
String key = redisUtil.get("key1");
|
||||
// String md5BySalt = SaSecureUtil.md5BySalt("123456", "abc");
|
||||
try {
|
||||
ps.setString(i, AESUtils.encrypt((String) parameter, key));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String key = redisUtil.get("key1");
|
||||
try {
|
||||
if ( "password".equals(columnName)) {
|
||||
String columnValue = rs.getString(columnName);
|
||||
return (T) columnValue;
|
||||
}else {
|
||||
String columnValue = rs.getString(columnName);
|
||||
return StrUtil.isBlank(columnValue) ? (T) columnValue : (T) AESUtils.decrypt(columnValue, key);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String key = redisUtil.get("key1");
|
||||
String columnValue = rs.getString(columnIndex);
|
||||
return StrUtil.isBlank(columnValue) ? (T) columnValue : (T) AESUtils.decrypt(columnValue, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String key = redisUtil.get("key1");
|
||||
String columnValue = cs.getString(columnIndex);
|
||||
try {
|
||||
return StrUtil.isBlank(columnValue) ? (T) columnValue : (T) AESUtils.decrypt(columnValue, key);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.schisandra.auth.infra.basic.entity.SchisandraAuthUser">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" typeHandler="com.schisandra.auth.infra.interceptor.EncryptInterceptor"/>
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
|
||||
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
|
||||
<result column="email" jdbcType="VARCHAR" property="email"/>
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
||||
|
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : MySQL Cloud
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50744 (5.7.44)
|
||||
Source Host : 116.196.80.239:3306
|
||||
Source Schema : schisandra-cloud-storage
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50744 (5.7.44)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 26/04/2024 01:28:16
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for schisandra_auth_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `schisandra_auth_permission`;
|
||||
CREATE TABLE `schisandra_auth_permission` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`parent_id` bigint(20) NULL DEFAULT NULL,
|
||||
`type` tinyint(4) NULL DEFAULT NULL,
|
||||
`menu_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`status` tinyint(4) NULL DEFAULT NULL,
|
||||
`show` tinyint(4) NULL DEFAULT NULL,
|
||||
`icon` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`permission_key` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`created_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`created_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`is_deleted` int(11) NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of schisandra_auth_permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `schisandra_auth_permission` VALUES (1, '普通用户', 0, 1, '1adiwd/awdw', 0, 0, 'httt://1.png', 'subject:add', NULL, NULL, NULL, NULL, 1);
|
||||
INSERT INTO `schisandra_auth_permission` VALUES (2, '管理员', 0, 1, '1adiwd/awdw', 0, 0, 'httt://1.png', 'subject:add', NULL, NULL, NULL, NULL, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for schisandra_auth_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `schisandra_auth_role`;
|
||||
CREATE TABLE `schisandra_auth_role` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`role_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`role_key` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`created_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`created_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`is_deleted` int(11) NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of schisandra_auth_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `schisandra_auth_role` VALUES (1, '普通用户', 'normal_user', NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `schisandra_auth_role` VALUES (2, '管理员', 'admin', NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `schisandra_auth_role` VALUES (3, '超级管理员', 'super_admin', NULL, NULL, NULL, NULL, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for schisandra_auth_role_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `schisandra_auth_role_permission`;
|
||||
CREATE TABLE `schisandra_auth_role_permission` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`role_id` bigint(20) NULL DEFAULT NULL,
|
||||
`permission_id` bigint(20) NULL DEFAULT NULL,
|
||||
`created_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`created_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`is_deleted` int(11) NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of schisandra_auth_role_permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `schisandra_auth_role_permission` VALUES (1, 2, 1, NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `schisandra_auth_role_permission` VALUES (2, 3, 2, NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `schisandra_auth_role_permission` VALUES (3, 1, 1, NULL, NULL, NULL, NULL, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for schisandra_auth_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `schisandra_auth_user`;
|
||||
CREATE TABLE `schisandra_auth_user` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`user_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`nick_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`email` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`password` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`sex` tinyint(4) NULL DEFAULT NULL,
|
||||
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`status` tinyint(4) NULL DEFAULT NULL,
|
||||
`introduce` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`ext_json` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`created_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`created_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`is_deleted` int(11) NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of schisandra_auth_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `schisandra_auth_user` VALUES (8, 'oF9UX6c2GNEHUpoQZRTrkHTmLYHs', NULL, NULL, NULL, NULL, NULL, 'http://117.72.10.84:9000/user/icon/微信图片_20231203153718(1).png', 0, NULL, NULL, NULL, NULL, NULL, NULL, 0);
|
||||
INSERT INTO `schisandra_auth_user` VALUES (9, '666', '666', '666', '555', '666', 1, '', 1, '', '', NULL, NULL, NULL, NULL, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for schisandra_auth_user_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `schisandra_auth_user_role`;
|
||||
CREATE TABLE `schisandra_auth_user_role` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) NULL DEFAULT NULL,
|
||||
`role_id` bigint(20) NULL DEFAULT NULL,
|
||||
`created_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`created_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`is_deleted` int(11) NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of schisandra_auth_user_role
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@@ -133,6 +133,11 @@
|
||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.9.0</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -80,21 +80,17 @@ sms:
|
||||
isPrint: false
|
||||
HttpLog: true
|
||||
|
||||
# mybatis-plus日志
|
||||
mybatis-plus:
|
||||
mybatis-flex:
|
||||
global-config:
|
||||
banner: false
|
||||
print-banner: false
|
||||
key-config:
|
||||
key-type: auto
|
||||
normal-value-of-logic-delete: 0
|
||||
deleted-value-of-logic-delete: 1
|
||||
logic-delete-column: is_deleted
|
||||
mapper-locations:
|
||||
- "classpath*:/mapper/**/*.xml"
|
||||
|
||||
# 前端地址
|
||||
web:
|
||||
url: http://127.0.0.1:5173/
|
||||
|
||||
feign:
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connectTimeout: 60000
|
||||
readTimeout: 60000
|
||||
ribbon:
|
||||
ConnectTimeout: 60000
|
||||
ReadTimeout: 60000
|
||||
url: http://127.0.0.1:5173/
|
Reference in New Issue
Block a user