Compare commits
3 Commits
0676cf3e27
...
b0533dc6c3
Author | SHA1 | Date |
---|---|---|
|
b0533dc6c3 | |
|
d1a7e3f82e | |
|
262b4e0125 |
|
@ -43,15 +43,15 @@ spring:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://101.37.69.204:8001/mental_health_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://39.101.193.239:3306/mental_health_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: Mz!@#123
|
password: Mz123456*
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: true
|
lazy: true
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://101.37.69.204:8001/mental_health_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://39.101.193.239:3306/mental_health_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
# oracle:
|
# oracle:
|
||||||
|
@ -92,13 +92,13 @@ spring:
|
||||||
spring.data:
|
spring.data:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: 39.101.193.239
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# 密码(如没有密码请注释掉)
|
# 密码(如没有密码请注释掉)
|
||||||
# password:
|
password: Mz123456*
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|
|
@ -46,7 +46,7 @@ spring:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
@ -54,7 +54,7 @@ spring:
|
||||||
lazy: true
|
lazy: true
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
# oracle:
|
# oracle:
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.dromara.common.core.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>TODO<p>
|
||||||
|
*
|
||||||
|
* @author cjw
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2024/4/8 15:42
|
||||||
|
*/
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class PasswordGenerator {
|
||||||
|
private static final String CHAR_SET = "0123456789";
|
||||||
|
private static final int DEFAULT_PASSWORD_LENGTH = 6;
|
||||||
|
|
||||||
|
public static String generatePassword(int length) {
|
||||||
|
if (length <= 0) {
|
||||||
|
throw new IllegalArgumentException("Password length must be greater than 0.");
|
||||||
|
}
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder password = new StringBuilder(length);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
int index = random.nextInt(CHAR_SET.length());
|
||||||
|
password.append(CHAR_SET.charAt(index));
|
||||||
|
}
|
||||||
|
return password.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generateDefaultPassword() {
|
||||||
|
return generatePassword(DEFAULT_PASSWORD_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,3 +31,4 @@ mybatis-plus:
|
||||||
insertStrategy: NOT_NULL
|
insertStrategy: NOT_NULL
|
||||||
updateStrategy: NOT_NULL
|
updateStrategy: NOT_NULL
|
||||||
whereStrategy: NOT_NULL
|
whereStrategy: NOT_NULL
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,13 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>5.1.2</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>rouyi-scale</artifactId>
|
<artifactId>rouyi-scale</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
package org.dromara.scale.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
|
||||||
import org.dromara.common.web.core.BaseController;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
|
||||||
import org.dromara.scale.domain.vo.SysScaleQuestionAnswerVo;
|
|
||||||
import org.dromara.scale.domain.bo.SysScaleQuestionAnswerBo;
|
|
||||||
import org.dromara.scale.service.ISysScaleQuestionAnswerService;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
@Validated
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/scale/SysScaleQuestionAnswer")
|
|
||||||
public class SysScaleQuestionAnswerController extends BaseController {
|
|
||||||
|
|
||||||
private final ISysScaleQuestionAnswerService sysScaleQuestionAnswerService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项列表
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo<SysScaleQuestionAnswerVo> list(SysScaleQuestionAnswerBo bo, PageQuery pageQuery) {
|
|
||||||
return sysScaleQuestionAnswerService.queryPageList(bo, pageQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出量问题选项列表
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:export")
|
|
||||||
@Log(title = "量问题选项", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(SysScaleQuestionAnswerBo bo, HttpServletResponse response) {
|
|
||||||
List<SysScaleQuestionAnswerVo> list = sysScaleQuestionAnswerService.queryList(bo);
|
|
||||||
ExcelUtil.exportExcel(list, "量问题选项", SysScaleQuestionAnswerVo.class, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取量问题选项详细信息
|
|
||||||
*
|
|
||||||
* @param questionId 主键
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:query")
|
|
||||||
@GetMapping("/{questionId}")
|
|
||||||
public R<SysScaleQuestionAnswerVo> getInfo(@NotNull(message = "主键不能为空")
|
|
||||||
@PathVariable Long questionId) {
|
|
||||||
return R.ok(sysScaleQuestionAnswerService.queryById(questionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增量问题选项
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:add")
|
|
||||||
@Log(title = "量问题选项", businessType = BusinessType.INSERT)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping()
|
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysScaleQuestionAnswerBo bo) {
|
|
||||||
return toAjax(sysScaleQuestionAnswerService.insertByBo(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改量问题选项
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:edit")
|
|
||||||
@Log(title = "量问题选项", businessType = BusinessType.UPDATE)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping()
|
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysScaleQuestionAnswerBo bo) {
|
|
||||||
return toAjax(sysScaleQuestionAnswerService.updateByBo(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除量问题选项
|
|
||||||
*
|
|
||||||
* @param questionIds 主键串
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("scale:SysScaleQuestionAnswer:remove")
|
|
||||||
@Log(title = "量问题选项", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{questionIds}")
|
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
||||||
@PathVariable Long[] questionIds) {
|
|
||||||
return toAjax(sysScaleQuestionAnswerService.deleteWithValidByIds(List.of(questionIds), true));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -48,7 +48,7 @@ public class WebController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询发布量表
|
* 查询量表答案选项
|
||||||
*/
|
*/
|
||||||
@GetMapping("/answer/{id}")
|
@GetMapping("/answer/{id}")
|
||||||
public R<List<QuestionAnswerVo>> queryAnswer(@NotNull(message = "主键不能为空")
|
public R<List<QuestionAnswerVo>> queryAnswer(@NotNull(message = "主键不能为空")
|
||||||
|
@ -63,7 +63,18 @@ public class WebController extends BaseController {
|
||||||
@Log(title = "量测记录", businessType = BusinessType.INSERT)
|
@Log(title = "量测记录", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/record")
|
@PostMapping("/record")
|
||||||
|
public R<Long> addRecord(@Validated(AddGroup.class) @RequestBody SysEvaluationRecordBo bo) {
|
||||||
|
return R.ok(evaluationRecordService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增记录答案选择
|
||||||
|
*/
|
||||||
|
@Log(title = "量测记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/record/answer")
|
||||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody SysEvaluationRecordBo bo) {
|
public R<Long> add(@Validated(AddGroup.class) @RequestBody SysEvaluationRecordBo bo) {
|
||||||
|
//todo
|
||||||
return R.ok(evaluationRecordService.insertByBo(bo));
|
return R.ok(evaluationRecordService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
package org.dromara.scale.domain;
|
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项对象 sys_scale_question_answer
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("sys_scale_question_answer")
|
|
||||||
public class SysScaleQuestionAnswer extends BaseEntity {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测评问题id
|
|
||||||
*/
|
|
||||||
@TableId(value = "question_id")
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属测评量表id
|
|
||||||
*/
|
|
||||||
private Long scaleId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题内容
|
|
||||||
*/
|
|
||||||
private String questionContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题序号
|
|
||||||
*/
|
|
||||||
private Long questionOrder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题A
|
|
||||||
*/
|
|
||||||
private String questionA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题B
|
|
||||||
*/
|
|
||||||
private String questionB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题C
|
|
||||||
*/
|
|
||||||
private String questionC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题D
|
|
||||||
*/
|
|
||||||
private String questionD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题E
|
|
||||||
*/
|
|
||||||
private String questionE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数A
|
|
||||||
*/
|
|
||||||
private Long scoreA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数B
|
|
||||||
*/
|
|
||||||
private Long scoreB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数C
|
|
||||||
*/
|
|
||||||
private Long scoreC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数D
|
|
||||||
*/
|
|
||||||
private Long scoreD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数E
|
|
||||||
*/
|
|
||||||
private Long scoreE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属因子维度
|
|
||||||
*/
|
|
||||||
private Long factorId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,114 +0,0 @@
|
||||||
package org.dromara.scale.domain.bo;
|
|
||||||
|
|
||||||
import org.dromara.scale.domain.SysScaleQuestionAnswer;
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项业务对象 sys_scale_question_answer
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@AutoMapper(target = SysScaleQuestionAnswer.class, reverseConvertGenerate = false)
|
|
||||||
public class SysScaleQuestionAnswerBo extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测评问题id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "测评问题id不能为空", groups = { EditGroup.class })
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属测评量表id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "所属测评量表id不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scaleId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题内容
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题内容不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题序号
|
|
||||||
*/
|
|
||||||
@NotNull(message = "问题序号不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long questionOrder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题A
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题A不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题B
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题B不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题C
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题C不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题D
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题D不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题E
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "问题E不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String questionE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数A
|
|
||||||
*/
|
|
||||||
@NotNull(message = "分数A不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scoreA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数B
|
|
||||||
*/
|
|
||||||
@NotNull(message = "分数B不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scoreB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数C
|
|
||||||
*/
|
|
||||||
@NotNull(message = "分数C不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scoreC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数D
|
|
||||||
*/
|
|
||||||
@NotNull(message = "分数D不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scoreD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数E
|
|
||||||
*/
|
|
||||||
@NotNull(message = "分数E不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long scoreE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属因子维度
|
|
||||||
*/
|
|
||||||
@NotNull(message = "所属因子维度不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Long factorId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,122 +0,0 @@
|
||||||
package org.dromara.scale.domain.vo;
|
|
||||||
|
|
||||||
import org.dromara.scale.domain.SysScaleQuestionAnswer;
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项视图对象 sys_scale_question_answer
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
@AutoMapper(target = SysScaleQuestionAnswer.class)
|
|
||||||
public class SysScaleQuestionAnswerVo implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测评问题id
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "测评问题id")
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属测评量表id
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "所属测评量表id")
|
|
||||||
private Long scaleId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题内容
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题内容")
|
|
||||||
private String questionContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题序号
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题序号")
|
|
||||||
private Long questionOrder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题A
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题A")
|
|
||||||
private String questionA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题B
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题B")
|
|
||||||
private String questionB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题C
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题C")
|
|
||||||
private String questionC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题D
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题D")
|
|
||||||
private String questionD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 问题E
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "问题E")
|
|
||||||
private String questionE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数A
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "分数A")
|
|
||||||
private Long scoreA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数B
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "分数B")
|
|
||||||
private Long scoreB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数C
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "分数C")
|
|
||||||
private Long scoreC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数D
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "分数D")
|
|
||||||
private Long scoreD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分数E
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "分数E")
|
|
||||||
private Long scoreE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属因子维度
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "所属因子维度")
|
|
||||||
private Long factorId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package org.dromara.scale.mapper;
|
|
||||||
|
|
||||||
import org.dromara.scale.domain.SysScaleQuestionAnswer;
|
|
||||||
import org.dromara.scale.domain.vo.SysScaleQuestionAnswerVo;
|
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项Mapper接口
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
public interface SysScaleQuestionAnswerMapper extends BaseMapperPlus<SysScaleQuestionAnswer, SysScaleQuestionAnswerVo> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package org.dromara.scale.service;
|
|
||||||
|
|
||||||
import org.dromara.scale.domain.SysScaleQuestionAnswer;
|
|
||||||
import org.dromara.scale.domain.vo.SysScaleQuestionAnswerVo;
|
|
||||||
import org.dromara.scale.domain.bo.SysScaleQuestionAnswerBo;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项Service接口
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
public interface ISysScaleQuestionAnswerService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项
|
|
||||||
*/
|
|
||||||
SysScaleQuestionAnswerVo queryById(Long questionId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysScaleQuestionAnswerVo> queryPageList(SysScaleQuestionAnswerBo bo, PageQuery pageQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项列表
|
|
||||||
*/
|
|
||||||
List<SysScaleQuestionAnswerVo> queryList(SysScaleQuestionAnswerBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增量问题选项
|
|
||||||
*/
|
|
||||||
Boolean insertByBo(SysScaleQuestionAnswerBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改量问题选项
|
|
||||||
*/
|
|
||||||
Boolean updateByBo(SysScaleQuestionAnswerBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验并批量删除量问题选项信息
|
|
||||||
*/
|
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
|
||||||
}
|
|
|
@ -1,122 +0,0 @@
|
||||||
package org.dromara.scale.service.impl;
|
|
||||||
|
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.dromara.scale.domain.bo.SysScaleQuestionAnswerBo;
|
|
||||||
import org.dromara.scale.domain.vo.SysScaleQuestionAnswerVo;
|
|
||||||
import org.dromara.scale.domain.SysScaleQuestionAnswer;
|
|
||||||
import org.dromara.scale.mapper.SysScaleQuestionAnswerMapper;
|
|
||||||
import org.dromara.scale.service.ISysScaleQuestionAnswerService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 量问题选项Service业务层处理
|
|
||||||
*
|
|
||||||
* @author jiangzhe
|
|
||||||
* @date 2024-03-29
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class SysScaleQuestionAnswerServiceImpl implements ISysScaleQuestionAnswerService {
|
|
||||||
|
|
||||||
private final SysScaleQuestionAnswerMapper baseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SysScaleQuestionAnswerVo queryById(Long questionId){
|
|
||||||
return baseMapper.selectVoById(questionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TableDataInfo<SysScaleQuestionAnswerVo> queryPageList(SysScaleQuestionAnswerBo bo, PageQuery pageQuery) {
|
|
||||||
LambdaQueryWrapper<SysScaleQuestionAnswer> lqw = buildQueryWrapper(bo);
|
|
||||||
Page<SysScaleQuestionAnswerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
||||||
return TableDataInfo.build(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询量问题选项列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<SysScaleQuestionAnswerVo> queryList(SysScaleQuestionAnswerBo bo) {
|
|
||||||
LambdaQueryWrapper<SysScaleQuestionAnswer> lqw = buildQueryWrapper(bo);
|
|
||||||
return baseMapper.selectVoList(lqw);
|
|
||||||
}
|
|
||||||
|
|
||||||
private LambdaQueryWrapper<SysScaleQuestionAnswer> buildQueryWrapper(SysScaleQuestionAnswerBo bo) {
|
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
LambdaQueryWrapper<SysScaleQuestionAnswer> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.eq(bo.getScaleId() != null, SysScaleQuestionAnswer::getScaleId, bo.getScaleId());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionContent()), SysScaleQuestionAnswer::getQuestionContent, bo.getQuestionContent());
|
|
||||||
lqw.eq(bo.getQuestionOrder() != null, SysScaleQuestionAnswer::getQuestionOrder, bo.getQuestionOrder());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionA()), SysScaleQuestionAnswer::getQuestionA, bo.getQuestionA());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionB()), SysScaleQuestionAnswer::getQuestionB, bo.getQuestionB());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionC()), SysScaleQuestionAnswer::getQuestionC, bo.getQuestionC());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionD()), SysScaleQuestionAnswer::getQuestionD, bo.getQuestionD());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionE()), SysScaleQuestionAnswer::getQuestionE, bo.getQuestionE());
|
|
||||||
lqw.eq(bo.getScoreA() != null, SysScaleQuestionAnswer::getScoreA, bo.getScoreA());
|
|
||||||
lqw.eq(bo.getScoreB() != null, SysScaleQuestionAnswer::getScoreB, bo.getScoreB());
|
|
||||||
lqw.eq(bo.getScoreC() != null, SysScaleQuestionAnswer::getScoreC, bo.getScoreC());
|
|
||||||
lqw.eq(bo.getScoreD() != null, SysScaleQuestionAnswer::getScoreD, bo.getScoreD());
|
|
||||||
lqw.eq(bo.getScoreE() != null, SysScaleQuestionAnswer::getScoreE, bo.getScoreE());
|
|
||||||
lqw.eq(bo.getFactorId() != null, SysScaleQuestionAnswer::getFactorId, bo.getFactorId());
|
|
||||||
return lqw;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增量问题选项
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean insertByBo(SysScaleQuestionAnswerBo bo) {
|
|
||||||
SysScaleQuestionAnswer add = MapstructUtils.convert(bo, SysScaleQuestionAnswer.class);
|
|
||||||
validEntityBeforeSave(add);
|
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
|
||||||
if (flag) {
|
|
||||||
bo.setQuestionId(add.getQuestionId());
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改量问题选项
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean updateByBo(SysScaleQuestionAnswerBo bo) {
|
|
||||||
SysScaleQuestionAnswer update = MapstructUtils.convert(bo, SysScaleQuestionAnswer.class);
|
|
||||||
validEntityBeforeSave(update);
|
|
||||||
return baseMapper.updateById(update) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存前的数据校验
|
|
||||||
*/
|
|
||||||
private void validEntityBeforeSave(SysScaleQuestionAnswer entity){
|
|
||||||
//TODO 做一些数据校验,如唯一约束
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除量问题选项
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
||||||
if(isValid){
|
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
|
||||||
}
|
|
||||||
return baseMapper.deleteBatchIds(ids) > 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?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="org.dromara.scale.mapper.SysScaleQuestionAnswerMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -281,4 +281,16 @@ public class SysUserController extends BaseController {
|
||||||
public R<List<SysUserVo>> listByDept(@PathVariable @NotNull Long deptId) {
|
public R<List<SysUserVo>> listByDept(@PathVariable @NotNull Long deptId) {
|
||||||
return R.ok(userService.selectUserListByDept(deptId));
|
return R.ok(userService.selectUserListByDept(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户列表
|
||||||
|
*/
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
|
@SaCheckPermission("system:user:export")
|
||||||
|
@GetMapping("/export/password")
|
||||||
|
public void exportPassword(@NotNull Long deptId, HttpServletResponse response) {
|
||||||
|
List<SysUserPassWordExportVo> listVo = userService.selectUserpassWordListByDept(deptId);
|
||||||
|
ExcelUtil.exportExcel(listVo, "用户密码", SysUserPassWordExportVo.class, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象导出VO
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysUserPassWordExportVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "分组名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户名称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户账号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "登录名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户密码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -85,6 +85,8 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||||
*/
|
*/
|
||||||
SysUserVo selectUserByEmail(String email);
|
SysUserVo selectUserByEmail(String email);
|
||||||
|
|
||||||
|
List<SysUserVo> selectUserListByDeptId(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -111,4 +113,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||||
})
|
})
|
||||||
int updateById(@Param(Constants.ENTITY) SysUser user);
|
int updateById(@Param(Constants.ENTITY) SysUser user);
|
||||||
|
|
||||||
|
|
||||||
|
int updatePasswordBatchById(List<SysUserVo> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.dromara.system.service;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserPassWordExportVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -209,4 +210,6 @@ public interface ISysUserService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysUserVo> selectUserListByDept(Long deptId);
|
List<SysUserVo> selectUserListByDept(Long deptId);
|
||||||
|
|
||||||
|
List<SysUserPassWordExportVo> selectUserpassWordListByDept(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.secure.BCrypt;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -16,6 +17,7 @@ import org.dromara.common.core.constant.UserConstants;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.service.UserService;
|
import org.dromara.common.core.service.UserService;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.PasswordGenerator;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
@ -29,6 +31,7 @@ import org.dromara.system.domain.SysUserRole;
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.domain.vo.SysPostVo;
|
import org.dromara.system.domain.vo.SysPostVo;
|
||||||
import org.dromara.system.domain.vo.SysRoleVo;
|
import org.dromara.system.domain.vo.SysRoleVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserPassWordExportVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.mapper.*;
|
import org.dromara.system.mapper.*;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
@ -36,6 +39,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -77,20 +81,20 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
Map<String, Object> params = user.getParams();
|
Map<String, Object> params = user.getParams();
|
||||||
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
||||||
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
||||||
.eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId())
|
.eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId())
|
||||||
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
||||||
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
|
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
|
||||||
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
"u.create_time", params.get("beginTime"), params.get("endTime"))
|
"u.create_time", params.get("beginTime"), params.get("endTime"))
|
||||||
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
||||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptId)
|
.select(SysDept::getDeptId)
|
||||||
.apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
.apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
||||||
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
ids.add(user.getDeptId());
|
ids.add(user.getDeptId());
|
||||||
w.in("u.dept_id", ids);
|
w.in("u.dept_id", ids);
|
||||||
}).orderByAsc("u.user_id");
|
}).orderByAsc("u.user_id");
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,11 +108,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
public TableDataInfo<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
public TableDataInfo<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
||||||
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
||||||
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
||||||
.eq(ObjectUtil.isNotNull(user.getRoleId()), "r.role_id", user.getRoleId())
|
.eq(ObjectUtil.isNotNull(user.getRoleId()), "r.role_id", user.getRoleId())
|
||||||
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
||||||
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
|
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
|
||||||
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
||||||
.orderByAsc("u.user_id");
|
.orderByAsc("u.user_id");
|
||||||
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), wrapper);
|
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), wrapper);
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
@ -124,11 +128,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
||||||
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
||||||
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
||||||
.and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id"))
|
.and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id"))
|
||||||
.notIn(CollUtil.isNotEmpty(userIds), "u.user_id", userIds)
|
.notIn(CollUtil.isNotEmpty(userIds), "u.user_id", userIds)
|
||||||
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
||||||
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
|
||||||
.orderByAsc("u.user_id");
|
.orderByAsc("u.user_id");
|
||||||
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), wrapper);
|
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), wrapper);
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
@ -205,8 +209,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUserNameUnique(SysUserBo user) {
|
public boolean checkUserNameUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getUserName, user.getUserName())
|
.eq(SysUser::getUserName, user.getUserName())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +222,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPhoneUnique(SysUserBo user) {
|
public boolean checkPhoneUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getPhonenumber, user.getPhonenumber())
|
.eq(SysUser::getPhonenumber, user.getPhonenumber())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,8 +235,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEmailUnique(SysUserBo user) {
|
public boolean checkEmailUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getEmail, user.getEmail())
|
.eq(SysUser::getEmail, user.getEmail())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,9 +349,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public int updateUserStatus(Long userId, String status) {
|
public int updateUserStatus(Long userId, String status) {
|
||||||
return baseMapper.update(null,
|
return baseMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getStatus, status)
|
.set(SysUser::getStatus, status)
|
||||||
.eq(SysUser::getUserId, userId));
|
.eq(SysUser::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,12 +363,12 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public int updateUserProfile(SysUserBo user) {
|
public int updateUserProfile(SysUserBo user) {
|
||||||
return baseMapper.update(null,
|
return baseMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
.set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
||||||
.set(SysUser::getPhonenumber, user.getPhonenumber())
|
.set(SysUser::getPhonenumber, user.getPhonenumber())
|
||||||
.set(SysUser::getEmail, user.getEmail())
|
.set(SysUser::getEmail, user.getEmail())
|
||||||
.set(SysUser::getSex, user.getSex())
|
.set(SysUser::getSex, user.getSex())
|
||||||
.eq(SysUser::getUserId, user.getUserId()));
|
.eq(SysUser::getUserId, user.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -377,9 +381,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public boolean updateUserAvatar(Long userId, Long avatar) {
|
public boolean updateUserAvatar(Long userId, Long avatar) {
|
||||||
return baseMapper.update(null,
|
return baseMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getAvatar, avatar)
|
.set(SysUser::getAvatar, avatar)
|
||||||
.eq(SysUser::getUserId, userId)) > 0;
|
.eq(SysUser::getUserId, userId)) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,9 +396,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public int resetUserPwd(Long userId, String password) {
|
public int resetUserPwd(Long userId, String password) {
|
||||||
return baseMapper.update(null,
|
return baseMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getPassword, password)
|
.set(SysUser::getPassword, password)
|
||||||
.eq(SysUser::getUserId, userId));
|
.eq(SysUser::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -533,7 +537,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
@Override
|
@Override
|
||||||
public String selectUserNameById(Long userId) {
|
public String selectUserNameById(Long userId) {
|
||||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
.select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,4 +548,19 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
.select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
.select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUserPassWordExportVo> selectUserpassWordListByDept(Long deptId) {
|
||||||
|
List<SysUserVo> sysUserVos = baseMapper.selectUserListByDeptId(deptId);
|
||||||
|
List<SysUserPassWordExportVo> exportList = new ArrayList<>();
|
||||||
|
for (SysUserVo sysUserVo : sysUserVos) {
|
||||||
|
String password = PasswordGenerator.generateDefaultPassword();
|
||||||
|
SysUserPassWordExportVo export = new SysUserPassWordExportVo(sysUserVo.getDept().getDeptName(),
|
||||||
|
sysUserVo.getNickName(), sysUserVo.getUserName(), password);
|
||||||
|
exportList.add(export);
|
||||||
|
sysUserVo.setPassword(BCrypt.hashpw(password));
|
||||||
|
}
|
||||||
|
baseMapper.updatePasswordBatchById(sysUserVos);
|
||||||
|
return exportList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,5 +123,16 @@
|
||||||
where u.del_flag = '0' and u.user_id = #{userId}
|
where u.del_flag = '0' and u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserListByDeptId" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.del_flag = '0' and u.dept_id = #{deptId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updatePasswordBatchById" parameterType="java.util.List">
|
||||||
|
<foreach collection="list" item="item" index="index" separator=";">
|
||||||
|
UPDATE sys_user
|
||||||
|
SET password = #{item.password}
|
||||||
|
WHERE user_id = #{item.userId}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue