feat: update
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package com.schisandra.auth.application.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.schisandra.auth.application.convert.SchisandraAuthUserDTOConverter;
|
||||
import com.schisandra.auth.application.dto.SchisandraAuthUserDTO;
|
||||
import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import com.schisandra.auth.domain.service.SchisandraAuthUserDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -13,144 +13,134 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Classname SchisandraAuthUserController
|
||||
* @BelongsProject: schisandra-cloud-storage
|
||||
* @BelongsPackage: com.schisandra.auth.application.controller
|
||||
* @Author: schisandra
|
||||
* @CreateTime: 2024-03-21 22:48
|
||||
* @Description: AuthUserController层
|
||||
* @Version: 1.0
|
||||
* controller
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/")
|
||||
@RequestMapping("/auth/")
|
||||
@Slf4j
|
||||
public class SchisandraAuthUserController {
|
||||
|
||||
@Resource
|
||||
private SchisandraAuthUserDomainService schisandraAuthUserDomainService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
/**
|
||||
* @param schisandraAuthUserDTO
|
||||
* @return com.schisandra.auth.common.entity.Result<java.lang.Boolean>
|
||||
* @description 更新用户信息
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:06
|
||||
*/
|
||||
|
||||
@PostMapping("register")
|
||||
public Result register(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("UserController.register.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
}
|
||||
if (redisUtil.exist("auth.phone."+schisandraAuthUserDTO.getPhone())){
|
||||
if (redisUtil.get("auth.phone."+schisandraAuthUserDTO.getPhone())!=schisandraAuthUserDTO.getAvatar()){
|
||||
return Result.fail("验证码错误,请重新验证");
|
||||
}
|
||||
}else {
|
||||
return Result.fail("验证码错误,请重新验证");
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("add")
|
||||
public Result<Boolean> add(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
|
||||
try {
|
||||
checkUserInfo(schisandraAuthUserDTO);
|
||||
SchisandraAuthUserBO authUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
if (schisandraAuthUserDomainService.register(authUserBO)==1){
|
||||
return Result.fail("注册用户成功");
|
||||
}else {
|
||||
return Result.fail("注册用户失败");
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SchisandraAuthUserController.add.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
}
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getId(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUuid(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUserName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getNickName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getEmail(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPhone(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPassword(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getSex(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getAvatar(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getStatus(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIntroduce(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getExtJson(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedBy(), "创建人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedTime(), "创建时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateBy(), "更新人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateTime(), "更新时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIsDeleted(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getBlog(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getLocation(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCompany(), "不能为空");
|
||||
SchisandraAuthUserBO SchisandraAuthUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.add(SchisandraAuthUserBO));
|
||||
} catch (Exception e) {
|
||||
return Result.fail("注册用户失败");
|
||||
log.error("SchisandraAuthUserController.register.error:{}", e.getMessage(), e);
|
||||
return Result.fail("新增失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("update")
|
||||
public Result update(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
public Result<Boolean> update(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("UserController.update.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
log.info("SchisandraAuthUserController.update.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
}
|
||||
checkUserInfo(schisandraAuthUserDTO);
|
||||
SchisandraAuthUserBO authUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.update(authUserBO));
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getId(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUuid(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUserName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getNickName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getEmail(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPhone(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPassword(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getSex(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getAvatar(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getStatus(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIntroduce(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getExtJson(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedBy(), "创建人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedTime(), "创建时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateBy(), "更新人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateTime(), "更新时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIsDeleted(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getBlog(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getLocation(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCompany(), "不能为空");
|
||||
SchisandraAuthUserBO schisandraAuthUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.update(schisandraAuthUserBO));
|
||||
} catch (Exception e) {
|
||||
log.error("UserController.update.error:{}", e.getMessage(), e);
|
||||
return Result.fail("更新用户信息失败");
|
||||
log.error("SchisandraAuthUserController.update.error:{}", e.getMessage(), e);
|
||||
return Result.fail("更新信息失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserDTO
|
||||
* @return
|
||||
* @description 查询用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:05
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/query")
|
||||
public Result query(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
@DeleteMapping("delete")
|
||||
public Result<Boolean> delete(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("UserController.select.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
log.info("SchisandraAuthUserController.delete.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
}
|
||||
checkUserInfo(schisandraAuthUserDTO);
|
||||
SchisandraAuthUserBO authUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.queryById(authUserBO));
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getId(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUuid(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUserName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getNickName(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getEmail(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPhone(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getPassword(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getSex(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getAvatar(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getStatus(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIntroduce(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getExtJson(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedBy(), "创建人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCreatedTime(), "创建时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateBy(), "更新人不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getUpdateTime(), "更新时间不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getIsDeleted(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getBlog(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getLocation(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraAuthUserDTO.getCompany(), "不能为空");
|
||||
SchisandraAuthUserBO schisandraAuthUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.delete(schisandraAuthUserBO));
|
||||
} catch (Exception e) {
|
||||
log.error("UserController.select.error:{}", e.getMessage(), e);
|
||||
return Result.fail("查询用户信息失败");
|
||||
log.error("SchisandraAuthUserController.delete.error:{}", e.getMessage(), e);
|
||||
return Result.fail("删除信息失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserDTO
|
||||
* @return
|
||||
* @description 添加用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:12
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
public Result insert(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("UserController.insert.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
|
||||
}
|
||||
checkUserInfo(schisandraAuthUserDTO);
|
||||
SchisandraAuthUserBO authUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||
return Result.ok(schisandraAuthUserDomainService.update(authUserBO));
|
||||
} catch (Exception e) {
|
||||
log.error("UserController.insert.error:{}", e.getMessage(), e);
|
||||
return Result.fail("添加用户信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
* @description 删除用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:12
|
||||
*/
|
||||
@GetMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable Long id) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("UserController.insert.dto:{}", id);
|
||||
}
|
||||
return Result.ok(schisandraAuthUserDomainService.deleteById(id));
|
||||
} catch (Exception e) {
|
||||
log.error("UserController.insert.error:{}", e.getMessage(), e);
|
||||
return Result.fail("删除用户信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserDTO
|
||||
* @return void
|
||||
* @description 用户信息断言校验
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:09
|
||||
*/
|
||||
private void checkUserInfo(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||
// Preconditions.checkArgument(!StringUtils.isBlank(schisandraAuthUserDTO.getUserName()), "用户名不能为空");
|
||||
// Preconditions.checkArgument(!StringUtils.isBlank(schisandraAuthUserDTO.getEmail()), "邮箱不能为空");
|
||||
// Preconditions.checkArgument(!StringUtils.isBlank(schisandraAuthUserDTO.getPassword()), "密码不能为空");
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,22 @@
|
||||
package com.schisandra.auth.application.convert;
|
||||
|
||||
|
||||
import com.schisandra.auth.application.dto.SchisandraAuthUserDTO;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 用户dto转换器
|
||||
* dto转换器
|
||||
*
|
||||
* @author schisandra
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
@Mapper
|
||||
public interface SchisandraAuthUserDTOConverter {
|
||||
|
||||
SchisandraAuthUserDTOConverter INSTANCE = Mappers.getMapper(SchisandraAuthUserDTOConverter.class);
|
||||
|
||||
/**
|
||||
* @param authUserDTO
|
||||
* @return com.schisandra.auth.domain.bo.SchisandraAuthUserBO
|
||||
* @description DTO转BO
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:11
|
||||
*/
|
||||
|
||||
SchisandraAuthUserBO convertDTOToBO(SchisandraAuthUserDTO authUserDTO);
|
||||
|
||||
/**
|
||||
* @description: BO转DTO
|
||||
* @param: [authUserBO]
|
||||
* @return: com.schisandra.auth.application.dto.SchisandraAuthUserDTO
|
||||
* @author: schisandra
|
||||
* @date: 2024/3/21 23:26
|
||||
*/
|
||||
SchisandraAuthUserDTO convertBOToDTO(SchisandraAuthUserBO authUserBO);
|
||||
SchisandraAuthUserBO convertDTOToBO(SchisandraAuthUserDTO schisandraAuthUserDTO);
|
||||
|
||||
}
|
||||
|
@@ -1,78 +1,118 @@
|
||||
package com.schisandra.auth.application.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUserDTO)实体类
|
||||
* dto
|
||||
*
|
||||
* @author labdaiqing
|
||||
* @since 2024-03-21 20:15:43
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Data
|
||||
//@Builder
|
||||
public class SchisandraAuthUserDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* id主键
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 介绍
|
||||
*
|
||||
*/
|
||||
private String introduce;
|
||||
|
||||
/**
|
||||
* 额外字段
|
||||
*
|
||||
*/
|
||||
private String extJson;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
* 创建人
|
||||
*/
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String blog;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String company;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,79 +1,118 @@
|
||||
package com.schisandra.auth.domain.bo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUserBO)实体类
|
||||
* bo
|
||||
*
|
||||
* @author labdaiqing
|
||||
* @since 2024-03-21 20:15:43
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Data
|
||||
//@Builder
|
||||
public class SchisandraAuthUserBO implements Serializable {
|
||||
|
||||
/**
|
||||
* id主键
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 介绍
|
||||
*
|
||||
*/
|
||||
private String introduce;
|
||||
|
||||
/**
|
||||
* 额外字段
|
||||
*
|
||||
*/
|
||||
private String extJson;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
* 创建人
|
||||
*/
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String blog;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String company;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,37 +1,22 @@
|
||||
package com.schisandra.auth.domain.convert;
|
||||
|
||||
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 用户bo转换器
|
||||
* bo转换器
|
||||
*
|
||||
* @author schisandra
|
||||
* @date 2024/3/21
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
@Mapper
|
||||
public interface SchisandraAuthUserBOConverter {
|
||||
|
||||
SchisandraAuthUserBOConverter INSTANCE = Mappers.getMapper(SchisandraAuthUserBOConverter.class);
|
||||
|
||||
/**
|
||||
* @description 将bo转换为实体
|
||||
* @param schisandraAuthUserBO
|
||||
* @return com.schisandra.auth.infra.basic.entity.SchisandraAuthUser
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:13
|
||||
*/
|
||||
SchisandraAuthUser convertBOToEntity(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
|
||||
/**
|
||||
* @description 将实体转换为bo
|
||||
* @param schisandraAuthUser
|
||||
* @return com.schisandra.auth.domain.bo.SchisandraAuthUserBO
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:13
|
||||
*/
|
||||
SchisandraAuthUserBO convertEntityToBO(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
}
|
||||
|
@@ -1,49 +1,28 @@
|
||||
package com.schisandra.auth.domain.service;
|
||||
|
||||
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
|
||||
/**
|
||||
* 用户领域service
|
||||
* 领域service
|
||||
*
|
||||
* @author schisandra
|
||||
* @date 2024/3/21
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
public interface SchisandraAuthUserDomainService {
|
||||
|
||||
|
||||
int register(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
/**
|
||||
* 添加 信息
|
||||
*/
|
||||
Boolean add(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
|
||||
/**
|
||||
* @description 更新用户信息
|
||||
* @param schisandraAuthUserBO
|
||||
* @return java.lang.Object
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:14
|
||||
* 更新 信息
|
||||
*/
|
||||
Object update(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
Boolean update(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
|
||||
/**
|
||||
* @description 查询用户信息
|
||||
* @param schisandraAuthUserBO
|
||||
* @author msz
|
||||
* @return com.schisandra.auth.infra.basic.entity.SchisandraAuthUser
|
||||
* 删除 信息
|
||||
*/
|
||||
SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
/**
|
||||
* @description 添加用户信息
|
||||
* @param schisandraAuthUserBO
|
||||
* @author msz
|
||||
* @return java.lang.object
|
||||
*/
|
||||
Object insert(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
/**
|
||||
* @description 删除用户(物理)
|
||||
* @param id
|
||||
* @author msz
|
||||
* @return java.lang.object
|
||||
*/
|
||||
Object deleteById(Long id);
|
||||
Boolean delete(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.schisandra.auth.domain.service.impl;
|
||||
|
||||
|
||||
import com.schisandra.auth.common.enums.IsDeletedFlagEnum;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import com.schisandra.auth.domain.convert.SchisandraAuthUserBOConverter;
|
||||
import com.schisandra.auth.domain.service.SchisandraAuthUserDomainService;
|
||||
@@ -10,87 +12,38 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 领域service实现了
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDomainService {
|
||||
|
||||
@Resource
|
||||
private SchisandraAuthUserService schisandraAuthUserService;
|
||||
/**
|
||||
* @description: 注册用户
|
||||
* @param: [schisandraAuthUserBO]
|
||||
* @return: com.schisandra.auth.domain.bo.SchisandraAuthUserBO
|
||||
* @author zlg
|
||||
* @date: 2024/5/14 20:59
|
||||
*/
|
||||
@Override
|
||||
public int register(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryByPhone(schisandraAuthUserBO.getPhone());
|
||||
if (schisandraAuthUser != null) {
|
||||
return 0;
|
||||
} else {
|
||||
SchisandraAuthUser schisandraAuthUser1 = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO);
|
||||
if (schisandraAuthUserService.insert(schisandraAuthUser1)==null) {
|
||||
return 0;
|
||||
}else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserBO
|
||||
* @return java.lang.Object
|
||||
* @description 更新用户信息
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:14
|
||||
*/
|
||||
@Override
|
||||
public Object update(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
public Boolean add(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO);
|
||||
Integer count = schisandraAuthUserService.update(schisandraAuthUser);
|
||||
return count > 0;
|
||||
schisandraAuthUser.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||
return schisandraAuthUserService.insert(schisandraAuthUser) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserBO
|
||||
* @return
|
||||
* @description 查询用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:10
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(schisandraAuthUserBO.getId());
|
||||
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
||||
return schisandraAuthUserBO1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserBO
|
||||
* @return java.lang.Object
|
||||
* @description 添加用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:17
|
||||
*/
|
||||
@Override
|
||||
public Object insert(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
public Boolean update(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO);
|
||||
SchisandraAuthUser user = schisandraAuthUserService.insert(schisandraAuthUser);
|
||||
return user != null;
|
||||
return schisandraAuthUserService.update(schisandraAuthUser) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return java.lang.Object
|
||||
* @description 添加用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:30
|
||||
*/
|
||||
@Override
|
||||
public Object deleteById(Long id) {
|
||||
boolean flag = schisandraAuthUserService.deleteById(id);
|
||||
return flag;
|
||||
public Boolean delete(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = new SchisandraAuthUser();
|
||||
schisandraAuthUser.setId(schisandraAuthUserBO.getId());
|
||||
schisandraAuthUser.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
|
||||
return schisandraAuthUserService.update(schisandraAuthUser) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,85 +1,17 @@
|
||||
package com.schisandra.auth.infra.basic.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUser)表数据库访问层
|
||||
* 表数据库访问层
|
||||
*
|
||||
* @author schisandra
|
||||
* @since 2024-03-21 20:15:43
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
public interface SchisandraAuthUserDao {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
SchisandraAuthUser queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param schisandraAuthUser 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<SchisandraAuthUser> queryAllByLimit(SchisandraAuthUser schisandraAuthUser, @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param schisandraAuthUser 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<SchisandraAuthUser> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<SchisandraAuthUser> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<SchisandraAuthUser> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthUser> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param schisandraAuthUser 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
SchisandraAuthUser queryByPhone(String phone);
|
||||
@Repository
|
||||
public interface SchisandraAuthUserDao extends BaseMapper<SchisandraAuthUser> {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,97 +1,143 @@
|
||||
package com.schisandra.auth.infra.basic.entity;
|
||||
|
||||
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.util.Date;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUser)实体类
|
||||
* 实体类
|
||||
*
|
||||
* @author labdaiqing
|
||||
* @since 2024-03-21 20:15:43
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Data
|
||||
@TableName("schisandra_auth_user")
|
||||
public class SchisandraAuthUser implements Serializable {
|
||||
|
||||
/**
|
||||
* id主键
|
||||
*
|
||||
*/
|
||||
@TableId(value = "`id`", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*
|
||||
*/
|
||||
@TableField("`uuid`")
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`user_name`")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*
|
||||
*/
|
||||
@TableField("`nick_name`")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*
|
||||
*/
|
||||
@TableField("`email`")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*
|
||||
*/
|
||||
@TableField("`phone`")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*
|
||||
*/
|
||||
@TableField("`password`")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
*/
|
||||
@TableField("`sex`")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*
|
||||
*/
|
||||
@TableField("`avatar`")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
*/
|
||||
@TableField("`status`")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 介绍
|
||||
*
|
||||
*/
|
||||
@TableField("`introduce`")
|
||||
private String introduce;
|
||||
|
||||
/**
|
||||
* 额外字段
|
||||
*
|
||||
*/
|
||||
@TableField("`ext_json`")
|
||||
private String extJson;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("`created_by`")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("`created_time`")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("`update_by`")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("`update_time`")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*
|
||||
*/
|
||||
@TableField("`is_deleted`")
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`blog`")
|
||||
private String blog;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`location`")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField("`company`")
|
||||
private String company;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,14 +1,12 @@
|
||||
package com.schisandra.auth.infra.basic.service;
|
||||
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUser)表服务接口
|
||||
* 表服务接口
|
||||
*
|
||||
* @author schisandra
|
||||
* @since 2024-03-21 20:15:44
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
public interface SchisandraAuthUserService {
|
||||
|
||||
@@ -20,22 +18,13 @@ public interface SchisandraAuthUserService {
|
||||
*/
|
||||
SchisandraAuthUser queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param schisandraAuthUser 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
Page<SchisandraAuthUser> queryByPage(SchisandraAuthUser schisandraAuthUser, PageRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param schisandraAuthUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
SchisandraAuthUser insert(SchisandraAuthUser schisandraAuthUser);
|
||||
int insert(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
@@ -43,7 +32,7 @@ public interface SchisandraAuthUserService {
|
||||
* @param schisandraAuthUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
Integer update(SchisandraAuthUser schisandraAuthUser);
|
||||
int update(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
@@ -53,6 +42,9 @@ public interface SchisandraAuthUserService {
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
SchisandraAuthUser queryByPhone(String phone);
|
||||
/**
|
||||
* 根据条件查询角色
|
||||
*/
|
||||
SchisandraAuthUser queryByCondition(SchisandraAuthUser schisandraAuthUser);
|
||||
|
||||
}
|
||||
|
@@ -1,23 +1,25 @@
|
||||
package com.schisandra.auth.infra.basic.service.impl;
|
||||
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.service.SchisandraAuthUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* (SchisandraAuthUser)表服务实现类
|
||||
* 表服务实现类
|
||||
*
|
||||
* @author schisandra
|
||||
* @since 2024-03-21 20:15:44
|
||||
* @author landaiqing
|
||||
* @since 2024-05-23 12:55:58
|
||||
*/
|
||||
@Service("schisandraAuthUserService")
|
||||
@Service("SchisandraAuthUserService")
|
||||
public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService {
|
||||
|
||||
@Resource
|
||||
private SchisandraAuthUserDao schisandraAuthUserDao;
|
||||
|
||||
@@ -29,20 +31,7 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser queryById(Long id) {
|
||||
return this.schisandraAuthUserDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param schisandraAuthUser 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public Page<SchisandraAuthUser> queryByPage(SchisandraAuthUser schisandraAuthUser, PageRequest pageRequest) {
|
||||
long total = this.schisandraAuthUserDao.count(schisandraAuthUser);
|
||||
return new PageImpl<>(this.schisandraAuthUserDao.queryAllByLimit(schisandraAuthUser, pageRequest), pageRequest, total);
|
||||
return this.schisandraAuthUserDao.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,9 +41,8 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser insert(SchisandraAuthUser schisandraAuthUser) {
|
||||
this.schisandraAuthUserDao.insert(schisandraAuthUser);
|
||||
return schisandraAuthUser;
|
||||
public int insert(SchisandraAuthUser schisandraAuthUser) {
|
||||
return this.schisandraAuthUserDao.insert(schisandraAuthUser);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,9 +52,8 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public Integer update(SchisandraAuthUser schisandraAuthUser) {
|
||||
return this.schisandraAuthUserDao.update(schisandraAuthUser);
|
||||
|
||||
public int update(SchisandraAuthUser schisandraAuthUser) {
|
||||
return this.schisandraAuthUserDao.updateById(schisandraAuthUser);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,8 +67,39 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
|
||||
return this.schisandraAuthUserDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param schisandraAuthUser 条件
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser queryByPhone(String phone) {
|
||||
return this.schisandraAuthUserDao.queryByPhone(phone);
|
||||
public SchisandraAuthUser queryByCondition(SchisandraAuthUser schisandraAuthUser) {
|
||||
|
||||
LambdaQueryWrapper<SchisandraAuthUser> queryWrapper = Wrappers.<SchisandraAuthUser>lambdaQuery()
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getId()), SchisandraAuthUser::getId, schisandraAuthUser.getId())
|
||||
.eq(Objects.nonNull(schisandraAuthUser.getUuid()), SchisandraAuthUser::getUuid, schisandraAuthUser.getUuid())
|
||||
.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.getSex()), SchisandraAuthUser::getSex, schisandraAuthUser.getSex())
|
||||
.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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,242 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.schisandra.auth.infra.basic.dao.SchisandraAuthUserDao">
|
||||
<mapper namespace="com.schisandra.auth.infra.basic.mapper.SchisandraAuthUserDao">
|
||||
|
||||
<resultMap type="com.schisandra.auth.infra.basic.entity.SchisandraAuthUser" id="SchisandraAuthUserMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="email" column="email" jdbcType="VARCHAR"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="sex" column="sex" jdbcType="INTEGER"/>
|
||||
<result property="avatar" column="avatar" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="introduce" column="introduce" jdbcType="VARCHAR"/>
|
||||
<result property="extJson" column="ext_json" jdbcType="VARCHAR"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
|
||||
<resultMap id="BaseResultMap" type="com.schisandra.auth.infra.basic.entity.SchisandraAuthUser">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
|
||||
<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"/>
|
||||
<result column="password" jdbcType="VARCHAR" property="password"/>
|
||||
<result column="sex" jdbcType="TINYINT" property="sex"/>
|
||||
<result column="avatar" jdbcType="VARCHAR" property="avatar"/>
|
||||
<result column="status" jdbcType="TINYINT" property="status"/>
|
||||
<result column="introduce" jdbcType="VARCHAR" property="introduce"/>
|
||||
<result column="ext_json" jdbcType="VARCHAR" property="extJson"/>
|
||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
|
||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
|
||||
<result column="blog" jdbcType="VARCHAR" property="blog"/>
|
||||
<result column="location" jdbcType="VARCHAR" property="location"/>
|
||||
<result column="company" jdbcType="VARCHAR" property="company"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="SchisandraAuthUserMap">
|
||||
select id,user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted
|
||||
from schisandra_auth_user
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="SchisandraAuthUserMap">
|
||||
select
|
||||
id,user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted
|
||||
from schisandra_auth_user
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
and user_name = #{userName}
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
and nick_name = #{nickName}
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
and email = #{email}
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
and phone = #{phone}
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
and password = #{password}
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
and sex = #{sex}
|
||||
</if>
|
||||
<if test="avatar != null and avatar != ''">
|
||||
and avatar = #{avatar}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="introduce != null and introduce != ''">
|
||||
and introduce = #{introduce}
|
||||
</if>
|
||||
<if test="extJson != null and extJson != ''">
|
||||
and ext_json = #{extJson}
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
and created_by = #{createdBy}
|
||||
</if>
|
||||
<if test="createdTime != null">
|
||||
and created_time = #{createdTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="isDeleted != null">
|
||||
and is_deleted = #{isDeleted}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from schisandra_auth_user
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
and user_name = #{userName}
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
and nick_name = #{nickName}
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
and email = #{email}
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
and phone = #{phone}
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
and password = #{password}
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
and sex = #{sex}
|
||||
</if>
|
||||
<if test="avatar != null and avatar != ''">
|
||||
and avatar = #{avatar}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="introduce != null and introduce != ''">
|
||||
and introduce = #{introduce}
|
||||
</if>
|
||||
<if test="extJson != null and extJson != ''">
|
||||
and ext_json = #{extJson}
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
and created_by = #{createdBy}
|
||||
</if>
|
||||
<if test="createdTime != null">
|
||||
and created_time = #{createdTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="isDeleted != null">
|
||||
and is_deleted = #{isDeleted}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into schisandra_auth_user(user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted)
|
||||
values (#{userName},#{nickName},#{email},#{phone},#{password},#{sex},#{avatar},#{status},#{introduce},#{extJson},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into
|
||||
schisandra_auth_user(user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userName},#{entity.nickName},#{entity.email},#{entity.phone},#{entity.password},#{entity.sex},#{entity.avatar},#{entity.status},#{entity.introduce},#{entity.extJson},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into
|
||||
schisandra_auth_user(user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userName},#{entity.nickName},#{entity.email},#{entity.phone},#{entity.password},#{entity.sex},#{entity.avatar},#{entity.status},#{entity.introduce},#{entity.extJson},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
user_name = values(user_name)nick_name = values(nick_name)email = values(email)phone = values(phone)password =
|
||||
values(password)sex = values(sex)avatar = values(avatar)status = values(status)introduce =
|
||||
values(introduce)ext_json = values(ext_json)created_by = values(created_by)created_time =
|
||||
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
|
||||
values(is_deleted)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update schisandra_auth_user
|
||||
<set>
|
||||
<if test="userName != null and userName != ''">
|
||||
user_name = #{userName},
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
nick_name = #{nickName},
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
email = #{email},
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
password = #{password},
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
sex = #{sex},
|
||||
</if>
|
||||
<if test="avatar != null and avatar != ''">
|
||||
avatar = #{avatar},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="introduce != null and introduce != ''">
|
||||
introduce = #{introduce},
|
||||
</if>
|
||||
<if test="extJson != null and extJson != ''">
|
||||
ext_json = #{extJson},
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
created_by = #{createdBy},
|
||||
</if>
|
||||
<if test="createdTime != null">
|
||||
created_time = #{createdTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="isDeleted != null">
|
||||
is_deleted = #{isDeleted},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from schisandra_auth_user
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryByPhone" resultMap="SchisandraAuthUserMap">
|
||||
select id,user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted
|
||||
from schisandra_auth_user
|
||||
where phone = #{phone}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
@@ -0,0 +1,69 @@
|
||||
# auth模块映射关系 ${module} 占位符
|
||||
# 模板文件和生成类的映射关系 多个文件 数组形式配置
|
||||
mappers:
|
||||
-
|
||||
- fileId: 001
|
||||
template: genCode/template/DemoDTO.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-application/schisandra-cloud-storage-${module}-application-controller/src/main/java/com/schisandra/${module}/application/dto
|
||||
name: ${modelName}DTO
|
||||
ext: java
|
||||
- fileId: 002
|
||||
template: genCode/template/DemoController.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-application/schisandra-cloud-storage-${module}-application-controller/src/main/java/com/schisandra/${module}/application/controller
|
||||
name: ${modelName}Controller
|
||||
ext: java
|
||||
- fileId: 003
|
||||
template: genCode/template/DemoDTOConverter.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-application/schisandra-cloud-storage-${module}-application-controller/src/main/java/com/schisandra/${module}/application/convert
|
||||
name: ${modelName}DTOConverter
|
||||
ext: java
|
||||
- fileId: 004
|
||||
template: genCode/template/DemoBO.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-domain/src/main/java/com/schisandra/${module}/domain/entity
|
||||
name: ${modelName}BO
|
||||
ext: java
|
||||
- fileId: 005
|
||||
template: genCode/template/DemoDomainService.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-domain/src/main/java/com/schisandra/${module}/domain/service
|
||||
name: ${modelName}DomainService
|
||||
ext: java
|
||||
- fileId: 006
|
||||
template: genCode/template/DemoDomainServiceImpl.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-domain/src/main/java/com/schisandra/${module}/domain/service/impl
|
||||
name: ${modelName}DomainServiceImpl
|
||||
ext: java
|
||||
- fileId: 007
|
||||
template: genCode/template/DemoBOConverter.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-domain/src/main/java/com/schisandra/${module}/domain/convert
|
||||
name: ${modelName}BOConverter
|
||||
ext: java
|
||||
- fileId: 008
|
||||
template: genCode/template/DemoService.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-infra/src/main/java/com/schisandra/${module}/infra/basic/service
|
||||
name: ${modelName}Service
|
||||
ext: java
|
||||
- fileId: 009
|
||||
template: genCode/template/DemoTable.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-infra/src/main/java/com/schisandra/${module}/infra/basic/entity
|
||||
name: ${modelName}
|
||||
ext: java
|
||||
- fileId: 010
|
||||
template: genCode/template/DemoServiceImpl.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-infra/src/main/java/com/schisandra/${module}/infra/basic/service/impl
|
||||
name: ${modelName}ServiceImpl
|
||||
ext: java
|
||||
- fileId: 011
|
||||
template: genCode/template/DemoDao.java.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-infra/src/main/java/com/schisandra/${module}/infra/basic/mapper
|
||||
name: ${modelName}Dao
|
||||
ext: java
|
||||
- fileId: 012
|
||||
template: genCode/template/DemoXml.xml.vm
|
||||
filePath: /schisandra-cloud-storage-${module}/schisandra-cloud-storage-${module}-infra/src/main/resources/mapper
|
||||
name: ${modelName}Dao
|
||||
ext: xml
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -8,23 +8,23 @@
|
||||
# 数据库连接信息
|
||||
jdbc:
|
||||
dbName: schisandra-cloud-storage
|
||||
tableName: schisandra_oss_baidu
|
||||
tableName: schisandra_auth_user
|
||||
url: jdbc:mysql://1.95.0.111:3306/
|
||||
username: root
|
||||
password: LDQ20020618xxx
|
||||
driver: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 使用的模板与生成文件映射给关系
|
||||
mapperInfos: genCode/ossMapper.yml
|
||||
mapperInfos: genCode/authMapper.yml
|
||||
|
||||
# 全局参数
|
||||
params:
|
||||
# 作者
|
||||
author: landaiqing
|
||||
# 模块
|
||||
module: oss
|
||||
module: auth
|
||||
# controller 通用前缀
|
||||
api: /oss
|
||||
api: /auth
|
||||
# 生成对象是否移除前缀
|
||||
removePre: false
|
||||
# 使用内置函数赋值给变量 FunctionUtils 中替换
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package com.schisandra.oss.application.config;
|
||||
|
||||
import com.cxytiandi.encrypt.core.EncryptionConfig;
|
||||
import com.cxytiandi.encrypt.core.EncryptionFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @Classname EncryptFilterConfig
|
||||
* @BelongsProject: schisandra-cloud-storage
|
||||
* @BelongsPackage: com.schisandra.oss.application.config
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-05-22 21:46
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class EncryptFilterConfig {
|
||||
@Bean
|
||||
public FilterRegistrationBean<EncryptionFilter> filterRegistration() {
|
||||
EncryptionConfig config = new EncryptionConfig();
|
||||
config.setKey("d86d7bab3d6ac01ad9dc6a897652f2d2");//1.2版本及以下key 16位,1.2以上key 32位
|
||||
config.setRequestDecryptUriList(Collections.emptyList());
|
||||
config.setResponseCharset("UTF-8");
|
||||
config.setResponseEncryptUriList(Collections.singletonList("/oss/minio/getAllMinioInfo"));
|
||||
FilterRegistrationBean<EncryptionFilter> registration = new FilterRegistrationBean<EncryptionFilter>();
|
||||
registration.setFilter(new EncryptionFilter(config));
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setName("EncryptionFilter");
|
||||
registration.setOrder(1);
|
||||
return registration;
|
||||
}
|
||||
}
|
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* controller
|
||||
@@ -53,7 +54,7 @@ public class SchisandraOssMinioController {
|
||||
try {
|
||||
String key = redisUtil.buildKey(MINIO_OSS_CLIENT_CONFIG_KEY, userId);
|
||||
boolean exists = redisUtil.exist(key);
|
||||
if(exists){
|
||||
if (exists) {
|
||||
log.info("用户: " + userId + "-> minio 已经初始化!");
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class SchisandraOssMinioController {
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@RequestMapping("add")
|
||||
@PostMapping("add")
|
||||
public Result<Boolean> addMinioOss(@RequestBody SchisandraOssMinioDTO schisandraOssMinioDTO) {
|
||||
|
||||
try {
|
||||
@@ -89,7 +90,7 @@ public class SchisandraOssMinioController {
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("update")
|
||||
@PostMapping("update")
|
||||
public Result<Boolean> updateMinioOss(@RequestBody SchisandraOssMinioDTO schisandraOssMinioDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
@@ -108,7 +109,7 @@ public class SchisandraOssMinioController {
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("delete")
|
||||
@DeleteMapping("delete")
|
||||
public Result<Boolean> deleteMinioOss(@RequestBody SchisandraOssMinioDTO schisandraOssMinioDTO) {
|
||||
|
||||
try {
|
||||
@@ -126,14 +127,20 @@ public class SchisandraOssMinioController {
|
||||
}
|
||||
|
||||
@PostMapping("getBaseInfo")
|
||||
public Result getBaseInfo(@RequestParam String fileName,@RequestParam String userId) {
|
||||
public Result getBaseInfo(@RequestParam String fileName, @RequestParam String userId) {
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
if (bean == null){
|
||||
if (bean == null) {
|
||||
log.error("容器获取失败!");
|
||||
return null;
|
||||
}
|
||||
return Result.ok(bean.getBaseInfo(fileName));
|
||||
}
|
||||
@GetMapping("getAllMinioInfo")
|
||||
public Result<List<SchisandraOssMinioDTO>> getAllMinioInfo() {
|
||||
List<SchisandraOssMinioBO> allMinioInfo = schisandraOssMinioDomainService.getAllMinioInfo();
|
||||
List<SchisandraOssMinioDTO> schisandraOssMinioDTOS = SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTOList(allMinioInfo);
|
||||
return Result.ok(schisandraOssMinioDTOS);
|
||||
}
|
||||
|
||||
|
||||
private void parameterCheck(SchisandraOssMinioDTO schisandraOssMinioDTO) {
|
||||
|
@@ -1,13 +1,15 @@
|
||||
package com.schisandra.oss.application.convert;
|
||||
|
||||
|
||||
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* dto转换器
|
||||
* dto转换器
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-14 19:47:04
|
||||
@@ -20,4 +22,6 @@ public interface SchisandraOssMinioDTOConverter {
|
||||
SchisandraOssMinioBO convertDTOToBO(SchisandraOssMinioDTO schisandraOssMinioDTO);
|
||||
|
||||
SchisandraOssMinioDTO convertBOToDTO(SchisandraOssMinioBO schisandraOssMinioBO);
|
||||
|
||||
List<SchisandraOssMinioDTO> convertBOToDTOList(List<SchisandraOssMinioBO> schisandraOssMinioBOList);
|
||||
}
|
||||
|
@@ -125,5 +125,12 @@
|
||||
<version>3.14.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--加密工具-->
|
||||
<dependency>
|
||||
<groupId>com.cxytiandi</groupId>
|
||||
<artifactId>monkey-api-encrypt-core</artifactId>
|
||||
<version>1.2.2.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -5,6 +5,8 @@ package com.schisandra.oss.domain.convert;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* bo转换器
|
||||
*
|
||||
@@ -18,5 +20,6 @@ public interface SchisandraOssMinioBOConverter {
|
||||
|
||||
SchisandraOssMinio convertBOToEntity(SchisandraOssMinioBO schisandraOssMinioBO);
|
||||
SchisandraOssMinioBO convertEntityToBO(SchisandraOssMinio schisandraOssMinio);
|
||||
List<SchisandraOssMinioBO> convertEntityToBOList(List<SchisandraOssMinio> schisandraOssMinioList);
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.schisandra.oss.domain.service;
|
||||
|
||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,4 +29,6 @@ public interface SchisandraOssMinioDomainService {
|
||||
Boolean delete(SchisandraOssMinioBO schisandraOssMinioBO);
|
||||
|
||||
SchisandraOssMinioBO getMinioConfig(Long userId);
|
||||
|
||||
List<SchisandraOssMinioBO> getAllMinioInfo();
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 领域service实现了
|
||||
@@ -48,9 +49,16 @@ public class SchisandraOssMinioDomainServiceImpl implements SchisandraOssMinioDo
|
||||
|
||||
@Override
|
||||
public SchisandraOssMinioBO getMinioConfig(Long userId) {
|
||||
SchisandraOssMinio schisandraOssMinio= schisandraOssMinioService.getMinioConfig(userId);
|
||||
SchisandraOssMinio schisandraOssMinio = schisandraOssMinioService.getMinioConfig(userId);
|
||||
SchisandraOssMinioBO schisandraOssMinioBO = SchisandraOssMinioBOConverter.INSTANCE.convertEntityToBO(schisandraOssMinio);
|
||||
return schisandraOssMinioBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchisandraOssMinioBO> getAllMinioInfo() {
|
||||
List<SchisandraOssMinio> allMinioInfo = schisandraOssMinioService.getAllMinioInfo();
|
||||
List<SchisandraOssMinioBO> schisandraOssMinioBOS = SchisandraOssMinioBOConverter.INSTANCE.convertEntityToBOList(allMinioInfo);
|
||||
return schisandraOssMinioBOS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.schisandra.oss.infra.basic.service;
|
||||
|
||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssMinio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,4 +51,6 @@ public interface SchisandraOssMinioService {
|
||||
SchisandraOssMinio queryByCondition(SchisandraOssMinio schisandraOssMinio);
|
||||
|
||||
SchisandraOssMinio getMinioConfig(Long userId);
|
||||
|
||||
List<SchisandraOssMinio> getAllMinioInfo();
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import com.schisandra.oss.infra.basic.service.SchisandraOssMinioService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -123,4 +124,10 @@ public class SchisandraOssMinioServiceImpl implements SchisandraOssMinioService
|
||||
.eq("is_deleted", 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchisandraOssMinio> getAllMinioInfo() {
|
||||
return schisandraOssMinioDao.selectList(new QueryWrapper<SchisandraOssMinio>()
|
||||
.eq("is_deleted", 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user