将开源版本的修改打补丁应用到商业版
This commit is contained in:
@@ -6,6 +6,7 @@ rebel.xml
|
||||
## backend
|
||||
**/target
|
||||
**/logs
|
||||
**/yml
|
||||
|
||||
## front
|
||||
**/*.lock
|
||||
|
||||
@@ -85,6 +85,41 @@ Docker快速启动项目
|
||||
- [Docker启动微服务后台](https://help.jeecg.com/java/springcloud/docker.html)
|
||||
|
||||
|
||||
git提交规范
|
||||
-----------------------------------
|
||||
姓名-前端/后端/AI-日期-新增功能/bug修复-代码提交描述
|
||||
|
||||
- demo: yxk-前端-20260327-新增功能-上传文件功能
|
||||
|
||||
|
||||
git提交规范
|
||||
-----------------------------------
|
||||
姓名-前端/后端/AI-日期-新增功能/bug修复-代码提交描述
|
||||
|
||||
- demo: yxk-前端-20260327-新增功能-上传文件功能
|
||||
|
||||
|
||||
git提交规范
|
||||
-----------------------------------
|
||||
姓名-前端/后端/AI-日期-新增功能/bug修复-代码提交描述
|
||||
|
||||
- demo: yxk-前端-20260327-新增功能-上传文件功能
|
||||
|
||||
|
||||
git提交规范
|
||||
-----------------------------------
|
||||
姓名-前端/后端/AI-日期-新增功能/bug修复-代码提交描述
|
||||
|
||||
- demo: yxk-前端-20260327-新增功能-上传文件功能
|
||||
|
||||
|
||||
git提交规范
|
||||
-----------------------------------
|
||||
姓名-前端/后端/AI-日期-新增功能/bug修复-代码提交描述
|
||||
|
||||
- demo: yxk-前端-20260327-新增功能-上传文件功能
|
||||
|
||||
|
||||
技术文档
|
||||
-----------------------------------
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.jeecg.common.aspect;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.jeecg.common.aspect.annotation.CascadeDelete;
|
||||
import org.jeecg.common.aspect.annotation.SonTable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class CascadeDeleteAspect {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
/**
|
||||
* 环绕通知:通过 REQUIRED 传播属性确保事务一致性
|
||||
*/
|
||||
@Around("@annotation(cascadeDelete)")
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)//已完成测试,子表删除时抛出异常主表会一起回滚
|
||||
public Object doCascadeDelete(ProceedingJoinPoint joinPoint, CascadeDelete cascadeDelete) throws Throwable {
|
||||
// 1. 获取主表 ID (约定第一个参数)
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if (args == null || args.length == 0 || args[0] == null) {
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
String mainId = args[0].toString();
|
||||
|
||||
// 2. 执行子表逻辑删除
|
||||
// 因为标记了 @Transactional,这里的删除操作会自动进入事务
|
||||
for (SonTable son : cascadeDelete.sons()) {
|
||||
Object mapper = context.getBean(son.mapper());
|
||||
executeDelete(mapper, son.joinColumn(), mainId);
|
||||
log.info("级联删除子表 [{}] 成功", son.mapper().getSimpleName());
|
||||
}
|
||||
// 3. 执行主表删除逻辑
|
||||
if (true) {
|
||||
throw new RuntimeException("模拟子表删除异常,触发回滚!");
|
||||
}
|
||||
// 如果主表 Service 抛出异常,整个事务(含上面的子表删除)都会回滚
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助方法:解决 MyBatis-Plus 泛型注入问题
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> void executeDelete(Object mapper, String column, Object value) {
|
||||
if (mapper instanceof BaseMapper) {
|
||||
BaseMapper<T> baseMapper = (BaseMapper<T>) mapper;
|
||||
QueryWrapper<T> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(column, value);
|
||||
baseMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 使用方法如下
|
||||
//@Override
|
||||
//@Transactional(rollbackFor = Exception.class)
|
||||
//@CascadeDelete(sons = {
|
||||
// // 配置子表1:Mapper类 + 子表中关联主表的字段名
|
||||
// @SonTable(mapper = TestSonTableMapper.class, joinColumn = "main_table_id"),
|
||||
//})
|
||||
//public void delMain(String id) {
|
||||
// testMainTableMapper.deleteById(id);
|
||||
//}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.common.aspect.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target(ElementType.METHOD) // 作用在方法上
|
||||
@Retention(RetentionPolicy.RUNTIME) // 运行时可见
|
||||
@Documented
|
||||
public @interface CascadeDelete {
|
||||
// 子表配置数组,支持一个主表对应多个子表
|
||||
SonTable[] sons();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.common.aspect.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SonTable {
|
||||
// 子表 Mapper 的类对象
|
||||
Class<?> mapper();
|
||||
|
||||
// 子表中关联主表 ID 的字段名(数据库字段名,如 main_id)
|
||||
String joinColumn();
|
||||
}
|
||||
@@ -138,4 +138,13 @@ public class LoginUser {
|
||||
/**设备id uniapp推送用*/
|
||||
private String clientId;
|
||||
|
||||
|
||||
/**人员密级*/
|
||||
|
||||
private Integer userSecurityLevel;
|
||||
|
||||
/**
|
||||
* 人员密级
|
||||
*/
|
||||
private Integer isSpecial;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,13 @@ import org.jeecg.common.util.filter.SsrfFileTypeFilter;
|
||||
import org.jeecg.common.util.filter.StrAttackFilter;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* minio文件上传工具类
|
||||
@@ -221,4 +226,315 @@ public class MinioUtil {
|
||||
return minioUrl+bucketName+"/"+relativePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件加密上传
|
||||
*
|
||||
* @param file
|
||||
* @param bizPath
|
||||
* @return
|
||||
*/
|
||||
public static String encryptUpload(MultipartFile file, String bizPath) {
|
||||
return encryptUpload(file, bizPath, null);
|
||||
}
|
||||
/**
|
||||
* 加密上传文件(带年份,文件名)
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static String encryptUpload(File file, String bizPath, String customBucket, String year, String fileName) {
|
||||
String file_url = "";
|
||||
//update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
bizPath = StrAttackFilter.filter(bizPath);
|
||||
// fileName = StrAttackFilter.filter(fileName);
|
||||
//update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(customBucket)) {
|
||||
newBucket = customBucket;
|
||||
}
|
||||
try {
|
||||
initMinio(minioUrl, minioName, minioPass);
|
||||
// 检查存储桶是否已经存在
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
//FileTypeFilter.fileTypeFilter(file);
|
||||
//SecretKey key = AESUtil.getKeyFromString(AES_KEY);
|
||||
MultipartFile multipartFile = (MultipartFile) file;
|
||||
byte[] fileBytes = multipartFile.getBytes();
|
||||
fileBytes = SecureUtils.encrypt(fileBytes);
|
||||
InputStream stream = new ByteArrayInputStream(fileBytes);
|
||||
/*
|
||||
原公文系统的加密
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
InputStream stream = inputStreamEncrypt(inputStream);
|
||||
*/
|
||||
|
||||
|
||||
//update-end-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
//InputStream stream = file.getInputStream();
|
||||
// 获取文件名
|
||||
String orgName = fileName;
|
||||
if ("".equals(orgName)) {
|
||||
orgName = file.getName();
|
||||
}
|
||||
orgName = CommonUtils.getFileName(orgName);
|
||||
String objectName = bizPath + "/"
|
||||
+ (orgName.indexOf(".") == -1
|
||||
? orgName + "_" + System.currentTimeMillis()
|
||||
: orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."))
|
||||
);
|
||||
|
||||
// 使用putObject上传一个本地文件到存储桶中。
|
||||
if (objectName.startsWith("/")) {
|
||||
objectName = objectName.substring(1);
|
||||
}
|
||||
|
||||
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
|
||||
.bucket(newBucket)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream, stream.available(), -1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
file_url = "/" + objectName;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file_url;
|
||||
}
|
||||
/**
|
||||
* 加密上传文件(带年份)
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static String encryptUpload(File file, String bizPath, String customBucket, String year) {
|
||||
String file_url = "";
|
||||
//update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
bizPath = StrAttackFilter.filter(bizPath);
|
||||
//update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(customBucket)) {
|
||||
newBucket = customBucket;
|
||||
}
|
||||
try {
|
||||
initMinio(minioUrl, minioName, minioPass);
|
||||
// 检查存储桶是否已经存在
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
//FileTypeFilter.fileTypeFilter(file);
|
||||
//SecretKey key = AESUtil.getKeyFromString(AES_KEY);
|
||||
MultipartFile multipartFile = (MultipartFile) file;
|
||||
byte[] fileBytes = multipartFile.getBytes();
|
||||
fileBytes = SecureUtils.encrypt(fileBytes);
|
||||
InputStream stream = new ByteArrayInputStream(fileBytes);
|
||||
/*
|
||||
原公文系统的加密
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
InputStream stream = inputStreamEncrypt(inputStream);
|
||||
*/
|
||||
|
||||
//update-end-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
//InputStream stream = file.getInputStream();
|
||||
// 获取文件名
|
||||
String orgName = file.getName();
|
||||
if ("".equals(orgName)) {
|
||||
orgName = file.getName();
|
||||
}
|
||||
orgName = CommonUtils.getFileName(orgName);
|
||||
String objectName = bizPath + "/"
|
||||
+ (orgName.indexOf(".") == -1
|
||||
? orgName + "_" + System.currentTimeMillis()
|
||||
: orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."))
|
||||
);
|
||||
|
||||
// 使用putObject上传一个本地文件到存储桶中。
|
||||
if (objectName.startsWith("/")) {
|
||||
objectName = objectName.substring(1);
|
||||
}
|
||||
|
||||
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
|
||||
.bucket(newBucket)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream, stream.available(), -1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
file_url = "/" + objectName;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密上传文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static String encryptUpload(MultipartFile file, String bizPath, String customBucket) {
|
||||
String file_url = "";
|
||||
//update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
bizPath = StrAttackFilter.filter(bizPath);
|
||||
//update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(customBucket)) {
|
||||
newBucket = customBucket;
|
||||
}
|
||||
try {
|
||||
initMinio(minioUrl, minioName, minioPass);
|
||||
// 检查存储桶是否已经存在
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
SsrfFileTypeFilter.checkUploadFileType(file);
|
||||
//SecretKey key = AESUtil.getKeyFromString(AES_KEY);
|
||||
byte[] fileBytes = file.getBytes();
|
||||
fileBytes = SecureUtils.encrypt(fileBytes);
|
||||
InputStream stream = new ByteArrayInputStream(fileBytes);
|
||||
/*
|
||||
原公文系统的加密
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
InputStream stream = inputStreamEncrypt(inputStream);
|
||||
*/
|
||||
|
||||
//update-end-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
//InputStream stream = file.getInputStream();
|
||||
// 获取文件名
|
||||
String orgName = file.getOriginalFilename();
|
||||
if ("".equals(orgName)) {
|
||||
orgName = file.getName();
|
||||
}
|
||||
orgName = CommonUtils.getFileName(orgName);
|
||||
String objectName = bizPath + "/"
|
||||
+ (orgName.indexOf(".") == -1
|
||||
? orgName + "_" + System.currentTimeMillis()
|
||||
: orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."))
|
||||
);
|
||||
|
||||
// 使用putObject上传一个本地文件到存储桶中。
|
||||
if (objectName.startsWith("/")) {
|
||||
objectName = objectName.substring(1);
|
||||
}
|
||||
|
||||
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
|
||||
.bucket(newBucket)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream, stream.available(), -1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
file_url = objectName;
|
||||
// file_url = minioUrl + newBucket + "/" + objectName;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file_url;
|
||||
}
|
||||
|
||||
|
||||
// /*
|
||||
//获取文件元数据
|
||||
// */
|
||||
// public static String getLastModifiedTime(String objectName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
// initMinio(minioUrl, minioName, minioPass);
|
||||
// StatObjectResponse statObjectResponse = minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||
//
|
||||
// return String.valueOf(statObjectResponse.lastModified().toInstant().toEpochMilli()) ;
|
||||
//
|
||||
// }
|
||||
// /*
|
||||
// 判断文件是否存在
|
||||
// */
|
||||
// public static String checkFileExistence( String objectName) {
|
||||
// try {
|
||||
// initMinio(minioUrl, minioName, minioPass);
|
||||
//
|
||||
// // 使用 StatObject 来获取对象的元数据,判断文件是否存在
|
||||
// StatObjectResponse statObjectResponse = minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||
//
|
||||
// // 如果没有异常抛出,文件存在,返回 1
|
||||
// return minioUrl + bucketName + "/"+objectName;
|
||||
// } catch (MinioException e) {
|
||||
// // 如果文件不存在或发生错误,返回 0
|
||||
// return "0";
|
||||
// } catch (Exception e) {
|
||||
// // 捕获其他异常,返回 0
|
||||
// return "0";
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 上传并更新文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static String uploadUpdate(MultipartFile file, String objectName, String customBucket) {
|
||||
String file_url = "";
|
||||
//update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
// objectName = StrAttackFilter.filter(objectName);
|
||||
//update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(customBucket)) {
|
||||
newBucket = customBucket;
|
||||
}
|
||||
try {
|
||||
initMinio(minioUrl, minioName, minioPass);
|
||||
// 检查存储桶是否已经存在
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
SsrfFileTypeFilter.checkUploadFileType(file);
|
||||
//update-end-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
|
||||
// 以下为管理信息化系统加密
|
||||
byte[] fileBytes = file.getBytes();
|
||||
fileBytes = SecureUtils.encrypt(fileBytes);
|
||||
InputStream stream = new ByteArrayInputStream(fileBytes);
|
||||
|
||||
|
||||
// 使用putObject上传一个本地文件到存储桶中。
|
||||
if (objectName.startsWith("/")) {
|
||||
objectName = objectName.substring(1);
|
||||
}
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
|
||||
.bucket(newBucket)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream, stream.available(), -1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
file_url = objectName;
|
||||
// file_url = minioUrl + newBucket + "/" + objectName;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file_url;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
|
||||
/*
|
||||
* @ClassName SecureUtils
|
||||
* @Description 功能说明: 对称加密工具类 aes、des对对称加密 ras非对称加密
|
||||
* 此为凌安公司在管理信息化系统中使用的加解密
|
||||
* 注意:密钥不要修改
|
||||
*/
|
||||
public class SecureUtils {
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
private final static byte[] KEY = {-40, -1, 45, -41, -51, -34, -33, 56, -22, 88, -46, 113, 110, -61, -82, -84};
|
||||
|
||||
/**
|
||||
* 解密文件内容
|
||||
*
|
||||
* @param fileContent 已加密的文件内容byte数组
|
||||
* @return 解密的文件内容byte数组
|
||||
*/
|
||||
public static byte[] decrypt(byte[] fileContent) {
|
||||
if (fileContent == null) {
|
||||
throw new RuntimeException("需要解密的文件内容不能为空");
|
||||
}
|
||||
|
||||
return SecureUtil.aes(SecureUtils.KEY).decrypt(fileContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密文件内容
|
||||
*
|
||||
* @param fileContent 的文件内容byte数组
|
||||
* @return 解密的文件内容byte数组
|
||||
*/
|
||||
public static byte[] encrypt(byte[] fileContent) {
|
||||
if (fileContent == null) {
|
||||
throw new RuntimeException("需要加密的文件内容不能为空");
|
||||
}
|
||||
|
||||
return SecureUtil.aes(SecureUtils.KEY).encrypt(fileContent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.8.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-module-supervision</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.8.1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.demo.check.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.check.entity.DjCheck;
|
||||
import org.jeecg.modules.demo.check.service.IDjCheckService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: 党建检查台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="党建检查台账")
|
||||
@RestController
|
||||
@RequestMapping("/check/djCheck")
|
||||
@Slf4j
|
||||
public class DjCheckController extends JeecgController<DjCheck, IDjCheckService> {
|
||||
@Autowired
|
||||
private IDjCheckService djCheckService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param djCheck
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建检查台账-分页列表查询")
|
||||
@Operation(summary="党建检查台账-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DjCheck>> queryPageList(DjCheck djCheck,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<DjCheck> queryWrapper = QueryGenerator.initQueryWrapper(djCheck, req.getParameterMap());
|
||||
Page<DjCheck> page = new Page<DjCheck>(pageNo, pageSize);
|
||||
IPage<DjCheck> pageList = djCheckService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param djCheck
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建检查台账-添加")
|
||||
@Operation(summary="党建检查台账-添加")
|
||||
@RequiresPermissions("check:dj_check:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DjCheck djCheck) {
|
||||
djCheckService.save(djCheck);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param djCheck
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建检查台账-编辑")
|
||||
@Operation(summary="党建检查台账-编辑")
|
||||
@RequiresPermissions("check:dj_check:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DjCheck djCheck) {
|
||||
djCheckService.updateById(djCheck);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建检查台账-通过id删除")
|
||||
@Operation(summary="党建检查台账-通过id删除")
|
||||
@RequiresPermissions("check:dj_check:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
djCheckService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建检查台账-批量删除")
|
||||
@Operation(summary="党建检查台账-批量删除")
|
||||
@RequiresPermissions("check:dj_check:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.djCheckService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建检查台账-通过id查询")
|
||||
@Operation(summary="党建检查台账-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DjCheck> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DjCheck djCheck = djCheckService.getById(id);
|
||||
if(djCheck==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(djCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param djCheck
|
||||
*/
|
||||
@RequiresPermissions("check:dj_check:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DjCheck djCheck) {
|
||||
return super.exportXls(request, djCheck, DjCheck.class, "党建检查台账");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("check:dj_check:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DjCheck.class);
|
||||
}
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package org.jeecg.modules.demo.check.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 党建检查台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dj_check")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="党建检查台账")
|
||||
public class DjCheck implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**序号*/
|
||||
@Excel(name = "序号", width = 15)
|
||||
@Schema(description = "序号")
|
||||
private java.lang.Integer sortNo;
|
||||
/**一级指标*/
|
||||
@Excel(name = "一级指标", width = 15)
|
||||
@Schema(description = "一级指标")
|
||||
private java.lang.String primaryIndex;
|
||||
/**评价要点*/
|
||||
@Excel(name = "评价要点", width = 15)
|
||||
@Schema(description = "评价要点")
|
||||
private java.lang.String evalPoints;
|
||||
/**评价内容*/
|
||||
@Excel(name = "评价内容", width = 15)
|
||||
@Schema(description = "评价内容")
|
||||
private java.lang.String evalContent;
|
||||
/**问题表现*/
|
||||
@Excel(name = "问题表现", width = 15)
|
||||
@Schema(description = "问题表现")
|
||||
private java.lang.String problemManifestation;
|
||||
/**整改措施*/
|
||||
@Excel(name = "整改措施", width = 15)
|
||||
@Schema(description = "整改措施")
|
||||
private java.lang.String rectificationMeasures;
|
||||
/**完成时限*/
|
||||
@Excel(name = "完成时限", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时限")
|
||||
private java.util.Date completionDeadline;
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@Schema(description = "责任部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String responsibleDept;
|
||||
/**完成情况*/
|
||||
@Excel(name = "完成情况", width = 15)
|
||||
@Schema(description = "完成情况")
|
||||
private java.lang.String completionStatus;
|
||||
/**是否可发起(0不可发起,1可发起)*/
|
||||
@Excel(name = "是否可发起", width = 15)
|
||||
@Dict(dicCode = "is_launchable")
|
||||
private String isLaunchable;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.check.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.check.entity.DjCheck;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 党建检查台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DjCheckMapper extends BaseMapper<DjCheck> {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.demo.check.mapper.DjCheckMapper">
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.demo.check.service;
|
||||
|
||||
import org.jeecg.modules.demo.check.entity.DjCheck;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 党建检查台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDjCheckService extends IService<DjCheck> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.check.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.check.entity.DjCheck;
|
||||
import org.jeecg.modules.demo.check.mapper.DjCheckMapper;
|
||||
import org.jeecg.modules.demo.check.service.IDjCheckService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 党建检查台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjCheckServiceImpl extends ServiceImpl<DjCheckMapper, DjCheck> implements IDjCheckService {
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.demo.demoMetting.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.demoMetting.entity.DjDemoLifeMeeting;
|
||||
import org.jeecg.modules.demo.demoMetting.service.IDjDemoLifeMeetingService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: 所领导板子民主生活会问题台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="所领导板子民主生活会问题台账")
|
||||
@RestController
|
||||
@RequestMapping("/demoMetting/djDemoLifeMeeting")
|
||||
@Slf4j
|
||||
public class DjDemoLifeMeetingController extends JeecgController<DjDemoLifeMeeting, IDjDemoLifeMeetingService> {
|
||||
@Autowired
|
||||
private IDjDemoLifeMeetingService djDemoLifeMeetingService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param djDemoLifeMeeting
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "所领导板子民主生活会问题台账-分页列表查询")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DjDemoLifeMeeting>> queryPageList(DjDemoLifeMeeting djDemoLifeMeeting,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<DjDemoLifeMeeting> queryWrapper = QueryGenerator.initQueryWrapper(djDemoLifeMeeting, req.getParameterMap());
|
||||
Page<DjDemoLifeMeeting> page = new Page<DjDemoLifeMeeting>(pageNo, pageSize);
|
||||
IPage<DjDemoLifeMeeting> pageList = djDemoLifeMeetingService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param djDemoLifeMeeting
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "所领导板子民主生活会问题台账-添加")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-添加")
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DjDemoLifeMeeting djDemoLifeMeeting) {
|
||||
djDemoLifeMeetingService.save(djDemoLifeMeeting);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param djDemoLifeMeeting
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "所领导板子民主生活会问题台账-编辑")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-编辑")
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DjDemoLifeMeeting djDemoLifeMeeting) {
|
||||
djDemoLifeMeetingService.updateById(djDemoLifeMeeting);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "所领导板子民主生活会问题台账-通过id删除")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-通过id删除")
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
djDemoLifeMeetingService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "所领导板子民主生活会问题台账-批量删除")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-批量删除")
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.djDemoLifeMeetingService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "所领导板子民主生活会问题台账-通过id查询")
|
||||
@Operation(summary="所领导板子民主生活会问题台账-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DjDemoLifeMeeting> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DjDemoLifeMeeting djDemoLifeMeeting = djDemoLifeMeetingService.getById(id);
|
||||
if(djDemoLifeMeeting==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(djDemoLifeMeeting);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param djDemoLifeMeeting
|
||||
*/
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DjDemoLifeMeeting djDemoLifeMeeting) {
|
||||
return super.exportXls(request, djDemoLifeMeeting, DjDemoLifeMeeting.class, "所领导板子民主生活会问题台账");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("demoMetting:dj_demo_life_meeting:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DjDemoLifeMeeting.class);
|
||||
}
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package org.jeecg.modules.demo.demoMetting.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 所领导板子民主生活会问题台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dj_demo_life_meeting")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="所领导板子民主生活会问题台账")
|
||||
public class DjDemoLifeMeeting implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**序号*/
|
||||
@Excel(name = "序号", width = 15)
|
||||
@Schema(description = "序号")
|
||||
private java.lang.Integer sortNo;
|
||||
/**问题分类*/
|
||||
@Excel(name = "问题分类", width = 15)
|
||||
@Schema(description = "问题分类")
|
||||
private java.lang.Integer problemType;
|
||||
/**问题清单*/
|
||||
@Excel(name = "问题清单", width = 15)
|
||||
@Schema(description = "问题清单")
|
||||
private java.lang.String problemList;
|
||||
/**问题表现*/
|
||||
@Excel(name = "问题表现", width = 15)
|
||||
@Schema(description = "问题表现")
|
||||
private java.lang.String problemManifestation;
|
||||
/**责任领导*/
|
||||
@Excel(name = "责任领导", width = 15)
|
||||
@Schema(description = "责任领导")
|
||||
private java.lang.String responsibleLeader;
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@Schema(description = "责任部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String responsibleDept;
|
||||
/**整改措施*/
|
||||
@Excel(name = "整改措施", width = 15)
|
||||
@Schema(description = "整改措施")
|
||||
private java.lang.String rectificationMeasures;
|
||||
/**完成时限*/
|
||||
@Excel(name = "完成时限", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时限")
|
||||
private java.util.Date completionDeadline;
|
||||
/**完成时间*/
|
||||
@Excel(name = "完成时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时间")
|
||||
private java.util.Date completionDate;
|
||||
/**输出成果*/
|
||||
@Excel(name = "输出成果", width = 15)
|
||||
@Schema(description = "输出成果")
|
||||
private java.lang.String outputResults;
|
||||
/**完成情况*/
|
||||
@Excel(name = "完成情况", width = 15)
|
||||
@Schema(description = "完成情况")
|
||||
private java.lang.String completionStatus;
|
||||
/**是否可发起(0不可发起,1可发起)*/
|
||||
@Excel(name = "是否可发起", width = 15)
|
||||
@Dict(dicCode = "is_launchable")
|
||||
private String isLaunchable;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.demoMetting.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.demoMetting.entity.DjDemoLifeMeeting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 所领导板子民主生活会问题台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DjDemoLifeMeetingMapper extends BaseMapper<DjDemoLifeMeeting> {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.demo.demoMetting.mapper.DjDemoLifeMeetingMapper">
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.demo.demoMetting.service;
|
||||
|
||||
import org.jeecg.modules.demo.demoMetting.entity.DjDemoLifeMeeting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 所领导板子民主生活会问题台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDjDemoLifeMeetingService extends IService<DjDemoLifeMeeting> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.demoMetting.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.demoMetting.entity.DjDemoLifeMeeting;
|
||||
import org.jeecg.modules.demo.demoMetting.mapper.DjDemoLifeMeetingMapper;
|
||||
import org.jeecg.modules.demo.demoMetting.service.IDjDemoLifeMeetingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 所领导板子民主生活会问题台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjDemoLifeMeetingServiceImpl extends ServiceImpl<DjDemoLifeMeetingMapper, DjDemoLifeMeeting> implements IDjDemoLifeMeetingService {
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.demo.peopleService.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.peopleService.entity.DjPeopleService;
|
||||
import org.jeecg.modules.demo.peopleService.service.IDjPeopleServiceService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: 我为群众办实事台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="我为群众办实事台账")
|
||||
@RestController
|
||||
@RequestMapping("/peopleService/djPeopleService")
|
||||
@Slf4j
|
||||
public class DjPeopleServiceController extends JeecgController<DjPeopleService, IDjPeopleServiceService> {
|
||||
@Autowired
|
||||
private IDjPeopleServiceService djPeopleServiceService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param djPeopleService
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "我为群众办实事台账-分页列表查询")
|
||||
@Operation(summary="我为群众办实事台账-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DjPeopleService>> queryPageList(DjPeopleService djPeopleService,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<DjPeopleService> queryWrapper = QueryGenerator.initQueryWrapper(djPeopleService, req.getParameterMap());
|
||||
Page<DjPeopleService> page = new Page<DjPeopleService>(pageNo, pageSize);
|
||||
IPage<DjPeopleService> pageList = djPeopleServiceService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param djPeopleService
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我为群众办实事台账-添加")
|
||||
@Operation(summary="我为群众办实事台账-添加")
|
||||
@RequiresPermissions("peopleService:dj_people_service:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DjPeopleService djPeopleService) {
|
||||
djPeopleServiceService.save(djPeopleService);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param djPeopleService
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我为群众办实事台账-编辑")
|
||||
@Operation(summary="我为群众办实事台账-编辑")
|
||||
@RequiresPermissions("peopleService:dj_people_service:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DjPeopleService djPeopleService) {
|
||||
djPeopleServiceService.updateById(djPeopleService);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我为群众办实事台账-通过id删除")
|
||||
@Operation(summary="我为群众办实事台账-通过id删除")
|
||||
@RequiresPermissions("peopleService:dj_people_service:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
djPeopleServiceService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我为群众办实事台账-批量删除")
|
||||
@Operation(summary="我为群众办实事台账-批量删除")
|
||||
@RequiresPermissions("peopleService:dj_people_service:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.djPeopleServiceService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "我为群众办实事台账-通过id查询")
|
||||
@Operation(summary="我为群众办实事台账-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DjPeopleService> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DjPeopleService djPeopleService = djPeopleServiceService.getById(id);
|
||||
if(djPeopleService==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(djPeopleService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param djPeopleService
|
||||
*/
|
||||
@RequiresPermissions("peopleService:dj_people_service:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DjPeopleService djPeopleService) {
|
||||
return super.exportXls(request, djPeopleService, DjPeopleService.class, "我为群众办实事台账");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("peopleService:dj_people_service:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DjPeopleService.class);
|
||||
}
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package org.jeecg.modules.demo.peopleService.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 我为群众办实事台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dj_people_service")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="我为群众办实事台账")
|
||||
public class DjPeopleService implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**序号*/
|
||||
@Excel(name = "序号", width = 15)
|
||||
@Schema(description = "序号")
|
||||
private java.lang.Integer sortNo;
|
||||
/**问题分类*/
|
||||
@Excel(name = "问题分类", width = 15)
|
||||
@Schema(description = "问题分类")
|
||||
private java.lang.String problemType;
|
||||
/**具体措施*/
|
||||
@Excel(name = "具体措施", width = 15)
|
||||
@Schema(description = "具体措施")
|
||||
private java.lang.String specificMeasure;
|
||||
/**完成时限*/
|
||||
@Excel(name = "完成时限", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时限")
|
||||
private java.util.Date completionDeadline;
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@Schema(description = "责任部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String responsibleDept;
|
||||
/**完成情况*/
|
||||
@Excel(name = "完成情况", width = 15)
|
||||
@Schema(description = "完成情况")
|
||||
private java.lang.String completionStatus;
|
||||
/**是否可发起(0不可发起,1可发起)*/
|
||||
@Excel(name = "是否可发起", width = 15)
|
||||
@Dict(dicCode = "is_launchable")
|
||||
private String isLaunchable;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.peopleService.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.peopleService.entity.DjPeopleService;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 我为群众办实事台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DjPeopleServiceMapper extends BaseMapper<DjPeopleService> {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.demo.peopleService.mapper.DjPeopleServiceMapper">
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.demo.peopleService.service;
|
||||
|
||||
import org.jeecg.modules.demo.peopleService.entity.DjPeopleService;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 我为群众办实事台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDjPeopleServiceService extends IService<DjPeopleService> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.peopleService.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.peopleService.entity.DjPeopleService;
|
||||
import org.jeecg.modules.demo.peopleService.mapper.DjPeopleServiceMapper;
|
||||
import org.jeecg.modules.demo.peopleService.service.IDjPeopleServiceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 我为群众办实事台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjPeopleServiceServiceImpl extends ServiceImpl<DjPeopleServiceMapper, DjPeopleService> implements IDjPeopleServiceService {
|
||||
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
package org.jeecg.modules.demo.rectifylist.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.demo.rectifylist.entity.DjInspectionRectifyList;
|
||||
import org.jeecg.modules.demo.rectifylist.service.IDjInspectionRectifyListService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 党建巡视整改提升工作台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="党建巡视整改提升工作台账")
|
||||
@RestController
|
||||
@RequestMapping("/rectifylist/djInspectionRectifyList")
|
||||
@Slf4j
|
||||
public class DjInspectionRectifyListController extends JeecgController<DjInspectionRectifyList, IDjInspectionRectifyListService>{
|
||||
@Autowired
|
||||
private IDjInspectionRectifyListService djInspectionRectifyListService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param djInspectionRectifyList
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建巡视整改提升工作台账-分页列表查询")
|
||||
@Operation(summary="党建巡视整改提升工作台账-分页列表查询")
|
||||
@GetMapping(value = "/rootList")
|
||||
public Result<IPage<DjInspectionRectifyList>> queryPageList(DjInspectionRectifyList djInspectionRectifyList,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
String hasQuery = req.getParameter("hasQuery");
|
||||
if(hasQuery != null && "true".equals(hasQuery)){
|
||||
QueryWrapper<DjInspectionRectifyList> queryWrapper = QueryGenerator.initQueryWrapper(djInspectionRectifyList, req.getParameterMap());
|
||||
List<DjInspectionRectifyList> list = djInspectionRectifyListService.queryTreeListNoPage(queryWrapper);
|
||||
IPage<DjInspectionRectifyList> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}else{
|
||||
String parentId = djInspectionRectifyList.getPid();
|
||||
if (oConvertUtils.isEmpty(parentId)) {
|
||||
parentId = "0";
|
||||
}
|
||||
djInspectionRectifyList.setPid(null);
|
||||
QueryWrapper<DjInspectionRectifyList> queryWrapper = QueryGenerator.initQueryWrapper(djInspectionRectifyList, req.getParameterMap());
|
||||
// 使用 eq 防止模糊查询
|
||||
queryWrapper.eq("pid", parentId);
|
||||
Page<DjInspectionRectifyList> page = new Page<DjInspectionRectifyList>(pageNo, pageSize);
|
||||
IPage<DjInspectionRectifyList> pageList = djInspectionRectifyListService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载节点的子数据
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeChildren(@RequestParam(name = "pid") String pid) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = djInspectionRectifyListService.queryListByPid(pid);
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载一级节点/如果是同步 则所有数据
|
||||
*
|
||||
* @param async
|
||||
* @param pcode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = djInspectionRectifyListService.queryListByCode(pcode);
|
||||
if (!async) {
|
||||
loadAllChildren(ls);
|
||||
}
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】递归求子节点 同步加载用到
|
||||
*
|
||||
* @param ls
|
||||
*/
|
||||
private void loadAllChildren(List<SelectTreeModel> ls) {
|
||||
for (SelectTreeModel tsm : ls) {
|
||||
List<SelectTreeModel> temp = djInspectionRectifyListService.queryListByPid(tsm.getKey());
|
||||
if (temp != null && temp.size() > 0) {
|
||||
tsm.setChildren(temp);
|
||||
loadAllChildren(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子数据
|
||||
* @param djInspectionRectifyList
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建巡视整改提升工作台账-获取子数据")
|
||||
@Operation(summary="党建巡视整改提升工作台账-获取子数据")
|
||||
@GetMapping(value = "/childList")
|
||||
public Result<IPage<DjInspectionRectifyList>> queryPageList(DjInspectionRectifyList djInspectionRectifyList,HttpServletRequest req) {
|
||||
QueryWrapper<DjInspectionRectifyList> queryWrapper = QueryGenerator.initQueryWrapper(djInspectionRectifyList, req.getParameterMap());
|
||||
List<DjInspectionRectifyList> list = djInspectionRectifyListService.list(queryWrapper);
|
||||
IPage<DjInspectionRectifyList> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询子节点
|
||||
* @param parentIds 父ID(多个采用半角逗号分割)
|
||||
* @return 返回 IPage
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建巡视整改提升工作台账-批量获取子数据")
|
||||
@Operation(summary="党建巡视整改提升工作台账-批量获取子数据")
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<DjInspectionRectifyList> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("pid", parentIdList);
|
||||
List<DjInspectionRectifyList> list = djInspectionRectifyListService.list(queryWrapper);
|
||||
IPage<DjInspectionRectifyList> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param djInspectionRectifyList
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建巡视整改提升工作台账-添加")
|
||||
@Operation(summary="党建巡视整改提升工作台账-添加")
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DjInspectionRectifyList djInspectionRectifyList) {
|
||||
djInspectionRectifyListService.addDjInspectionRectifyList(djInspectionRectifyList);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param djInspectionRectifyList
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建巡视整改提升工作台账-编辑")
|
||||
@Operation(summary="党建巡视整改提升工作台账-编辑")
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DjInspectionRectifyList djInspectionRectifyList) {
|
||||
djInspectionRectifyListService.updateDjInspectionRectifyList(djInspectionRectifyList);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建巡视整改提升工作台账-通过id删除")
|
||||
@Operation(summary="党建巡视整改提升工作台账-通过id删除")
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
djInspectionRectifyListService.deleteDjInspectionRectifyList(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "党建巡视整改提升工作台账-批量删除")
|
||||
@Operation(summary="党建巡视整改提升工作台账-批量删除")
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.djInspectionRectifyListService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "党建巡视整改提升工作台账-通过id查询")
|
||||
@Operation(summary="党建巡视整改提升工作台账-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DjInspectionRectifyList> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DjInspectionRectifyList djInspectionRectifyList = djInspectionRectifyListService.getById(id);
|
||||
if(djInspectionRectifyList==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(djInspectionRectifyList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param djInspectionRectifyList
|
||||
*/
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DjInspectionRectifyList djInspectionRectifyList) {
|
||||
return super.exportXls(request, djInspectionRectifyList, DjInspectionRectifyList.class, "党建巡视整改提升工作台账");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("rectifylist:dj_inspection_rectify_list:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DjInspectionRectifyList.class);
|
||||
}
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package org.jeecg.modules.demo.rectifylist.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: 党建巡视整改提升工作台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dj_inspection_rectify_list")
|
||||
@Schema(description="党建巡视整改提升工作台账")
|
||||
public class DjInspectionRectifyList implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**父级节点*/
|
||||
@Excel(name = "父级节点", width = 15)
|
||||
@Schema(description = "父级节点")
|
||||
private java.lang.String pid;
|
||||
/**是否有子节点*/
|
||||
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@Schema(description = "是否有子节点")
|
||||
private java.lang.String hasChild;
|
||||
/**问题名称*/
|
||||
@Excel(name = "问题名称", width = 15)
|
||||
@Schema(description = "问题名称")
|
||||
private java.lang.String issueName;
|
||||
/**问题分类*/
|
||||
@Excel(name = "问题分类", width = 15)
|
||||
@Schema(description = "问题分类")
|
||||
private java.lang.Integer problemType;
|
||||
/**面上问题*/
|
||||
@Excel(name = "面上问题", width = 15)
|
||||
@Schema(description = "面上问题")
|
||||
private java.lang.String msIssue;
|
||||
/**具体问题*/
|
||||
@Excel(name = "具体问题", width = 15)
|
||||
@Schema(description = "具体问题")
|
||||
private java.lang.String specificIssue;
|
||||
/**整改措施*/
|
||||
@Excel(name = "整改措施", width = 15)
|
||||
@Schema(description = "整改措施")
|
||||
private java.lang.String rectificationMeasures;
|
||||
/**完成时限*/
|
||||
@Excel(name = "完成时限", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时限")
|
||||
private java.util.Date completionDeadline;
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@Schema(description = "责任部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String responsibleDept;
|
||||
/**分管所领导*/
|
||||
@Excel(name = "分管所领导", width = 15)
|
||||
@Schema(description = "分管所领导")
|
||||
private java.lang.String supervisingLeader;
|
||||
/**标志性成果*/
|
||||
@Excel(name = "标志性成果", width = 15)
|
||||
@Schema(description = "标志性成果")
|
||||
private java.lang.String landmarkAchievement;
|
||||
/**完成时间*/
|
||||
@Excel(name = "完成时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时间")
|
||||
private java.util.Date completionDate;
|
||||
/**监督意见*/
|
||||
@Excel(name = "监督意见", width = 15)
|
||||
@Schema(description = "监督意见")
|
||||
private java.lang.String supervisionOpinion;
|
||||
/**措施数量*/
|
||||
@Excel(name = "措施数量", width = 15)
|
||||
@Schema(description = "措施数量")
|
||||
private java.lang.Integer measureCount;
|
||||
/**是否可发起(0不可发起,1可发起)*/
|
||||
@Excel(name = "是否可发起", width = 15)
|
||||
@Dict(dicCode = "is_launchable")
|
||||
private String isLaunchable;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
// 该表单未设置逻辑删除功能,因为该表单为树形结构
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package org.jeecg.modules.demo.rectifylist.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.demo.rectifylist.entity.DjInspectionRectifyList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 党建巡视整改提升工作台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DjInspectionRectifyListMapper extends BaseMapper<DjInspectionRectifyList> {
|
||||
|
||||
/**
|
||||
* 编辑节点状态
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级ID查询树节点数据
|
||||
*
|
||||
* @param pid
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?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.jeecg.modules.demo.rectifylist.mapper.DjInspectionRectifyListMapper">
|
||||
|
||||
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
|
||||
update dj_inspection_rectify_list set has_child = #{status} where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 【vue3专用】 -->
|
||||
<select id="queryListByPid" parameterType="java.lang.Object" resultType="org.jeecg.common.system.vo.SelectTreeModel">
|
||||
select
|
||||
id as "key",
|
||||
issue_name as "title",
|
||||
(case when has_child = '1' then 0 else 1 end) as isLeaf,
|
||||
pid as parentId
|
||||
from dj_inspection_rectify_list
|
||||
where pid = #{pid}
|
||||
<if test="query != null">
|
||||
<foreach collection="query.entrySet()" item="value" index="key">
|
||||
and ${key} = #{value}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.demo.rectifylist.service;
|
||||
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.demo.rectifylist.entity.DjInspectionRectifyList;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 党建巡视整改提升工作台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDjInspectionRectifyListService extends IService<DjInspectionRectifyList> {
|
||||
|
||||
/**根节点父ID的值*/
|
||||
public static final String ROOT_PID_VALUE = "0";
|
||||
|
||||
/**树节点有子节点状态值*/
|
||||
public static final String HASCHILD = "1";
|
||||
|
||||
/**树节点无子节点状态值*/
|
||||
public static final String NOCHILD = "0";
|
||||
|
||||
/**
|
||||
* 新增节点
|
||||
*
|
||||
* @param djInspectionRectifyList
|
||||
*/
|
||||
void addDjInspectionRectifyList(DjInspectionRectifyList djInspectionRectifyList);
|
||||
|
||||
/**
|
||||
* 修改节点
|
||||
*
|
||||
* @param djInspectionRectifyList
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void updateDjInspectionRectifyList(DjInspectionRectifyList djInspectionRectifyList) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param id
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void deleteDjInspectionRectifyList(String id) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 查询所有数据,无分页
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @return List<DjInspectionRectifyList>
|
||||
*/
|
||||
List<DjInspectionRectifyList> queryTreeListNoPage(QueryWrapper<DjInspectionRectifyList> queryWrapper);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级编码加载分类字典的数据
|
||||
*
|
||||
* @param parentCode
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByCode(String parentCode);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据pid查询子节点集合
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(String pid);
|
||||
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
package org.jeecg.modules.demo.rectifylist.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.demo.rectifylist.entity.DjInspectionRectifyList;
|
||||
import org.jeecg.modules.demo.rectifylist.mapper.DjInspectionRectifyListMapper;
|
||||
import org.jeecg.modules.demo.rectifylist.service.IDjInspectionRectifyListService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 党建巡视整改提升工作台账
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjInspectionRectifyListServiceImpl extends ServiceImpl<DjInspectionRectifyListMapper, DjInspectionRectifyList> implements IDjInspectionRectifyListService {
|
||||
|
||||
@Override
|
||||
public void addDjInspectionRectifyList(DjInspectionRectifyList djInspectionRectifyList) {
|
||||
//新增时设置hasChild为0
|
||||
djInspectionRectifyList.setHasChild(IDjInspectionRectifyListService.NOCHILD);
|
||||
if(oConvertUtils.isEmpty(djInspectionRectifyList.getPid())){
|
||||
djInspectionRectifyList.setPid(IDjInspectionRectifyListService.ROOT_PID_VALUE);
|
||||
}else{
|
||||
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
|
||||
DjInspectionRectifyList parent = baseMapper.selectById(djInspectionRectifyList.getPid());
|
||||
if(parent!=null && !"1".equals(parent.getHasChild())){
|
||||
parent.setHasChild("1");
|
||||
baseMapper.updateById(parent);
|
||||
}
|
||||
}
|
||||
baseMapper.insert(djInspectionRectifyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDjInspectionRectifyList(DjInspectionRectifyList djInspectionRectifyList) {
|
||||
DjInspectionRectifyList entity = this.getById(djInspectionRectifyList.getId());
|
||||
if(entity==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
String old_pid = entity.getPid();
|
||||
String new_pid = djInspectionRectifyList.getPid();
|
||||
if(!old_pid.equals(new_pid)) {
|
||||
updateOldParentNode(old_pid);
|
||||
if(oConvertUtils.isEmpty(new_pid)){
|
||||
djInspectionRectifyList.setPid(IDjInspectionRectifyListService.ROOT_PID_VALUE);
|
||||
}
|
||||
if(!IDjInspectionRectifyListService.ROOT_PID_VALUE.equals(djInspectionRectifyList.getPid())) {
|
||||
baseMapper.updateTreeNodeStatus(djInspectionRectifyList.getPid(), IDjInspectionRectifyListService.HASCHILD);
|
||||
}
|
||||
}
|
||||
baseMapper.updateById(djInspectionRectifyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDjInspectionRectifyList(String id) throws JeecgBootException {
|
||||
//查询选中节点下所有子节点一并删除
|
||||
id = this.queryTreeChildIds(id);
|
||||
if(id.indexOf(",")>0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String[] idArr = id.split(",");
|
||||
for (String idVal : idArr) {
|
||||
if(idVal != null){
|
||||
DjInspectionRectifyList djInspectionRectifyList = this.getById(idVal);
|
||||
String pidVal = djInspectionRectifyList.getPid();
|
||||
//查询此节点上一级是否还有其他子节点
|
||||
List<DjInspectionRectifyList> dataList = baseMapper.selectList(new QueryWrapper<DjInspectionRectifyList>().eq("pid", pidVal).notIn("id",Arrays.asList(idArr)));
|
||||
boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(pidVal) && !sb.toString().contains(pidVal);
|
||||
if(flag){
|
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(pidVal).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
//批量删除节点
|
||||
baseMapper.deleteBatchIds(Arrays.asList(idArr));
|
||||
//修改已无子节点的标识
|
||||
String[] pidArr = sb.toString().split(",");
|
||||
for(String pid : pidArr){
|
||||
this.updateOldParentNode(pid);
|
||||
}
|
||||
}else{
|
||||
DjInspectionRectifyList djInspectionRectifyList = this.getById(id);
|
||||
if(djInspectionRectifyList==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
updateOldParentNode(djInspectionRectifyList.getPid());
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DjInspectionRectifyList> queryTreeListNoPage(QueryWrapper<DjInspectionRectifyList> queryWrapper) {
|
||||
List<DjInspectionRectifyList> dataList = baseMapper.selectList(queryWrapper);
|
||||
List<DjInspectionRectifyList> mapList = new ArrayList<>();
|
||||
for(DjInspectionRectifyList data : dataList){
|
||||
String pidVal = data.getPid();
|
||||
//递归查询子节点的根节点
|
||||
if(pidVal != null && !IDjInspectionRectifyListService.NOCHILD.equals(pidVal)){
|
||||
DjInspectionRectifyList rootVal = this.getTreeRoot(pidVal);
|
||||
if(rootVal != null && !mapList.contains(rootVal)){
|
||||
mapList.add(rootVal);
|
||||
}
|
||||
}else{
|
||||
if(!mapList.contains(data)){
|
||||
mapList.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByCode(String parentCode) {
|
||||
String pid = ROOT_PID_VALUE;
|
||||
if (oConvertUtils.isNotEmpty(parentCode)) {
|
||||
LambdaQueryWrapper<DjInspectionRectifyList> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DjInspectionRectifyList::getPid, parentCode);
|
||||
List<DjInspectionRectifyList> list = baseMapper.selectList(queryWrapper);
|
||||
if (list == null || list.size() == 0) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!");
|
||||
}
|
||||
pid = list.get(0).getId();
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByPid(String pid) {
|
||||
if (oConvertUtils.isEmpty(pid)) {
|
||||
pid = ROOT_PID_VALUE;
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值
|
||||
* @param pid
|
||||
*/
|
||||
private void updateOldParentNode(String pid) {
|
||||
if(!IDjInspectionRectifyListService.ROOT_PID_VALUE.equals(pid)) {
|
||||
Long count = baseMapper.selectCount(new QueryWrapper<DjInspectionRectifyList>().eq("pid", pid));
|
||||
if(count==null || count<=1) {
|
||||
baseMapper.updateTreeNodeStatus(pid, IDjInspectionRectifyListService.NOCHILD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询节点的根节点
|
||||
* @param pidVal
|
||||
* @return
|
||||
*/
|
||||
private DjInspectionRectifyList getTreeRoot(String pidVal){
|
||||
DjInspectionRectifyList data = baseMapper.selectById(pidVal);
|
||||
if(data != null && !IDjInspectionRectifyListService.ROOT_PID_VALUE.equals(data.getPid())){
|
||||
return this.getTreeRoot(data.getPid());
|
||||
}else{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询所有子节点id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreeChildIds(String ids) {
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String pidVal : idArr) {
|
||||
if(pidVal != null){
|
||||
if(!sb.toString().contains(pidVal)){
|
||||
if(sb.toString().length() > 0){
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(pidVal);
|
||||
this.getTreeChildIds(pidVal,sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有子节点
|
||||
* @param pidVal
|
||||
* @param sb
|
||||
* @return
|
||||
*/
|
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||
List<DjInspectionRectifyList> dataList = baseMapper.selectList(new QueryWrapper<DjInspectionRectifyList>().eq("pid", pidVal));
|
||||
if(dataList != null && dataList.size()>0){
|
||||
for(DjInspectionRectifyList tree : dataList) {
|
||||
if(!sb.toString().contains(tree.getId())){
|
||||
sb.append(",").append(tree.getId());
|
||||
}
|
||||
this.getTreeChildIds(tree.getId(),sb);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.demo.supervisiontest.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.supervisiontest.entity.SupervisionTest;
|
||||
import org.jeecg.modules.demo.supervisiontest.service.ISupervisionTestService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: supervision_test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="supervision_test")
|
||||
@RestController
|
||||
@RequestMapping("/supervisiontest/supervisionTest")
|
||||
@Slf4j
|
||||
public class SupervisionTestController extends JeecgController<SupervisionTest, ISupervisionTestService> {
|
||||
@Autowired
|
||||
private ISupervisionTestService supervisionTestService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param supervisionTest
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "supervision_test-分页列表查询")
|
||||
@Operation(summary="supervision_test-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SupervisionTest>> queryPageList(SupervisionTest supervisionTest,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<SupervisionTest> queryWrapper = QueryGenerator.initQueryWrapper(supervisionTest, req.getParameterMap());
|
||||
Page<SupervisionTest> page = new Page<SupervisionTest>(pageNo, pageSize);
|
||||
IPage<SupervisionTest> pageList = supervisionTestService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param supervisionTest
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "supervision_test-添加")
|
||||
@Operation(summary="supervision_test-添加")
|
||||
@RequiresPermissions("supervisiontest:supervision_test:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SupervisionTest supervisionTest) {
|
||||
supervisionTestService.save(supervisionTest);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param supervisionTest
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "supervision_test-编辑")
|
||||
@Operation(summary="supervision_test-编辑")
|
||||
@RequiresPermissions("supervisiontest:supervision_test:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SupervisionTest supervisionTest) {
|
||||
supervisionTestService.updateById(supervisionTest);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "supervision_test-通过id删除")
|
||||
@Operation(summary="supervision_test-通过id删除")
|
||||
@RequiresPermissions("supervisiontest:supervision_test:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
supervisionTestService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "supervision_test-批量删除")
|
||||
@Operation(summary="supervision_test-批量删除")
|
||||
@RequiresPermissions("supervisiontest:supervision_test:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.supervisionTestService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "supervision_test-通过id查询")
|
||||
@Operation(summary="supervision_test-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SupervisionTest> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SupervisionTest supervisionTest = supervisionTestService.getById(id);
|
||||
if(supervisionTest==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(supervisionTest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param supervisionTest
|
||||
*/
|
||||
@RequiresPermissions("supervisiontest:supervision_test:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SupervisionTest supervisionTest) {
|
||||
return super.exportXls(request, supervisionTest, SupervisionTest.class, "supervision_test");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("supervisiontest:supervision_test:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SupervisionTest.class);
|
||||
}
|
||||
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package org.jeecg.modules.demo.supervisiontest.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: supervision_test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("supervision_test")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="supervision_test")
|
||||
public class SupervisionTest implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**附件1*/
|
||||
@Excel(name = "附件1", width = 15)
|
||||
@Schema(description = "附件1")
|
||||
private java.lang.String fileurl1;
|
||||
/**附件2*/
|
||||
@Excel(name = "附件2", width = 15)
|
||||
@Schema(description = "附件2")
|
||||
private java.lang.String fileurl2;
|
||||
/**督办标题*/
|
||||
@Excel(name = "督办标题", width = 15)
|
||||
@Schema(description = "督办标题")
|
||||
private java.lang.String supervisionTitle;
|
||||
/**督办人*/
|
||||
@Excel(name = "督办人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||
@Schema(description = "督办人")
|
||||
private java.lang.String supervisionPerson;
|
||||
/**督办部门*/
|
||||
@Excel(name = "督办部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
|
||||
@Schema(description = "督办部门")
|
||||
private java.lang.String supervisionDepart;
|
||||
/**督办类型*/
|
||||
@Excel(name = "督办类型", width = 15)
|
||||
@Schema(description = "督办类型")
|
||||
private java.lang.String supervitionType;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
@TableLogic
|
||||
@Dict(dicCode = "del_flag")
|
||||
private String delFlag;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.supervisiontest.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.supervisiontest.entity.SupervisionTest;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: supervision_test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SupervisionTestMapper extends BaseMapper<SupervisionTest> {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.demo.supervisiontest.mapper.SupervisionTestMapper">
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.demo.supervisiontest.service;
|
||||
|
||||
import org.jeecg.modules.demo.supervisiontest.entity.SupervisionTest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: supervision_test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISupervisionTestService extends IService<SupervisionTest> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.supervisiontest.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.supervisiontest.entity.SupervisionTest;
|
||||
import org.jeecg.modules.demo.supervisiontest.mapper.SupervisionTestMapper;
|
||||
import org.jeecg.modules.demo.supervisiontest.service.ISupervisionTestService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: supervision_test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SupervisionTestServiceImpl extends ServiceImpl<SupervisionTestMapper, SupervisionTest> implements ISupervisionTestService {
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.demo.tzMetting.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.tzMetting.entity.DjMeetingRecord;
|
||||
import org.jeecg.modules.demo.tzMetting.service.IDjMeetingRecordService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: 统战座谈会意见台账及督办反馈
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="统战座谈会意见台账及督办反馈")
|
||||
@RestController
|
||||
@RequestMapping("/tzMetting/djMeetingRecord")
|
||||
@Slf4j
|
||||
public class DjMeetingRecordController extends JeecgController<DjMeetingRecord, IDjMeetingRecordService> {
|
||||
@Autowired
|
||||
private IDjMeetingRecordService djMeetingRecordService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param djMeetingRecord
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "统战座谈会意见台账及督办反馈-分页列表查询")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DjMeetingRecord>> queryPageList(DjMeetingRecord djMeetingRecord,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<DjMeetingRecord> queryWrapper = QueryGenerator.initQueryWrapper(djMeetingRecord, req.getParameterMap());
|
||||
Page<DjMeetingRecord> page = new Page<DjMeetingRecord>(pageNo, pageSize);
|
||||
IPage<DjMeetingRecord> pageList = djMeetingRecordService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param djMeetingRecord
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "统战座谈会意见台账及督办反馈-添加")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-添加")
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DjMeetingRecord djMeetingRecord) {
|
||||
djMeetingRecordService.save(djMeetingRecord);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param djMeetingRecord
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "统战座谈会意见台账及督办反馈-编辑")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-编辑")
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DjMeetingRecord djMeetingRecord) {
|
||||
djMeetingRecordService.updateById(djMeetingRecord);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "统战座谈会意见台账及督办反馈-通过id删除")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-通过id删除")
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
djMeetingRecordService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "统战座谈会意见台账及督办反馈-批量删除")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-批量删除")
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.djMeetingRecordService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "统战座谈会意见台账及督办反馈-通过id查询")
|
||||
@Operation(summary="统战座谈会意见台账及督办反馈-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DjMeetingRecord> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DjMeetingRecord djMeetingRecord = djMeetingRecordService.getById(id);
|
||||
if(djMeetingRecord==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(djMeetingRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param djMeetingRecord
|
||||
*/
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DjMeetingRecord djMeetingRecord) {
|
||||
return super.exportXls(request, djMeetingRecord, DjMeetingRecord.class, "统战座谈会意见台账及督办反馈");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("tzMetting:dj_meeting_record:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DjMeetingRecord.class);
|
||||
}
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package org.jeecg.modules.demo.tzMetting.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 统战座谈会意见台账及督办反馈
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dj_meeting_record")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="统战座谈会意见台账及督办反馈")
|
||||
public class DjMeetingRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**序号*/
|
||||
@Excel(name = "序号", width = 15)
|
||||
@Schema(description = "序号")
|
||||
private java.lang.Integer sortNo;
|
||||
/**问题分类*/
|
||||
@Excel(name = "问题分类", width = 15)
|
||||
@Schema(description = "问题分类")
|
||||
private java.lang.Integer problemType;
|
||||
/**具体措施*/
|
||||
@Excel(name = "具体措施", width = 15)
|
||||
@Schema(description = "具体措施")
|
||||
private java.lang.String specificMeasure;
|
||||
/**完成时限*/
|
||||
@Excel(name = "完成时限", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@Schema(description = "完成时限")
|
||||
private java.util.Date completionDeadline;
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@Schema(description = "责任部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private java.lang.String responsibleDept;
|
||||
/**完成情况*/
|
||||
@Excel(name = "完成情况", width = 15)
|
||||
@Schema(description = "完成情况")
|
||||
private java.lang.String completionStatus;
|
||||
/**是否可发起(0不可发起,1可发起)*/
|
||||
@Excel(name = "是否可发起", width = 15)
|
||||
@Dict(dicCode = "is_launchable")
|
||||
private String isLaunchable;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.tzMetting.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.tzMetting.entity.DjMeetingRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 统战座谈会意见台账及督办反馈
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DjMeetingRecordMapper extends BaseMapper<DjMeetingRecord> {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.demo.tzMetting.mapper.DjMeetingRecordMapper">
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.demo.tzMetting.service;
|
||||
|
||||
import org.jeecg.modules.demo.tzMetting.entity.DjMeetingRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 统战座谈会意见台账及督办反馈
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDjMeetingRecordService extends IService<DjMeetingRecord> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.tzMetting.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.tzMetting.entity.DjMeetingRecord;
|
||||
import org.jeecg.modules.demo.tzMetting.mapper.DjMeetingRecordMapper;
|
||||
import org.jeecg.modules.demo.tzMetting.service.IDjMeetingRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 统战座谈会意见台账及督办反馈
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjMeetingRecordServiceImpl extends ServiceImpl<DjMeetingRecordMapper, DjMeetingRecord> implements IDjMeetingRecordService {
|
||||
|
||||
}
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
package org.jeecg.modules.test.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.vo.TestMainTablePage;
|
||||
import org.jeecg.modules.test.service.ITestMainTableService;
|
||||
import org.jeecg.modules.test.service.ITestSonTableService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="test")
|
||||
@RestController
|
||||
@RequestMapping("/test/testMainTable")
|
||||
@Slf4j
|
||||
public class TestMainTableController {
|
||||
@Autowired
|
||||
private ITestMainTableService testMainTableService;
|
||||
@Autowired
|
||||
private ITestSonTableService testSonTableService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test-分页列表查询")
|
||||
@Operation(summary="test-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<TestMainTable>> queryPageList(TestMainTable testMainTable,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<TestMainTable> queryWrapper = QueryGenerator.initQueryWrapper(testMainTable, req.getParameterMap());
|
||||
Page<TestMainTable> page = new Page<TestMainTable>(pageNo, pageSize);
|
||||
IPage<TestMainTable> pageList = testMainTableService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param testMainTablePage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-添加")
|
||||
@Operation(summary="test-添加")
|
||||
@RequiresPermissions("test:test_main_table:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody TestMainTablePage testMainTablePage) {
|
||||
TestMainTable testMainTable = new TestMainTable();
|
||||
BeanUtils.copyProperties(testMainTablePage, testMainTable);
|
||||
testMainTableService.saveMain(testMainTable, testMainTablePage.getTestSonTableList());
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param testMainTablePage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-编辑")
|
||||
@Operation(summary="test-编辑")
|
||||
@RequiresPermissions("test:test_main_table:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody TestMainTablePage testMainTablePage) {
|
||||
TestMainTable testMainTable = new TestMainTable();
|
||||
BeanUtils.copyProperties(testMainTablePage, testMainTable);
|
||||
TestMainTable testMainTableEntity = testMainTableService.getById(testMainTable.getId());
|
||||
if(testMainTableEntity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
testMainTableService.updateMain(testMainTable, testMainTablePage.getTestSonTableList());
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-通过id删除")
|
||||
@Operation(summary="test-通过id删除")
|
||||
@RequiresPermissions("test:test_main_table:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
testMainTableService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-批量删除")
|
||||
@Operation(summary="test-批量删除")
|
||||
@RequiresPermissions("test:test_main_table:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.testMainTableService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test-通过id查询")
|
||||
@Operation(summary="test-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<TestMainTable> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
TestMainTable testMainTable = testMainTableService.getById(id);
|
||||
if(testMainTable==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(testMainTable);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test通过主表ID查询")
|
||||
@Operation(summary="test主表ID查询")
|
||||
@GetMapping(value = "/queryTestSonTableByMainId")
|
||||
public Result<List<TestSonTable>> queryTestSonTableListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<TestSonTable> testSonTableList = testSonTableService.selectByMainId(id);
|
||||
return Result.OK(testSonTableList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param testMainTable
|
||||
*/
|
||||
@RequiresPermissions("test:test_main_table:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, TestMainTable testMainTable) {
|
||||
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<TestMainTable> queryWrapper = QueryGenerator.initQueryWrapper(testMainTable, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//配置选中数据查询条件
|
||||
String selections = request.getParameter("selections");
|
||||
if(oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
queryWrapper.in("id",selectionList);
|
||||
}
|
||||
//Step.2 获取导出数据
|
||||
List<TestMainTable> testMainTableList = testMainTableService.list(queryWrapper);
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<TestMainTablePage> pageList = new ArrayList<TestMainTablePage>();
|
||||
for (TestMainTable main : testMainTableList) {
|
||||
TestMainTablePage vo = new TestMainTablePage();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
List<TestSonTable> testSonTableList = testSonTableService.selectByMainId(main.getId());
|
||||
vo.setTestSonTableList(testSonTableList);
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "test列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, TestMainTablePage.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("test数据", "导出人:"+sysUser.getRealname(), "test"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("test:test_main_table:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<TestMainTablePage> list = ExcelImportUtil.importExcel(file.getInputStream(), TestMainTablePage.class, params);
|
||||
for (TestMainTablePage page : list) {
|
||||
TestMainTable po = new TestMainTable();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
testMainTableService.saveMain(po, page.getTestSonTableList());
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package org.jeecg.modules.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description="test")
|
||||
@Data
|
||||
@TableName("test_main_table")
|
||||
public class TestMainTable implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**a字段*/
|
||||
@Excel(name = "a字段", width = 15)
|
||||
@Schema(description = "a字段")
|
||||
private String fieldA;
|
||||
/**b字段*/
|
||||
@Excel(name = "b字段", width = 15)
|
||||
@Schema(description = "b字段")
|
||||
private String fieldB;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.util.Date;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description="test")
|
||||
@Data
|
||||
@TableName("test_son_table")
|
||||
public class TestSonTable implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**字段c*/
|
||||
@Excel(name = "字段c", width = 15)
|
||||
@Schema(description = "字段c")
|
||||
private String fieldC;
|
||||
/**主表id*/
|
||||
@Schema(description = "主表id")
|
||||
private String mainTableId;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface TestMainTableMapper extends BaseMapper<TestMainTable> {
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package org.jeecg.modules.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface TestSonTableMapper extends BaseMapper<TestSonTable> {
|
||||
|
||||
/**
|
||||
* 通过主表id删除子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId);
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<TestSonTable>
|
||||
*/
|
||||
public List<TestSonTable> selectByMainId(@Param("mainId") String mainId);
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.test.mapper.TestMainTableMapper">
|
||||
|
||||
</mapper>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.test.mapper.TestSonTableMapper">
|
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM test_son_table
|
||||
WHERE
|
||||
main_table_id = #{mainId} </delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.test.entity.TestSonTable">
|
||||
SELECT *
|
||||
FROM test_son_table
|
||||
WHERE
|
||||
main_table_id = #{mainId} </select>
|
||||
</mapper>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package org.jeecg.modules.test.service;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITestMainTableService extends IService<TestMainTable> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param testSonTableList
|
||||
*/
|
||||
public void saveMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param testSonTableList
|
||||
*/
|
||||
public void updateMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.test.service;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITestSonTableService extends IService<TestSonTable> {
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<TestSonTable>
|
||||
*/
|
||||
public List<TestSonTable> selectByMainId(String mainId);
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package org.jeecg.modules.test.service.impl;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.CascadeDelete;
|
||||
import org.jeecg.common.aspect.annotation.SonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.mapper.TestSonTableMapper;
|
||||
import org.jeecg.modules.test.mapper.TestMainTableMapper;
|
||||
import org.jeecg.modules.test.service.ITestMainTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class TestMainTableServiceImpl extends ServiceImpl<TestMainTableMapper, TestMainTable> implements ITestMainTableService {
|
||||
|
||||
@Autowired
|
||||
private TestMainTableMapper testMainTableMapper;
|
||||
@Autowired
|
||||
private TestSonTableMapper testSonTableMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(TestMainTable testMainTable, List<TestSonTable> testSonTableList) {
|
||||
testMainTableMapper.insert(testMainTable);
|
||||
if(testSonTableList!=null && testSonTableList.size()>0) {
|
||||
for(TestSonTable entity:testSonTableList) {
|
||||
//外键设置
|
||||
entity.setMainTableId(testMainTable.getId());
|
||||
testSonTableMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList) {
|
||||
testMainTableMapper.updateById(testMainTable);
|
||||
|
||||
//1.先删除子表数据
|
||||
testSonTableMapper.deleteByMainId(testMainTable.getId());
|
||||
|
||||
//2.子表数据重新插入
|
||||
if(testSonTableList!=null && testSonTableList.size()>0) {
|
||||
for(TestSonTable entity:testSonTableList) {
|
||||
//外键设置
|
||||
entity.setMainTableId(testMainTable.getId());
|
||||
testSonTableMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CascadeDelete(sons = {
|
||||
// 配置子表1:Mapper类 + 子表中关联主表的字段名
|
||||
@SonTable(mapper = TestSonTableMapper.class, joinColumn = "main_table_id"),
|
||||
})
|
||||
public void delMain(String id) {
|
||||
testMainTableMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
testSonTableMapper.deleteByMainId(id.toString());
|
||||
testMainTableMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package org.jeecg.modules.test.service.impl;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.mapper.TestSonTableMapper;
|
||||
import org.jeecg.modules.test.service.ITestSonTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class TestSonTableServiceImpl extends ServiceImpl<TestSonTableMapper, TestSonTable> implements ITestSonTableService {
|
||||
|
||||
@Autowired
|
||||
private TestSonTableMapper testSonTableMapper;
|
||||
|
||||
@Override
|
||||
public List<TestSonTable> selectByMainId(String mainId) {
|
||||
return testSonTableMapper.selectByMainId(mainId);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package org.jeecg.modules.test.vo;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="test")
|
||||
public class TestMainTablePage {
|
||||
|
||||
/**主键*/
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**a字段*/
|
||||
@Excel(name = "a字段", width = 15)
|
||||
@Schema(description = "a字段")
|
||||
private String fieldA;
|
||||
/**b字段*/
|
||||
@Excel(name = "b字段", width = 15)
|
||||
@Schema(description = "b字段")
|
||||
private String fieldB;
|
||||
|
||||
@ExcelCollection(name="test")
|
||||
@Schema(description = "test")
|
||||
private List<TestSonTable> testSonTableList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
package org.jeecg.modules.test.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.vo.TestMainTablePage;
|
||||
import org.jeecg.modules.test.service.ITestMainTableService;
|
||||
import org.jeecg.modules.test.service.ITestSonTableService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="test")
|
||||
@RestController
|
||||
@RequestMapping("/test/testMainTable")
|
||||
@Slf4j
|
||||
public class TestMainTableController {
|
||||
@Autowired
|
||||
private ITestMainTableService testMainTableService;
|
||||
@Autowired
|
||||
private ITestSonTableService testSonTableService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test-分页列表查询")
|
||||
@Operation(summary="test-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<TestMainTable>> queryPageList(TestMainTable testMainTable,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<TestMainTable> queryWrapper = QueryGenerator.initQueryWrapper(testMainTable, req.getParameterMap());
|
||||
Page<TestMainTable> page = new Page<TestMainTable>(pageNo, pageSize);
|
||||
IPage<TestMainTable> pageList = testMainTableService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param testMainTablePage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-添加")
|
||||
@Operation(summary="test-添加")
|
||||
@RequiresPermissions("test:test_main_table:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody TestMainTablePage testMainTablePage) {
|
||||
TestMainTable testMainTable = new TestMainTable();
|
||||
BeanUtils.copyProperties(testMainTablePage, testMainTable);
|
||||
testMainTableService.saveMain(testMainTable, testMainTablePage.getTestSonTableList());
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param testMainTablePage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-编辑")
|
||||
@Operation(summary="test-编辑")
|
||||
@RequiresPermissions("test:test_main_table:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody TestMainTablePage testMainTablePage) {
|
||||
TestMainTable testMainTable = new TestMainTable();
|
||||
BeanUtils.copyProperties(testMainTablePage, testMainTable);
|
||||
TestMainTable testMainTableEntity = testMainTableService.getById(testMainTable.getId());
|
||||
if(testMainTableEntity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
testMainTableService.updateMain(testMainTable, testMainTablePage.getTestSonTableList());
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-通过id删除")
|
||||
@Operation(summary="test-通过id删除")
|
||||
@RequiresPermissions("test:test_main_table:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
testMainTableService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "test-批量删除")
|
||||
@Operation(summary="test-批量删除")
|
||||
@RequiresPermissions("test:test_main_table:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.testMainTableService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test-通过id查询")
|
||||
@Operation(summary="test-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<TestMainTable> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
TestMainTable testMainTable = testMainTableService.getById(id);
|
||||
if(testMainTable==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(testMainTable);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "test通过主表ID查询")
|
||||
@Operation(summary="test主表ID查询")
|
||||
@GetMapping(value = "/queryTestSonTableByMainId")
|
||||
public Result<List<TestSonTable>> queryTestSonTableListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<TestSonTable> testSonTableList = testSonTableService.selectByMainId(id);
|
||||
return Result.OK(testSonTableList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param testMainTable
|
||||
*/
|
||||
@RequiresPermissions("test:test_main_table:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, TestMainTable testMainTable) {
|
||||
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<TestMainTable> queryWrapper = QueryGenerator.initQueryWrapper(testMainTable, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//配置选中数据查询条件
|
||||
String selections = request.getParameter("selections");
|
||||
if(oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
queryWrapper.in("id",selectionList);
|
||||
}
|
||||
//Step.2 获取导出数据
|
||||
List<TestMainTable> testMainTableList = testMainTableService.list(queryWrapper);
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<TestMainTablePage> pageList = new ArrayList<TestMainTablePage>();
|
||||
for (TestMainTable main : testMainTableList) {
|
||||
TestMainTablePage vo = new TestMainTablePage();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
List<TestSonTable> testSonTableList = testSonTableService.selectByMainId(main.getId());
|
||||
vo.setTestSonTableList(testSonTableList);
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "test列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, TestMainTablePage.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("test数据", "导出人:"+sysUser.getRealname(), "test"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("test:test_main_table:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<TestMainTablePage> list = ExcelImportUtil.importExcel(file.getInputStream(), TestMainTablePage.class, params);
|
||||
for (TestMainTablePage page : list) {
|
||||
TestMainTable po = new TestMainTable();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
testMainTableService.saveMain(po, page.getTestSonTableList());
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.jeecg.modules.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description="test")
|
||||
@Data
|
||||
@TableName("test_main_table")
|
||||
public class TestMainTable implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**a字段*/
|
||||
@Excel(name = "a字段", width = 15)
|
||||
@Schema(description = "a字段")
|
||||
private java.lang.String fieldA;
|
||||
/**b字段*/
|
||||
@Excel(name = "b字段", width = 15)
|
||||
@Schema(description = "b字段")
|
||||
private java.lang.String fieldB;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.util.Date;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description="test")
|
||||
@Data
|
||||
@TableName("test_son_table")
|
||||
public class TestSonTable implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**字段c*/
|
||||
@Excel(name = "字段c", width = 15)
|
||||
@Schema(description = "字段c")
|
||||
private java.lang.String fieldC;
|
||||
/**主表id*/
|
||||
@Schema(description = "主表id")
|
||||
private java.lang.String mainTableId;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private int delFlag = 0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface TestMainTableMapper extends BaseMapper<TestMainTable> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.jeecg.modules.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface TestSonTableMapper extends BaseMapper<TestSonTable> {
|
||||
|
||||
/**
|
||||
* 通过主表id删除子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId);
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<TestSonTable>
|
||||
*/
|
||||
public List<TestSonTable> selectByMainId(@Param("mainId") String mainId);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.test.mapper.TestMainTableMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.test.mapper.TestSonTableMapper">
|
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM test_son_table
|
||||
WHERE
|
||||
main_table_id = #{mainId} </delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.test.entity.TestSonTable">
|
||||
SELECT *
|
||||
FROM test_son_table
|
||||
WHERE
|
||||
main_table_id = #{mainId} </select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.jeecg.modules.test.service;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITestMainTableService extends IService<TestMainTable> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param testSonTableList
|
||||
*/
|
||||
public void saveMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
* @param testMainTable
|
||||
* @param testSonTableList
|
||||
*/
|
||||
public void updateMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.test.service;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITestSonTableService extends IService<TestSonTable> {
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<TestSonTable>
|
||||
*/
|
||||
public List<TestSonTable> selectByMainId(String mainId);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.jeecg.modules.test.service.impl;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.CascadeDelete;
|
||||
import org.jeecg.common.aspect.annotation.SonTable;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.mapper.TestSonTableMapper;
|
||||
import org.jeecg.modules.test.mapper.TestMainTableMapper;
|
||||
import org.jeecg.modules.test.service.ITestMainTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class TestMainTableServiceImpl extends ServiceImpl<TestMainTableMapper, TestMainTable> implements ITestMainTableService {
|
||||
|
||||
@Autowired
|
||||
private TestMainTableMapper testMainTableMapper;
|
||||
@Autowired
|
||||
private TestSonTableMapper testSonTableMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(TestMainTable testMainTable, List<TestSonTable> testSonTableList) {
|
||||
testMainTableMapper.insert(testMainTable);
|
||||
if(testSonTableList!=null && testSonTableList.size()>0) {
|
||||
for(TestSonTable entity:testSonTableList) {
|
||||
//外键设置
|
||||
entity.setMainTableId(testMainTable.getId());
|
||||
testSonTableMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(TestMainTable testMainTable,List<TestSonTable> testSonTableList) {
|
||||
testMainTableMapper.updateById(testMainTable);
|
||||
|
||||
//1.先删除子表数据
|
||||
testSonTableMapper.deleteByMainId(testMainTable.getId());
|
||||
|
||||
//2.子表数据重新插入
|
||||
if(testSonTableList!=null && testSonTableList.size()>0) {
|
||||
for(TestSonTable entity:testSonTableList) {
|
||||
//外键设置
|
||||
entity.setMainTableId(testMainTable.getId());
|
||||
testSonTableMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CascadeDelete(sons = {
|
||||
// 配置子表1:Mapper类 + 子表中关联主表的字段名
|
||||
@SonTable(mapper = TestSonTableMapper.class, joinColumn = "main_table_id"),
|
||||
})
|
||||
public void delMain(String id) {
|
||||
testMainTableMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
testSonTableMapper.deleteByMainId(id.toString());
|
||||
testMainTableMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jeecg.modules.test.service.impl;
|
||||
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import org.jeecg.modules.test.mapper.TestSonTableMapper;
|
||||
import org.jeecg.modules.test.service.ITestSonTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class TestSonTableServiceImpl extends ServiceImpl<TestSonTableMapper, TestSonTable> implements ITestSonTableService {
|
||||
|
||||
@Autowired
|
||||
private TestSonTableMapper testSonTableMapper;
|
||||
|
||||
@Override
|
||||
public List<TestSonTable> selectByMainId(String mainId) {
|
||||
return testSonTableMapper.selectByMainId(mainId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.jeecg.modules.test.vo;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.test.entity.TestMainTable;
|
||||
import org.jeecg.modules.test.entity.TestSonTable;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: test
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="test")
|
||||
public class TestMainTablePage {
|
||||
|
||||
/**主键*/
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**a字段*/
|
||||
@Excel(name = "a字段", width = 15)
|
||||
@Schema(description = "a字段")
|
||||
private java.lang.String fieldA;
|
||||
/**b字段*/
|
||||
@Excel(name = "b字段", width = 15)
|
||||
@Schema(description = "b字段")
|
||||
private java.lang.String fieldB;
|
||||
|
||||
@ExcelCollection(name="test")
|
||||
@Schema(description = "test")
|
||||
private List<TestSonTable> testSonTableList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/test/testMainTable/list',
|
||||
save='/test/testMainTable/add',
|
||||
edit='/test/testMainTable/edit',
|
||||
deleteOne = '/test/testMainTable/delete',
|
||||
deleteBatch = '/test/testMainTable/deleteBatch',
|
||||
importExcel = '/test/testMainTable/importExcel',
|
||||
exportXls = '/test/testMainTable/exportXls',
|
||||
testSonTableList = '/test/testMainTable/queryTestSonTableByMainId',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 查询子表数据
|
||||
* @param params
|
||||
*/
|
||||
export const testSonTableList = Api.testSonTableList;
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: 'a字段',
|
||||
align:"center",
|
||||
dataIndex: 'fieldA'
|
||||
},
|
||||
{
|
||||
title: 'b字段',
|
||||
align:"center",
|
||||
dataIndex: 'fieldB'
|
||||
},
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: 'a字段',
|
||||
field: 'fieldA',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'b字段',
|
||||
field: 'fieldB',
|
||||
component: 'Input',
|
||||
},
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
];
|
||||
//子表单数据
|
||||
export const testSonTableFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '字段c',
|
||||
field: 'fieldC',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
];
|
||||
//子表表格配置
|
||||
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
fieldA: {title: 'a字段',order: 0,view: 'text', type: 'string',},
|
||||
fieldB: {title: 'b字段',order: 1,view: 'text', type: 'string',},
|
||||
//子表高级查询
|
||||
testSonTable: {
|
||||
title: 'test',
|
||||
view: 'table',
|
||||
fields: {
|
||||
fieldC: {title: '字段c',order: 0,view: 'text', type: 'string',},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[]{
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'test:test_main_table:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'test:test_main_table:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'test:test_main_table:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'test:test_main_table:deleteBatch'">批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<!-- 高级查询 -->
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<TestMainTableModal @register="registerModal" @success="handleSuccess"></TestMainTableModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="test-testMainTable" setup>
|
||||
import {ref, reactive, computed, unref} from 'vue';
|
||||
import {BasicTable, useTable, TableAction} from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage'
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import TestMainTableModal from './components/TestMainTableModal.vue'
|
||||
import {columns, searchFormSchema, superQuerySchema} from './TestMainTable.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './TestMainTable.api';
|
||||
import {downloadFile} from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: 'test',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:true,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
if (params && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (params[key]) {
|
||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name:"test",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({id: record.id}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: selectedRowKeys.value},handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'test:test_main_table:edit'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft'
|
||||
},
|
||||
auth: 'test:test_main_table:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicForm @register="registerForm" ref="formRef"/>
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
|
||||
<a-tab-pane tab="test" key="testSonTable" :forceRender="true">
|
||||
<TestSonTableForm ref="testSonTableForm" :disabled="formDisabled"></TestSonTableForm>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="handleSubmit" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import { computed, defineComponent, reactive, ref, unref } from 'vue';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods';
|
||||
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils';
|
||||
import TestSonTableForm from './TestSonTableForm.vue'
|
||||
import {getBpmFormSchema} from '../TestMainTable.data';
|
||||
import {saveOrUpdate,testSonTableList} from '../TestMainTable.api';
|
||||
|
||||
export default defineComponent({
|
||||
name: "TestMainTableForm",
|
||||
components:{
|
||||
BasicForm,
|
||||
TestSonTableForm,
|
||||
},
|
||||
props:{
|
||||
formData: propTypes.object.def({}),
|
||||
formBpm: propTypes.bool.def(true),
|
||||
},
|
||||
setup(props){
|
||||
const [registerForm, { setFieldsValue, setProps }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
|
||||
const formDisabled = computed(()=>{
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
const refKeys = ref(['testSonTable', ]);
|
||||
const activeKey = ref('testSonTable');
|
||||
const testSonTableForm = ref();
|
||||
const tableRefs = {};
|
||||
|
||||
const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys,validateSubForm);
|
||||
|
||||
function classifyIntoFormData(allValues) {
|
||||
let main = Object.assign({}, allValues.formValue)
|
||||
return {
|
||||
...main, // 展开
|
||||
testSonTableList: testSonTableForm.value.getFormData(),
|
||||
}
|
||||
}
|
||||
//校验所有一对一子表表单
|
||||
function validateSubForm(allValues){
|
||||
return new Promise((resolve, _reject)=>{
|
||||
Promise.all([
|
||||
testSonTableForm.value.validateForm(0),
|
||||
]).then(() => {
|
||||
resolve(allValues)
|
||||
}).catch(e => {
|
||||
if (e.error === VALIDATE_FAILED) {
|
||||
// 如果有未通过表单验证的子表,就自动跳转到它所在的tab
|
||||
activeKey.value = e.index == null ? unref(activeKey) : refKeys.value[e.index]
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//表单提交事件
|
||||
async function requestAddOrEdit(values) {
|
||||
await saveOrUpdate(values, true);
|
||||
}
|
||||
|
||||
const queryByIdUrl = '/test/testMainTable/queryById';
|
||||
async function initFormData(){
|
||||
let params = {id: props.formData.dataId};
|
||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
||||
//设置表单的值
|
||||
await setFieldsValue({...data});
|
||||
testSonTableForm.value.initFormData(testSonTableList, data.id);
|
||||
//默认是禁用
|
||||
await setProps({disabled: formDisabled.value})
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
||||
return {
|
||||
registerForm,
|
||||
formDisabled,
|
||||
formRef,
|
||||
handleSubmit,
|
||||
activeKey,
|
||||
handleChangeTabs,
|
||||
testSonTableForm,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" ref="formRef" name="TestMainTableForm"/>
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
|
||||
<a-tab-pane tab="test" key="testSonTable" :forceRender="true">
|
||||
<TestSonTableForm ref="testSonTableForm" :disabled="formDisabled"></TestSonTableForm>
|
||||
</a-tab-pane>
|
||||
|
||||
</a-tabs>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref,reactive} from 'vue';
|
||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import { JVxeTable } from '/@/components/jeecg/JVxeTable'
|
||||
import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
|
||||
import TestSonTableForm from './TestSonTableForm.vue'
|
||||
import {formSchema} from '../TestMainTable.data';
|
||||
import {saveOrUpdate,testSonTableList} from '../TestMainTable.api';
|
||||
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
const formDisabled = ref(false);
|
||||
const refKeys = ref(['testSonTable', ]);
|
||||
const activeKey = ref('testSonTable');
|
||||
const testSonTableForm = ref();
|
||||
const tableRefs = {};
|
||||
//表单配置
|
||||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await reset();
|
||||
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
formDisabled.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
testSonTableForm.value.initFormData(testSonTableList,data?.record?.id)
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
});
|
||||
//方法配置
|
||||
const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys,validateSubForm);
|
||||
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(formDisabled) ? '编辑' : '详情'));
|
||||
|
||||
async function reset(){
|
||||
await resetFields();
|
||||
activeKey.value = 'testSonTable';
|
||||
testSonTableForm.value.resetFields();
|
||||
}
|
||||
function classifyIntoFormData(allValues) {
|
||||
let main = Object.assign({}, allValues.formValue)
|
||||
return {
|
||||
...main, // 展开
|
||||
testSonTableList: testSonTableForm.value.getFormData(),
|
||||
}
|
||||
}
|
||||
//校验所有一对一子表表单
|
||||
function validateSubForm(allValues){
|
||||
return new Promise((resolve,reject)=>{
|
||||
Promise.all([
|
||||
testSonTableForm.value.validateForm(0),
|
||||
]).then(() => {
|
||||
resolve(allValues)
|
||||
}).catch(e => {
|
||||
if (e.error === VALIDATE_FAILED) {
|
||||
// 如果有未通过表单验证的子表,就自动跳转到它所在的tab
|
||||
activeKey.value = e.index == null ? unref(activeKey) : refKeys.value[e.index]
|
||||
if (e.errorFields) {
|
||||
const firstField = e.errorFields[0];
|
||||
if (firstField) {
|
||||
e.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
//表单提交事件
|
||||
async function requestAddOrEdit(values) {
|
||||
try {
|
||||
// 预处理日期数据
|
||||
changeDateValue(values);
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理日期值
|
||||
* @param formData 表单数据
|
||||
*/
|
||||
const changeDateValue = (formData) => {
|
||||
if (formData && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (formData[key]) {
|
||||
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<BasicForm @register="registerForm" name="TestSonTableForm" class="basic-modal-form"/>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {testSonTableFormSchema} from '../TestMainTable.data';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
|
||||
|
||||
export default defineComponent({
|
||||
name:"TestSonTableForm",
|
||||
components: {BasicForm},
|
||||
emits:['register'],
|
||||
props:{
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
setup(props,{emit}) {
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, getFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: testSonTableFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
/**
|
||||
*初始化加载数据
|
||||
*/
|
||||
function initFormData(url,id){
|
||||
if(id){
|
||||
defHttp.get({url,params:{id}},{isTransformResponse:false}).then(res=>{
|
||||
res.success && setFieldsValue({...res.result[0]});
|
||||
})
|
||||
}
|
||||
setProps({disabled: props.disabled})
|
||||
}
|
||||
/**
|
||||
*获取表单数据
|
||||
*/
|
||||
function getFormData(){
|
||||
let formData = getFieldsValue();
|
||||
Object.keys(formData).map(k=>{
|
||||
if(formData[k] instanceof Array){
|
||||
formData[k] = formData[k].join(',')
|
||||
}
|
||||
});
|
||||
return [formData];
|
||||
}
|
||||
/**
|
||||
*表单校验
|
||||
*/
|
||||
function validateForm(index){
|
||||
return new Promise((resolve, reject) => {
|
||||
// 验证子表表单
|
||||
validate().then(()=>{
|
||||
return resolve()
|
||||
}).catch(({ errorFields }) => {
|
||||
return reject({ error: VALIDATE_FAILED, index, errorFields: errorFields, scrollToField: scrollToField });
|
||||
});
|
||||
})
|
||||
}
|
||||
return {
|
||||
registerForm,
|
||||
resetFields,
|
||||
initFormData,
|
||||
getFormData,
|
||||
validateForm
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.basic-modal-form {
|
||||
overflow: auto;
|
||||
height: 340px;
|
||||
}
|
||||
</style>
|
||||
+18
@@ -1,5 +1,6 @@
|
||||
package org.jeecg.common.system.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.CommonAPI;
|
||||
import org.jeecg.common.api.dto.DataLogDTO;
|
||||
@@ -544,4 +545,21 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
*/
|
||||
boolean dictTableWhiteListCheckByDict(String tableOrDictCode, String... fields);
|
||||
|
||||
// 新增附件
|
||||
String addSysFileAttachment(JSONObject jsonObject);
|
||||
|
||||
//删除附件
|
||||
void deleteFileAttachment(String id);
|
||||
|
||||
String getFilePath(String id);
|
||||
|
||||
JSONArray getFileDetialById(String ids);
|
||||
|
||||
JSONArray getFileInfoByBussinessId(String bussinessId, String misFlag);
|
||||
|
||||
String getFilesPath(String ids);
|
||||
|
||||
Map<String, Object> queryFileMapById(String id);
|
||||
|
||||
String updateBusinessId(String businessId, List<String> deliverablesList);
|
||||
}
|
||||
|
||||
+507
@@ -0,0 +1,507 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.apiguardian.api.API;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文件上传下载更新接口
|
||||
* @Author: gelingjia
|
||||
* @Date:2025.9.22
|
||||
* @Version:V1.0
|
||||
*/
|
||||
@Tag(name = "文件上传下载更新接口")
|
||||
@RestController
|
||||
@RequestMapping("/sys/file")
|
||||
@Slf4j
|
||||
public class FileController {
|
||||
|
||||
|
||||
@Autowired
|
||||
public ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private BaseCommonService baseCommonService;
|
||||
@Value(value = "${jeecg.appName}")
|
||||
private String applicationName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 附件加密上传接口
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统自动日志:文件加密上传")
|
||||
@Operation(summary = "附件加密上传接口")
|
||||
@PostMapping(value = "/upload")
|
||||
public Result<Map<String,String>> upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
Result<Map<String,String>> result = new Result<>();
|
||||
|
||||
// 将请求转换为 MultipartHttpServletRequest
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
|
||||
//获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 获取前端传递来的密级
|
||||
String secLevel = multipartRequest.getParameter("secretLevel");
|
||||
if (secLevel == null || secLevel.equals("")) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("上传附件密级为空。无法上传");
|
||||
} else {
|
||||
// 获取用户密级,如果为空则提示用户先设置密级
|
||||
Integer userSecLevelObj = sysUser.getUserSecurityLevel();
|
||||
if (userSecLevelObj == null) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("当前用户未设置人员密级,请先在用户管理中设置人员密级后再上传文件!(密级说明:1-非密,2-内部,3-秘密,4-机密)");
|
||||
return result;
|
||||
}
|
||||
int userSecLevel = userSecLevelObj.intValue();
|
||||
int fileSecLevel = Integer.parseInt(secLevel);
|
||||
if (userSecLevel <= fileSecLevel) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("上传文件密级不能高于人员密级!");
|
||||
} else {
|
||||
String savePath = "";
|
||||
String bizPath = request.getParameter("biz");
|
||||
String secretLevelText =securityLevel(secLevel);
|
||||
//设置上传文档的存储路径
|
||||
if (StringUtils.isEmpty(bizPath)) {
|
||||
Date now = new Date();
|
||||
|
||||
bizPath = "/"+secretLevelText + "/"+ DateUtil.year(now) + "/"+ (DateUtil.month(now) + 1) + "/"+ DateUtil.dayOfMonth(now);
|
||||
}
|
||||
else{
|
||||
if (oConvertUtils.isNotEmpty(bizPath) && (bizPath.contains("../") || bizPath.contains("..\\"))) {
|
||||
throw new JeecgBootException("上传目录bizPath,格式非法!");
|
||||
}
|
||||
bizPath = "/"+secretLevelText + "/"+ bizPath;
|
||||
}
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
savePath = MinioUtil.encryptUpload(file, bizPath);//yxk-加密上传的地方在这里
|
||||
long size = file.getSize();
|
||||
String fileNameInDB = this.getFileNameinDB(secLevel, file);
|
||||
JSONObject fileJsonObject = new JSONObject();
|
||||
fileJsonObject.put("fileName", fileNameInDB);
|
||||
fileJsonObject.put("filePath", savePath);
|
||||
fileJsonObject.put("size", Integer.parseInt(String.valueOf(size)));
|
||||
fileJsonObject.put("secretText", secretLevelText);
|
||||
fileJsonObject.put("secretLevel", secLevel);
|
||||
fileJsonObject.put("fileUploadType",applicationName);
|
||||
fileJsonObject.put("uploadTime",new Date());
|
||||
fileJsonObject.put("uploaderWorkNo", request.getParameter("workNo"));
|
||||
fileJsonObject.put("uploader",request.getParameter("username"));
|
||||
fileJsonObject.put("uploadPercent",request.getParameter("uploadPercent"));
|
||||
fileJsonObject.put("uploadRes",request.getParameter("uploadRes"));
|
||||
fileJsonObject.put("uploadStatus",request.getParameter("uploadStatus"));
|
||||
fileJsonObject.put("isUploaded",request.getParameter("isUploaded"));
|
||||
// 添加 business_id 支持(可选参数,用于关联业务表单)
|
||||
String businessId = request.getParameter("business_id");
|
||||
if (oConvertUtils.isNotEmpty(businessId)) {
|
||||
fileJsonObject.put("businessId", businessId);
|
||||
}
|
||||
if(fileNameInDB.lastIndexOf(".")>-1){
|
||||
fileJsonObject.put("fileSuffix",fileNameInDB.substring(fileNameInDB.lastIndexOf(".")));
|
||||
}
|
||||
String fileId = sysBaseAPI.addSysFileAttachment(fileJsonObject);
|
||||
if (oConvertUtils.isNotEmpty(savePath)) {
|
||||
HashMap<String, String> res = new HashMap<String,String>();
|
||||
res.put("savePath",savePath);
|
||||
res.put("fileId",fileId);
|
||||
res.put("fileUploadType",applicationName);
|
||||
result.setResult(res);
|
||||
result.setMessage(savePath);
|
||||
result.setSuccess(true);
|
||||
baseCommonService.addLog("附件加密上传:" + savePath, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2);
|
||||
} else {
|
||||
result.setMessage("上传失败!");
|
||||
result.setSuccess(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("当前用户失效,上传失败。请重新登录");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@AutoLog(value = "系统自动日志:文件删除")
|
||||
@Operation(summary = "文件删除接口")
|
||||
@GetMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam String id){
|
||||
sysBaseAPI.deleteFileAttachment(id);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件解密下载接口
|
||||
* 下载文件
|
||||
*
|
||||
* @param fileUrl
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统自动日志:文件解密下载")
|
||||
@Operation(summary = "附件下载接口")
|
||||
|
||||
@GetMapping(value = "/download")
|
||||
public void download(@RequestParam String fileUrl, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
boolean flag = TokenUtils.verifyToken(request, sysBaseAPI, redisUtil);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (flag) {
|
||||
if (sysUser != null) {
|
||||
String bucketName = MinioUtil.getBucketName();
|
||||
String objectName = fileUrl;
|
||||
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
||||
InputStream inputStream = MinioUtil.getMinioFile(bucketName, objectName);
|
||||
//文件流解密
|
||||
byte[] fileBytes = IOUtils.toByteArray(inputStream);
|
||||
byte[] decryptedBytes = SecureUtils.decrypt(fileBytes);
|
||||
|
||||
//response.setContentType("application/force-download");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=\"" + fileName + "\"");
|
||||
//IOUtils.copy(inputStream,response.getOutputStream());
|
||||
baseCommonService.addLog("文件解密下载:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2);
|
||||
response.getOutputStream().write(decryptedBytes);
|
||||
response.flushBuffer();
|
||||
|
||||
|
||||
} else {
|
||||
//"当前用户失效,下载失败。请重新登录
|
||||
baseCommonService.addLog("当前用户失效,下载失败。无法查看文件:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2, sysUser);
|
||||
throw new UnauthorizedException("当前用户失效,下载失败。请重新登录");
|
||||
}
|
||||
} else {
|
||||
//"token 校验是被
|
||||
baseCommonService.addLog("token 校验失败。无法查看文件:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2, sysUser);
|
||||
throw new UnauthorizedException("token 校验失败");
|
||||
}
|
||||
}
|
||||
|
||||
// @Operation(summary = "文件预览临时方案")
|
||||
// @GetMapping(value = "/view")
|
||||
// public Result<String> downloadForView(@RequestParam String fileUrl, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// String bucketName = MinioUtil.getBucketName();
|
||||
// String minioUrl = MinioUtil.getMinioUrl();
|
||||
// String objectName = fileUrl;
|
||||
// if(!objectName.startsWith("/")){
|
||||
// objectName = "/" + objectName;
|
||||
// }
|
||||
// int dotIndex = objectName.lastIndexOf(".");
|
||||
// String extension = (dotIndex == -1) ? "" : objectName.substring(dotIndex);
|
||||
// String nameWithoutExtension = (dotIndex == -1) ? objectName : objectName.substring(0, dotIndex);
|
||||
// String time = MinioUtil.getLastModifiedTime(objectName);
|
||||
// String newFileName = "/temp" + nameWithoutExtension + time + extension;
|
||||
// String checkFileExistence = MinioUtil.checkFileExistence(newFileName);
|
||||
// log.info("查询缓存路径:" + checkFileExistence);
|
||||
// if ("0".equals(checkFileExistence)) {
|
||||
// InputStream inputStream = MinioUtil.getMinioFile(bucketName, objectName);
|
||||
// //文件流解密
|
||||
// byte[] fileBytes = IOUtils.toByteArray(inputStream);
|
||||
// byte[] decryptedBytes = SecureUtils.decrypt(fileBytes);
|
||||
// InputStream inputStream2 = new ByteArrayInputStream(decryptedBytes);
|
||||
// String resPath = MinioUtil.upload(inputStream2, newFileName);
|
||||
// if(!resPath.startsWith("/")){
|
||||
// minioUrl = "/" + minioUrl;
|
||||
// }
|
||||
// resPath=minioUrl + bucketName + resPath;
|
||||
// log.info("得到新缓存路径:" + resPath);
|
||||
// return Result.OK(resPath);
|
||||
// } else {
|
||||
// log.info("返回已有缓存路径:" + checkFileExistence);
|
||||
// return Result.OK(checkFileExistence);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 通过附件id查询附件路径
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Operation(summary = "通过附件id查询附件路径")
|
||||
@GetMapping(value = "/getFilePathById")
|
||||
public Result<?> getFileById(@RequestParam(name = "id") String id, HttpServletRequest request, HttpServletResponse response) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
String filePath = this.sysBaseAPI.getFilePath(id);
|
||||
result.setResult(filePath);
|
||||
} catch (Exception e) {
|
||||
return result.error500("系统错误!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过附件ids查询多个附件路径
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Operation(summary = "通过附件ids查询多个附件路径")
|
||||
@GetMapping(value = "/getFilePathByIds")
|
||||
public Result<?> getFileByIds(@RequestParam(name = "ids") String ids, HttpServletRequest request, HttpServletResponse response) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
String filePath = this.sysBaseAPI.getFilesPath(ids);
|
||||
result.setResult(filePath);
|
||||
} catch (Exception e) {
|
||||
return result.error500("系统错误!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过附件id获取附件信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
@Operation(summary = "通过附件id获取附件信息")
|
||||
@RequestMapping(value = "/file/getFileDetailById", method = RequestMethod.GET)
|
||||
public Result<Map<String,Object>> getFileDetailById(@RequestParam(required = true) String id, HttpServletRequest request, HttpServletResponse response) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
Map<String,Object> res = this.sysBaseAPI.queryFileMapById(id);
|
||||
result.setResult(res);
|
||||
} catch (Exception e) {
|
||||
return result.error500("系统错误!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过附件ids获取(多)附件信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
@Operation(summary = "通过附件ids获取(多)附件信息")
|
||||
@RequestMapping(value = "/file/getFileDetailByIds", method = RequestMethod.GET)
|
||||
public Result<JSONArray> getFileDetailByIds(@RequestParam(required = true) String ids, HttpServletRequest request, HttpServletResponse response) {
|
||||
String[] idArray = ids.split(",");
|
||||
if (idArray.length == 0) {
|
||||
return Result.OK();
|
||||
}
|
||||
JSONArray jsonArray = this.sysBaseAPI.getFileDetialById(ids);
|
||||
return Result.OK(jsonArray);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 公文系统文件下载接口
|
||||
* 下载文件
|
||||
* 请求地址:http://localhost:8080/officialdoc/file/{http://192.168.137.200:9000/official-doc/项目策划-质量保证大纲(生产部门使用)_1722237648135.pdf}
|
||||
*
|
||||
* @param fileUrl
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "系统自动日志:在线编辑解密下载文件")
|
||||
// @Operation(summary = "在线编辑解密下载文件")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "fileUrl", value = "fileUrl", required = false, dataType = "string", paramType = "body")
|
||||
// })
|
||||
// @GetMapping(value = "/downloadOnlineEdit")
|
||||
// public void downloadOnlineEdit(@RequestParam(required = true) String fileUrl, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// boolean flag = TokenUtils.verifyToken(request, sysBaseAPI, redisUtil);
|
||||
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// if (flag) {
|
||||
// if (sysUser != null) {
|
||||
//
|
||||
// String bucketName = MinioUtil.getBucketName();
|
||||
// String objectName = fileUrl;
|
||||
// String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
||||
// InputStream inputStream = MinioUtil.getMinioFile(bucketName, objectName);
|
||||
// response.reset();
|
||||
// response.setContentType("application/force-download");
|
||||
// response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName));
|
||||
// ServletOutputStream outputStream = response.getOutputStream();
|
||||
// byte[] fileBytes = IOUtils.toByteArray(inputStream);
|
||||
// byte[] decryptedBytes = SecureUtils.decrypt(fileBytes);
|
||||
// outputStream.write(decryptedBytes);
|
||||
// baseCommonService.addLog("文件在线编辑解密下载:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2);
|
||||
// inputStream.close();
|
||||
//
|
||||
//
|
||||
//
|
||||
// } else {
|
||||
// //"当前用户失效,下载失败。请重新登录
|
||||
// baseCommonService.addLog("当前用户失效,下载失败。无法查看文件:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2, "失败");
|
||||
// throw new UnauthorizedException("当前用户失效,下载失败。请重新登录");
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// //"token 校验是被
|
||||
// baseCommonService.addLog("token 校验失败。无法查看文件:" + fileUrl, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2, "失败");
|
||||
// throw new UnauthorizedException("token 校验失败");
|
||||
// }
|
||||
// }
|
||||
|
||||
@AutoLog(value = "系统自动日志:更新文件")
|
||||
@Operation(summary = "更新文件")
|
||||
@PostMapping(value = "/upload/update")
|
||||
public Result<?> uploadUpdate(@RequestParam(required = true) String fileUrl, HttpServletRequest request, HttpServletResponse response) {
|
||||
Result<?> result = new Result<>();
|
||||
String savePath = "";
|
||||
fileUrl = URLDecoder.decode(fileUrl);
|
||||
log.info("更新路径:" + fileUrl);
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
savePath = MinioUtil.uploadUpdate(file, fileUrl, null);
|
||||
|
||||
if (oConvertUtils.isNotEmpty(savePath)) {
|
||||
result.setMessage(savePath);
|
||||
baseCommonService.addLog("更新保存文件:" + savePath, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2);
|
||||
result.setSuccess(true);
|
||||
} else {
|
||||
result.setMessage("上传失败!");
|
||||
baseCommonService.addLog("上传失败:", CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_2);
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新文件信息
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新文件信息")
|
||||
@Operation(summary = "更新文件信息")
|
||||
@GetMapping(value = "/updateFilesInfo")
|
||||
public Result<String> updateFilesInfo(HttpServletRequest request, HttpServletResponse response) {
|
||||
Result<?> result = new Result<>();
|
||||
String bussinessId = request.getParameter("bussinessId");
|
||||
String fileIds = request.getParameter("fileIds");
|
||||
List<String> deliverablesList = Arrays.asList(fileIds.split(","));
|
||||
this.sysBaseAPI.updateBusinessId(bussinessId,deliverablesList);
|
||||
return Result.OK("更新文件信息!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过附件BussinessId获取附件信息
|
||||
* @param bussinessId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Operation(summary = "通过附件BussinessId获取附件信息")
|
||||
@RequestMapping(value = "/getFileInfoByBussinessId", method = RequestMethod.GET)
|
||||
public Result<JSONArray> getFileInfoByBussinessId(@RequestParam(required = true) String bussinessId,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
// String misFlag = request.getParameter("misFlag");
|
||||
String misFlag = "false";
|
||||
JSONArray jsonArray = this.sysBaseAPI.getFileInfoByBussinessId(bussinessId, misFlag);
|
||||
return Result.OK(jsonArray);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private String securityLevel(String secLevel) {
|
||||
if ("1".equals(secLevel)) {
|
||||
return "非密";
|
||||
} else if ("2".equals(secLevel)) {
|
||||
return "内部";
|
||||
} else if ("3".equals(secLevel)) {
|
||||
return "秘密";
|
||||
} else if ("4".equals(secLevel)) {
|
||||
return "机密";
|
||||
} else return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取存储到数据库的文件名
|
||||
*
|
||||
* @param secLevel 文件密级
|
||||
* @param file 上传的文件
|
||||
* @return 原始文件名
|
||||
*/
|
||||
@NotNull
|
||||
private String getFileNameinDB(String secLevel, MultipartFile file) {
|
||||
String orgName = file.getOriginalFilename();// 获取文件名
|
||||
assert orgName != null;
|
||||
String fileNameInDB = CommonUtils.getFileName(orgName);
|
||||
String pre =null ;
|
||||
String suffix = null ;
|
||||
String secLevelText =null ;
|
||||
|
||||
if(fileNameInDB.indexOf(".") == -1){
|
||||
pre = fileNameInDB;
|
||||
suffix = "";
|
||||
}
|
||||
else {
|
||||
pre = fileNameInDB.substring(0, fileNameInDB.lastIndexOf("."));
|
||||
suffix = fileNameInDB.substring(fileNameInDB.lastIndexOf("."));
|
||||
}
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(secLevel)) {
|
||||
//拼接文件名
|
||||
if ("1".equals(secLevel)) {
|
||||
secLevelText="(非密)" ;
|
||||
} else if ("2".equals(secLevel)) {
|
||||
secLevelText="(内部)";
|
||||
} else if ("3".equals(secLevel)) {
|
||||
secLevelText="(M)";
|
||||
} else if ("4".equals(secLevel)) {
|
||||
secLevelText="(J)";
|
||||
} else {
|
||||
secLevelText="";
|
||||
};
|
||||
|
||||
}
|
||||
return pre+secLevelText+suffix;
|
||||
}
|
||||
}
|
||||
+48
-3
@@ -2,7 +2,8 @@ package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -11,16 +12,15 @@ import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserDepart;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
@@ -56,6 +56,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysDepart")
|
||||
@Slf4j
|
||||
@Tag(name = "部门管理模块", description = "处理用户与角色、部门的关系") // 1. 分类
|
||||
public class SysDepartController {
|
||||
|
||||
@Autowired
|
||||
@@ -174,6 +175,50 @@ public class SysDepartController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个用户的所有所在部门的id和部门名
|
||||
*
|
||||
* @param userName 根据userName查所在部门
|
||||
*/
|
||||
@GetMapping("/queryAffiliatedDepts")
|
||||
@Operation(summary = "根据角色username,查询所在部门", description = "根据角色username,查询所在部门") // 2. 接口描述
|
||||
public Result<List<SysDepart>> queryAffiliatedDepts(
|
||||
@RequestParam(name = "userName", required = false) String userName) {
|
||||
try {
|
||||
// 2. 使用 Optional 处理空逻辑,代码更具现代感
|
||||
List<SysDepart> departList = Optional.ofNullable(userName)
|
||||
.filter(oConvertUtils::isNotEmpty)
|
||||
.map(sysDepartService::queryUserAffiliatedDepts)
|
||||
.orElse(Collections.emptyList()); // 3. 没数据返回只读空列表,性能更好
|
||||
return Result.OK(departList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据departType查询所有二级部门部门
|
||||
*
|
||||
* @param departType 根据departType查询部门
|
||||
*/
|
||||
@GetMapping("/querySecondLevelDepts")
|
||||
@Operation(summary = "根据部门类别查询第二层级的部门", description = "根据部门类别查询第二层级的部门") // 2. 接口描述
|
||||
public Result<List<SysDepart>> querySecondLevelDepts(
|
||||
@RequestParam(name = "departType", required = false) Integer departType) {
|
||||
try {
|
||||
// 2. 使用 Optional 处理空逻辑,代码更具现代感
|
||||
List<SysDepart> departList = Optional.ofNullable(departType)
|
||||
.filter(oConvertUtils::isNotEmpty)
|
||||
.map(sysDepartService::querySecondLevelDepts)
|
||||
.orElse(Collections.emptyList()); // 3. 没数据返回只读空列表,性能更好
|
||||
return Result.OK(departList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新数据 添加用户新建的部门对象数据,并保存到数据库
|
||||
*
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysFileAttachment;
|
||||
import org.jeecg.modules.system.service.ISysFileAttachmentService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: sys_file_attachment
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="sys_file_attachment")
|
||||
@RestController
|
||||
@RequestMapping("/system/sysFileAttachment")
|
||||
@Slf4j
|
||||
public class SysFileAttachmentController extends JeecgController<SysFileAttachment, ISysFileAttachmentService> {
|
||||
@Autowired
|
||||
private ISysFileAttachmentService sysFileAttachmentService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFileAttachment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "sys_file_attachment-分页列表查询")
|
||||
@Operation(summary="sys_file_attachment-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysFileAttachment>> queryPageList(SysFileAttachment sysFileAttachment,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<SysFileAttachment> queryWrapper = QueryGenerator.initQueryWrapper(sysFileAttachment, req.getParameterMap());
|
||||
Page<SysFileAttachment> page = new Page<SysFileAttachment>(pageNo, pageSize);
|
||||
IPage<SysFileAttachment> pageList = sysFileAttachmentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFileAttachment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "sys_file_attachment-添加")
|
||||
@Operation(summary="sys_file_attachment-添加")
|
||||
@RequiresPermissions("system:sys_file_attachment:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SysFileAttachment sysFileAttachment) {
|
||||
sysFileAttachmentService.save(sysFileAttachment);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFileAttachment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "sys_file_attachment-编辑")
|
||||
@Operation(summary="sys_file_attachment-编辑")
|
||||
@RequiresPermissions("system:sys_file_attachment:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SysFileAttachment sysFileAttachment) {
|
||||
sysFileAttachmentService.updateById(sysFileAttachment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "sys_file_attachment-通过id删除")
|
||||
@Operation(summary="sys_file_attachment-通过id删除")
|
||||
@RequiresPermissions("system:sys_file_attachment:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysFileAttachmentService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "sys_file_attachment-批量删除")
|
||||
@Operation(summary="sys_file_attachment-批量删除")
|
||||
@RequiresPermissions("system:sys_file_attachment:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sysFileAttachmentService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "sys_file_attachment-通过id查询")
|
||||
@Operation(summary="sys_file_attachment-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysFileAttachment> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysFileAttachment sysFileAttachment = sysFileAttachmentService.getById(id);
|
||||
if(sysFileAttachment==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sysFileAttachment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFileAttachment
|
||||
*/
|
||||
@RequiresPermissions("system:sys_file_attachment:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFileAttachment sysFileAttachment) {
|
||||
return super.exportXls(request, sysFileAttachment, SysFileAttachment.class, "sys_file_attachment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:sys_file_attachment:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysFileAttachment.class);
|
||||
}
|
||||
|
||||
}
|
||||
+208
-107
@@ -3,30 +3,29 @@ package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.FlowEventTypeConst;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.modules.redis.client.JeecgRedisClient;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.dto.UserDeptSaveDTO;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.model.TreeModel;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
@@ -69,28 +68,29 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RestController
|
||||
@RequestMapping("/sys/role")
|
||||
@Slf4j
|
||||
@Tag(name = "角色管理模块", description = "处理用户与角色、部门的关系") // 1. 分类
|
||||
public class SysRoleController {
|
||||
@Autowired
|
||||
private ISysRoleService sysRoleService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysPermissionDataRuleService sysPermissionDataRuleService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysRolePermissionService sysRolePermissionService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private BaseCommonService baseCommonService;
|
||||
@Autowired
|
||||
private JeecgRedisClient jeecgRedisClient;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询 【系统角色,不做租户隔离】
|
||||
* 分页列表查询 【系统角色,不做租户隔离】
|
||||
* @param role
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
@@ -100,15 +100,15 @@ public class SysRoleController {
|
||||
@RequiresPermissions("system:role:list")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysRole>> queryPageList(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="isMultiTranslate", required = false) Boolean isMultiTranslate,
|
||||
HttpServletRequest req) {
|
||||
//update-begin---author:wangshuai---date:2025-03-26---for:【issues/7948】角色解决根据id查询回显不对---
|
||||
if(null != isMultiTranslate && isMultiTranslate){
|
||||
pageSize = 100;
|
||||
}
|
||||
//update-end---author:wangshuai---date:2025-03-26---for:【issues/7948】角色解决根据id查询回显不对---
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="isMultiTranslate", required = false) Boolean isMultiTranslate,
|
||||
HttpServletRequest req) {
|
||||
//update-begin---author:wangshuai---date:2025-03-26---for:【issues/7948】角色解决根据id查询回显不对---
|
||||
if(null != isMultiTranslate && isMultiTranslate){
|
||||
pageSize = 100;
|
||||
}
|
||||
//update-end---author:wangshuai---date:2025-03-26---for:【issues/7948】角色解决根据id查询回显不对---
|
||||
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
|
||||
//QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
|
||||
//IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
|
||||
@@ -119,7 +119,7 @@ public class SysRoleController {
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询【租户角色,做租户隔离】
|
||||
* @param role
|
||||
@@ -130,15 +130,15 @@ public class SysRoleController {
|
||||
*/
|
||||
@RequestMapping(value = "/listByTenant", method = RequestMethod.GET)
|
||||
public Result<IPage<SysRole>> listByTenant(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
|
||||
//此接口必须通过租户来隔离查询
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
role.setTenantId(oConvertUtils.getInt(!"0".equals(TenantContext.getTenant()) ? TenantContext.getTenant() : "", -1));
|
||||
}
|
||||
|
||||
|
||||
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
|
||||
Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
|
||||
@@ -146,21 +146,21 @@ public class SysRoleController {
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* 添加
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@RequiresPermissions("system:role:add")
|
||||
@RequiresPermissions("system:role:add")
|
||||
public Result<SysRole> add(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
try {
|
||||
//开启多租户隔离,角色id自动生成10位
|
||||
//update-begin---author:wangshuai---date:2024-05-23---for:【TV360X-42】角色新增时设置的编码,保存后不一致---
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL && oConvertUtils.isEmpty(role.getRoleCode())){
|
||||
//update-end---author:wangshuai---date:2024-05-23---for:【TV360X-42】角色新增时设置的编码,保存后不一致---
|
||||
//update-end---author:wangshuai---date:2024-05-23---for:【TV360X-42】角色新增时设置的编码,保存后不一致---
|
||||
role.setRoleCode(RandomUtil.randomString(10));
|
||||
}
|
||||
role.setCreateTime(new Date());
|
||||
@@ -172,13 +172,13 @@ public class SysRoleController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@RequestMapping(value = "/edit",method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<SysRole> edit(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
@@ -201,7 +201,7 @@ public class SysRoleController {
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
boolean ok = sysRoleService.updateById(role);
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
@@ -209,17 +209,42 @@ public class SysRoleController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* 编辑
|
||||
* @param userDeptSaveDTO
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "根据用户id,角色id更新部门id", description = "根据用户id,角色id更新部门id") // 2. 接口描述
|
||||
@RequestMapping(value = "/saveDeptsForUser", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<Boolean> saveDeptsForUser(@Valid @RequestBody UserDeptSaveDTO userDeptSaveDTO) {
|
||||
// 1. 调用 Service 层,获取执行结果(通常 Service 返回 boolean)
|
||||
boolean isSuccess = sysRoleService.saveDeptForRoleUser(
|
||||
userDeptSaveDTO.getUserId(),
|
||||
userDeptSaveDTO.getRoleId(),
|
||||
userDeptSaveDTO.getDeptIds()
|
||||
);
|
||||
|
||||
// 2. 根据结果返回对应的 Result 对象
|
||||
if (isSuccess) {
|
||||
// 使用静态方法(假设你的 Result 类支持,这是最常见的做法)
|
||||
return Result.ok("修改成功!");
|
||||
} else {
|
||||
// 如果失败,返回错误状态,而不是 null
|
||||
return Result.error("修改失败,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:role:delete")
|
||||
@RequiresPermissions("system:role:delete")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
//获取当前用户
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
|
||||
@@ -230,25 +255,23 @@ public class SysRoleController {
|
||||
return Result.error("删除角色失败,当前角色不在此租户中。");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//update-begin---author:wangshuai---date:2024-01-16---for:【QQYUN-7974】禁止删除 admin 角色---
|
||||
//是否存在admin角色
|
||||
sysRoleService.checkAdminRoleRejectDel(id);
|
||||
//update-end---author:wangshuai---date:2024-01-16---for:【QQYUN-7974】禁止删除 admin 角色---
|
||||
|
||||
|
||||
sysRoleService.deleteRole(id);
|
||||
|
||||
// 角色删除,触发同步工作流
|
||||
this.throwSynchronizationProcessSignal(id);
|
||||
return Result.ok("删除角色成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:role:deleteBatch")
|
||||
@RequiresPermissions("system:role:deleteBatch")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
baseCommonService.addLog("删除角色操作,角色ids:" + ids, CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_4);
|
||||
@@ -274,15 +297,13 @@ public class SysRoleController {
|
||||
//验证是否为admin角色
|
||||
sysRoleService.checkAdminRoleRejectDel(ids);
|
||||
sysRoleService.deleteBatchRole(ids.split(","));
|
||||
// 角色删除,触发同步工作流
|
||||
this.throwSynchronizationProcessSignal(ids);
|
||||
result.success("删除角色成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@@ -301,7 +322,7 @@ public class SysRoleController {
|
||||
|
||||
/**
|
||||
* 查询全部角色(参与租户隔离)
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryall", method = RequestMethod.GET)
|
||||
@@ -343,14 +364,14 @@ public class SysRoleController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验角色编码唯一
|
||||
* 校验角色编码唯一
|
||||
*/
|
||||
@RequestMapping(value = "/checkRoleCode", method = RequestMethod.GET)
|
||||
public Result<Boolean> checkUsername(String id,String roleCode) {
|
||||
Result<Boolean> result = new Result<>();
|
||||
//如果此参数为false则程序发生异常
|
||||
//如果此参数为false则程序发生异常
|
||||
result.setResult(true);
|
||||
log.info("--验证角色编码是否唯一---id:"+id+"--roleCode:"+roleCode);
|
||||
try {
|
||||
@@ -396,7 +417,7 @@ public class SysRoleController {
|
||||
sysRole.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
@@ -422,7 +443,7 @@ public class SysRoleController {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
@@ -443,7 +464,7 @@ public class SysRoleController {
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据规则数据
|
||||
*/
|
||||
@@ -472,7 +493,7 @@ public class SysRoleController {
|
||||
//TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存数据规则至角色菜单关联表
|
||||
*/
|
||||
@@ -499,8 +520,8 @@ public class SysRoleController {
|
||||
}
|
||||
return Result.ok("保存成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户角色授权功能,查询菜单权限树
|
||||
* @param request
|
||||
@@ -522,9 +543,9 @@ public class SysRoleController {
|
||||
List<TreeModel> treeList = new ArrayList<>();
|
||||
getTreeModelList(treeList, list, null);
|
||||
Map<String,Object> resMap = new HashMap(5);
|
||||
//全部树节点数据
|
||||
//全部树节点数据
|
||||
resMap.put("treeList", treeList);
|
||||
//全部树ids
|
||||
//全部树ids
|
||||
resMap.put("ids", ids);
|
||||
result.setResult(resMap);
|
||||
result.setSuccess(true);
|
||||
@@ -533,7 +554,7 @@ public class SysRoleController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaList,TreeModel temp) {
|
||||
for (SysPermission permission : metaList) {
|
||||
String tempPid = permission.getParentId();
|
||||
@@ -549,19 +570,110 @@ public class SysRoleController {
|
||||
getTreeModelList(treeList, metaList, tree);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 权限未完成(明道云接口,租户应用)
|
||||
* 分页获取全部角色列表(包含每个角色的数量)
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryPageRoleCount", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUserRoleCountVo>> queryPageRoleCount(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Result<IPage<SysUserRoleCountVo>> result = new Result<>();
|
||||
/**
|
||||
* 根据指定的权限IDs,查询其下所有子孙节点并构建树
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeListByIds", method = RequestMethod.GET)
|
||||
@Operation(summary = "根据指定的部门id,返回其下属所有的syspermession", description = "根据指定的部门id,返回其下属所有的syspermession")
|
||||
public Result<Map<String, Object>> queryTreeList(@RequestParam(name = "ids") String idsStr) {
|
||||
Result<Map<String, Object>> result = new Result<>();
|
||||
try {
|
||||
// 1. 获取所有原始数据
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
|
||||
query.orderByAsc(SysPermission::getSortNo);
|
||||
List<SysPermission> allList = sysPermissionService.list(query);
|
||||
|
||||
// 2. 准备初始 ID 集合(假设传入逗号分隔的字符串)
|
||||
List<String> startIds = Arrays.asList(idsStr.split(","));
|
||||
|
||||
// 3. 筛选出目标范围:初始节点 + 它们的所有子孙
|
||||
List<SysPermission> filteredList = new ArrayList<>();
|
||||
Set<String> addedIds = new HashSet<>(); // 用于去重
|
||||
|
||||
for (SysPermission p : allList) {
|
||||
if (startIds.contains(p.getId())) {
|
||||
filteredList.add(p);
|
||||
addedIds.add(p.getId());
|
||||
// 递归寻找当前节点的所有后代
|
||||
getChildrenSysPermission(p.getId(), allList, filteredList);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 统计最终范围内所有的 ID(用于前端勾选等场景)
|
||||
List<String> finalIds = filteredList.stream().map(SysPermission::getId).collect(Collectors.toList());
|
||||
|
||||
// 5. 构建树形结构
|
||||
List<TreeModel> treeList = new ArrayList<>();
|
||||
// 注意:这里的 startIds 用于告诉构建函数,谁是这棵“局部树”的根
|
||||
getTreeModelListByScope(treeList, filteredList, null, startIds);
|
||||
|
||||
Map<String, Object> resMap = new HashMap<>(5);
|
||||
resMap.put("treeList", treeList);
|
||||
resMap.put("ids", finalIds);
|
||||
|
||||
result.setResult(resMap);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("查询失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归构建树模型(适配局部搜索)
|
||||
*/
|
||||
private void getTreeModelListByScope(List<TreeModel> treeList, List<SysPermission> metaList, TreeModel temp, List<String> startIds) {
|
||||
for (SysPermission permission : metaList) {
|
||||
String tempPid = permission.getParentId();
|
||||
TreeModel tree = new TreeModel(permission.getId(), tempPid, permission.getName(), permission.getRuleFlag(), permission.isLeaf());
|
||||
|
||||
if (temp == null) {
|
||||
// 如果当前没有父节点,且该节点属于我们指定的初始起始点,则它就是根
|
||||
if (startIds.contains(permission.getId())) {
|
||||
treeList.add(tree);
|
||||
if (!tree.getIsLeaf()) {
|
||||
getTreeModelListByScope(treeList, metaList, tree, startIds);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 如果有父节点,匹配 PID
|
||||
if (Objects.equals(tempPid, temp.getKey())) {
|
||||
temp.getChildren().add(tree);
|
||||
if (!tree.getIsLeaf()) {
|
||||
getTreeModelListByScope(treeList, metaList, tree, startIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归寻找子节点(顺藤摸瓜)
|
||||
*/
|
||||
private void getChildrenSysPermission(String permissionId, List<SysPermission> metaList, List<SysPermission> filteredList) {
|
||||
for (SysPermission sysPermission : metaList) {
|
||||
if (Objects.equals(sysPermission.getParentId(), permissionId)) {
|
||||
filteredList.add(sysPermission);
|
||||
// 继续深挖
|
||||
getChildrenSysPermission(sysPermission.getId(), metaList, filteredList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取全部角色列表(包含每个角色的数量)
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryPageRoleCount", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUserRoleCountVo>> queryPageRoleCount(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Result<IPage<SysUserRoleCountVo>> result = new Result<>();
|
||||
LambdaQueryWrapper<SysRole> query = new LambdaQueryWrapper<SysRole>();
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||
@@ -569,38 +681,27 @@ public class SysRoleController {
|
||||
query.eq(SysRole::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
Page<SysRole> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, query);
|
||||
List<SysRole> records = pageList.getRecords();
|
||||
IPage<SysUserRoleCountVo> sysRoleCountPage = new PageDTO<>();
|
||||
List<SysUserRoleCountVo> sysCountVoList = new ArrayList<>();
|
||||
//循环角色数据获取每个角色下面对应的角色数量
|
||||
for (SysRole role:records) {
|
||||
LambdaQueryWrapper<SysUserRole> countQuery = new LambdaQueryWrapper<>();
|
||||
Page<SysRole> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, query);
|
||||
List<SysRole> records = pageList.getRecords();
|
||||
IPage<SysUserRoleCountVo> sysRoleCountPage = new PageDTO<>();
|
||||
List<SysUserRoleCountVo> sysCountVoList = new ArrayList<>();
|
||||
//循环角色数据获取每个角色下面对应的角色数量
|
||||
for (SysRole role:records) {
|
||||
LambdaQueryWrapper<SysUserRole> countQuery = new LambdaQueryWrapper<>();
|
||||
countQuery.eq(SysUserRole::getRoleId,role.getId());
|
||||
long count = sysUserRoleService.count(countQuery);
|
||||
SysUserRoleCountVo countVo = new SysUserRoleCountVo();
|
||||
BeanUtils.copyProperties(role,countVo);
|
||||
countVo.setCount(count);
|
||||
sysCountVoList.add(countVo);
|
||||
}
|
||||
sysRoleCountPage.setRecords(sysCountVoList);
|
||||
sysRoleCountPage.setTotal(pageList.getTotal());
|
||||
sysRoleCountPage.setSize(pageList.getSize());
|
||||
result.setSuccess(true);
|
||||
result.setResult(sysRoleCountPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色删除,触发同步工作流
|
||||
*
|
||||
* @param roleIds
|
||||
*/
|
||||
private void throwSynchronizationProcessSignal(String roleIds) {
|
||||
// 触发流程同步信号事件
|
||||
BaseMap baseMap = new BaseMap();
|
||||
baseMap.put("roleIds", roleIds);
|
||||
jeecgRedisClient.sendMessage(FlowEventTypeConst.DELETE_ROLE_2_BPM_REDIS_HANDLER, baseMap);
|
||||
long count = sysUserRoleService.count(countQuery);
|
||||
SysUserRoleCountVo countVo = new SysUserRoleCountVo();
|
||||
BeanUtils.copyProperties(role,countVo);
|
||||
countVo.setCount(count);
|
||||
sysCountVoList.add(countVo);
|
||||
}
|
||||
sysRoleCountPage.setRecords(sysCountVoList);
|
||||
sysRoleCountPage.setTotal(pageList.getTotal());
|
||||
sysRoleCountPage.setSize(pageList.getSize());
|
||||
result.setSuccess(true);
|
||||
result.setResult(sysRoleCountPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+109
-18
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -27,6 +29,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.dto.DeptRoleVO;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
||||
@@ -34,6 +37,7 @@ import org.jeecg.modules.system.service.*;
|
||||
import org.jeecg.modules.system.util.ImportOldUserUtil;
|
||||
import org.jeecg.modules.system.vo.SysDepartUsersVO;
|
||||
import org.jeecg.modules.system.vo.SysUserExportVo;
|
||||
import org.jeecg.modules.system.vo.SysUserRoleDeptsVo;
|
||||
import org.jeecg.modules.system.vo.SysUserRoleVO;
|
||||
import org.jeecg.modules.system.vo.lowapp.DepartAndUserInfo;
|
||||
import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo;
|
||||
@@ -42,6 +46,7 @@ import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jetbrains.kotlin.com.intellij.psi.SyntaxTraverser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -66,6 +71,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/user")
|
||||
@Tag(name = "用户管理模块", description = "处理用户与角色、部门的关系") // 1. 分类
|
||||
public class SysUserController {
|
||||
|
||||
@Autowired
|
||||
@@ -106,7 +112,8 @@ public class SysUserController {
|
||||
|
||||
@Autowired
|
||||
private JeecgRedisClient jeecgRedisClient;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取租户下用户数据(支持租户隔离)
|
||||
* @param user
|
||||
@@ -152,6 +159,24 @@ public class SysUserController {
|
||||
return sysUserService.queryPageList(req, queryWrapper, pageSize, pageNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统用户数据(查询全部用户,不做租户隔离)
|
||||
*
|
||||
* @param user
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:user:listAll")
|
||||
@RequestMapping(value = "/listAllExcludeAdmin", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUser>> queryAllPageListExcludeAdmin(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
queryWrapper.notLike("username", "admin");
|
||||
return sysUserService.queryPageList(req, queryWrapper, pageSize, pageNo);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:add")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysUser> add(@RequestBody JSONObject jsonObject) {
|
||||
@@ -260,7 +285,7 @@ public class SysUserController {
|
||||
baseCommonService.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 3);
|
||||
List<String> userNameList = sysUserService.userIdToUsername(Arrays.asList(ids.split(",")));
|
||||
this.sysUserService.deleteBatchUsers(ids);
|
||||
|
||||
|
||||
// 用户变更,触发同步工作流
|
||||
if (!userNameList.isEmpty()) {
|
||||
String joinedString = String.join(",", userNameList);
|
||||
@@ -475,15 +500,66 @@ public class SysUserController {
|
||||
@RequestParam(name="realname",required=false) String realname,
|
||||
@RequestParam(name="username",required=false) String username,
|
||||
@RequestParam(name="isMultiTranslate",required=false) String isMultiTranslate,
|
||||
@RequestParam(name="id",required = false) String id) {
|
||||
@RequestParam(name="id",required = false) String id,
|
||||
@RequestParam(name="searchSecurityLevel",required = false) Integer searchSecurityLevel
|
||||
) {
|
||||
//update-begin-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
|
||||
String[] arr = new String[]{departId, realname, username, id};
|
||||
SqlInjectionUtil.filterContent(arr, SymbolConstant.SINGLE_QUOTATION_MARK);
|
||||
//update-end-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
|
||||
IPage<SysUser> pageList = sysUserDepartService.queryDepartUserPageList(departId, username, realname, pageSize, pageNo,id,isMultiTranslate);
|
||||
IPage<SysUser> pageList = sysUserDepartService.queryDepartUserPageList(departId, username, realname, pageSize, pageNo,id,searchSecurityLevel,isMultiTranslate);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户选择组件 专用 根据用户账号或部门,角色分页查询
|
||||
* @param departId
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryUserRoleComponentData", method = RequestMethod.GET)
|
||||
@Operation(summary = "根据角色ID,部门ID以及用户密级查询用户列表", description = "原生用户查询逻辑加上密级筛选以及角色筛选") // 2. 接口描述
|
||||
public Result<IPage<SysUser>> queryUserRoleComponentData(
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "departId", required = false) String departId,
|
||||
@RequestParam(name = "roleId", required = false) String roleId,
|
||||
@RequestParam(name="realname",required=false) String realname,
|
||||
@RequestParam(name="username",required=false) String username,
|
||||
@RequestParam(name="isMultiTranslate",required=false) String isMultiTranslate,
|
||||
@RequestParam(name="id",required = false) String id,
|
||||
@RequestParam(name="searchSecurityLevel",required = false) Integer searchSecurityLevel
|
||||
) {
|
||||
//update-begin-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
|
||||
String[] arr = new String[]{departId, realname, username, id};
|
||||
SqlInjectionUtil.filterContent(arr, SymbolConstant.SINGLE_QUOTATION_MARK);
|
||||
//update-end-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
|
||||
IPage<SysUser> pageList = sysUserDepartService.queryDepartRoleUserPageList(departId,roleId,username, realname, pageSize, pageNo,id,searchSecurityLevel,isMultiTranslate);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户选择组件 专用 根据用户账号或部门,角色分页查询
|
||||
* @param deptRoleVO
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryUserByDeptAndROle", method = RequestMethod.GET)
|
||||
@Operation(summary = "根据角色ID,部门ID以及用户密级查询当前用户列表", description = "原生用户查询逻辑加上密级筛选以及角色筛选") // 2. 接口描述
|
||||
public Result<List<SysUser>> queryUserByDeptAndROle(DeptRoleVO deptRoleVO
|
||||
) {
|
||||
try {
|
||||
List<SysUser> sysUserList = sysUserService.queryUserByDeptAndROle(
|
||||
deptRoleVO.getDeptId(),
|
||||
deptRoleVO.getRoleId(),
|
||||
deptRoleVO.getSecretLevel()
|
||||
);
|
||||
return Result.ok(sysUserList); // 假设你的 Result 有 ok 方法
|
||||
} catch (Exception e) {
|
||||
log.error("查询用户列表失败", e); // 记得打日志
|
||||
return Result.error("查询失败:" + e.getMessage()); // 返回错误信息
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
@@ -607,6 +683,21 @@ public class SysUserController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/userRoleListWithDepts", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUserRoleDeptsVo>> userRoleListWithDepts(
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysUserRoleDeptsVo>> result = new Result<IPage<SysUserRoleDeptsVo>>();
|
||||
Page<SysUserRoleDeptsVo> page = new Page<SysUserRoleDeptsVo>(pageNo, pageSize);
|
||||
String roleId = req.getParameter("roleId");
|
||||
String username = req.getParameter("username");
|
||||
IPage<SysUserRoleDeptsVo> pageList = sysUserService.getUserByRoleIdWithDeptIds(page,roleId,username);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 给指定角色添加用户
|
||||
*
|
||||
@@ -887,7 +978,7 @@ public class SysUserController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有部门/当前部门编码
|
||||
* @return
|
||||
@@ -910,12 +1001,12 @@ public class SysUserController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户注册接口
|
||||
*
|
||||
*
|
||||
* @param jsonObject
|
||||
* @param user
|
||||
* @return
|
||||
@@ -978,7 +1069,7 @@ public class SysUserController {
|
||||
if(oConvertUtils.isEmpty(realname)){
|
||||
realname = username;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
user.setCreateTime(new Date());// 设置创建时间
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
@@ -1073,7 +1164,7 @@ public class SysUserController {
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户更改密码
|
||||
*/
|
||||
@@ -1125,11 +1216,11 @@ public class SysUserController {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据TOKEN获取用户的部分信息(返回的数据是可供表单设计器使用的数据)
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUserSectionInfoByToken")
|
||||
@@ -1140,7 +1231,7 @@ public class SysUserController {
|
||||
if (oConvertUtils.isEmpty(token)) {
|
||||
username = JwtUtil.getUserNameByToken(request);
|
||||
} else {
|
||||
username = JwtUtil.getUsername(token);
|
||||
username = JwtUtil.getUsername(token);
|
||||
}
|
||||
|
||||
log.debug(" ------ 通过令牌获取部分用户信息,当前用户: " + username);
|
||||
@@ -1161,7 +1252,7 @@ public class SysUserController {
|
||||
return Result.error(500, "查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 【APP端接口】获取用户列表 根据用户名和真实名 模糊匹配
|
||||
* @param keyword
|
||||
@@ -1198,7 +1289,7 @@ public class SysUserController {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(500, "查询失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1771,7 +1862,7 @@ public class SysUserController {
|
||||
Integer tenantId = sysUser.getLoginTenantId();
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = loginUser.getId();
|
||||
|
||||
|
||||
// 判断 指定的租户ID是不是当前登录用户的租户
|
||||
LambdaQueryWrapper<SysUserTenant> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUserTenant::getTenantId, tenantId);
|
||||
@@ -1780,7 +1871,7 @@ public class SysUserController {
|
||||
if(null == one){
|
||||
return result.error500("非租户下的用户,不允许修改!");
|
||||
}
|
||||
|
||||
|
||||
// 修改 loginTenantId
|
||||
LambdaQueryWrapper<SysUser> update = new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getId, userId);
|
||||
@@ -1788,7 +1879,7 @@ public class SysUserController {
|
||||
updateUser.setLoginTenantId(tenantId);
|
||||
sysUserService.update(updateUser, update);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用用户导出
|
||||
@@ -1799,7 +1890,7 @@ public class SysUserController {
|
||||
public ModelAndView exportAppUser(HttpServletRequest request) {
|
||||
return sysUserService.exportAppUser(request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 应用用户导入
|
||||
* @param request
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.system.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class DeptRoleVO {
|
||||
@NotBlank(message = "角色id不为空")
|
||||
private String roleId;
|
||||
@NotBlank(message = "deptId不为空")
|
||||
private String deptId;
|
||||
@NotBlank(message = "secretLevel不为空")
|
||||
private Integer secretLevel;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.system.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class UserDeptSaveDTO {
|
||||
@NotBlank(message = "角色id不为空")
|
||||
private String roleId;
|
||||
@NotBlank(message = "userId不为空")
|
||||
private String userId;
|
||||
@NotBlank(message = "deptId不为空")
|
||||
private String deptIds;
|
||||
}
|
||||
+6
-1
@@ -88,6 +88,7 @@ public class SysDepart implements Serializable {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
@@ -102,7 +103,11 @@ public class SysDepart implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String oldDirectorUserIds;
|
||||
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]新增字段负责人ids和旧的负责人ids
|
||||
|
||||
|
||||
/**部门类型(0所领导,1职能部门,2业务部门,3专项组)*/
|
||||
@Dict(dicCode = "depart_type")
|
||||
private String departType;
|
||||
|
||||
/**
|
||||
* 重写equals方法
|
||||
*/
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: sys_file_attachment
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_file_attachment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="sys_file_attachment")
|
||||
public class SysFileAttachment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "id")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**单位编码*/
|
||||
@Excel(name = "单位编码", width = 15)
|
||||
@Schema(description = "单位编码")
|
||||
private java.lang.String orgCode;
|
||||
/**附件名称*/
|
||||
@Excel(name = "附件名称", width = 15)
|
||||
@Schema(description = "附件名称")
|
||||
private java.lang.String fileName;
|
||||
/**密级*/
|
||||
@Excel(name = "密级", width = 15)
|
||||
@Schema(description = "密级")
|
||||
private java.lang.String secretLevel;
|
||||
/**路径*/
|
||||
@Excel(name = "路径", width = 15)
|
||||
@Schema(description = "路径")
|
||||
private java.lang.String path;
|
||||
/**密级名称*/
|
||||
@Excel(name = "密级名称", width = 15)
|
||||
@Schema(description = "密级名称")
|
||||
private java.lang.String secretText;
|
||||
/**部门编码*/
|
||||
@Excel(name = "部门编码", width = 15)
|
||||
@Schema(description = "部门编码")
|
||||
private java.lang.String deptCode;
|
||||
/**租户id*/
|
||||
@Excel(name = "租户id", width = 15)
|
||||
@Schema(description = "租户id")
|
||||
private java.lang.String tenantId;
|
||||
/**文件大小(b)*/
|
||||
@Excel(name = "文件大小(b)", width = 15)
|
||||
@Schema(description = "文件大小(b)")
|
||||
private java.lang.Integer size;
|
||||
/**备用字段*/
|
||||
@Excel(name = "备用字段", width = 15)
|
||||
@Schema(description = "备用字段")
|
||||
private java.lang.String extend;
|
||||
/**备用字段2*/
|
||||
@Excel(name = "备用字段2", width = 15)
|
||||
@Schema(description = "备用字段2")
|
||||
private java.lang.String extend2;
|
||||
/**备用字段3*/
|
||||
@Excel(name = "备用字段3", width = 15)
|
||||
@Schema(description = "备用字段3")
|
||||
private java.lang.String extend3;
|
||||
/**备用字段4*/
|
||||
@Excel(name = "备用字段4", width = 15)
|
||||
@Schema(description = "备用字段4")
|
||||
private java.lang.String extend4;
|
||||
/**文件id*/
|
||||
@Excel(name = "文件id", width = 15)
|
||||
@Schema(description = "文件id")
|
||||
private java.lang.String fileId;
|
||||
/**文件后缀*/
|
||||
@Excel(name = "文件后缀", width = 15)
|
||||
@Schema(description = "文件后缀")
|
||||
private java.lang.String fileSuffix;
|
||||
/**文件类别*/
|
||||
@Excel(name = "文件类别", width = 15)
|
||||
@Schema(description = "文件类别")
|
||||
private java.lang.String fileType;
|
||||
/**向上名称*/
|
||||
@Excel(name = "向上名称", width = 15)
|
||||
@Schema(description = "向上名称")
|
||||
private java.lang.String upName;
|
||||
/**文件上传类型*/
|
||||
@Excel(name = "文件上传类型", width = 15)
|
||||
@Schema(description = "文件上传类型")
|
||||
private java.lang.String fileUploadType;
|
||||
/**关联业务表单id*/
|
||||
@Excel(name = "关联业务表单id", width = 15)
|
||||
@Schema(description = "关联业务表单id")
|
||||
private java.lang.String businessId;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
@TableLogic
|
||||
@Dict(dicCode = "del_flag")
|
||||
private String delFlag;
|
||||
}
|
||||
+18
-4
@@ -2,15 +2,12 @@ package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -30,6 +27,7 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_user")
|
||||
public class SysUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -211,4 +209,20 @@ public class SysUser implements Serializable {
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private boolean izBindThird;
|
||||
|
||||
/**
|
||||
* 人员密级(3非密,4一般,5重要)
|
||||
*/
|
||||
@Excel(name = "密级", width = 15,dicCode="user_security_level")
|
||||
@Dict(dicCode = "user_security_level")
|
||||
private Integer userSecurityLevel;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为专项(0非专项,1专项)
|
||||
*/
|
||||
@Excel(name = "人员是否专项", width = 15,dicCode="user_is_special")
|
||||
@Dict(dicCode = "is_special")
|
||||
private Integer isSpecial;
|
||||
|
||||
}
|
||||
|
||||
+5
@@ -39,6 +39,11 @@ public class SysUserRole implements Serializable {
|
||||
|
||||
/**租户ID*/
|
||||
private java.lang.Integer tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private String deptId;
|
||||
|
||||
public SysUserRole() {
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysFileAttachment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: sys_file_attachment
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFileAttachmentMapper extends BaseMapper<SysFileAttachment> {
|
||||
|
||||
}
|
||||
+14
-1
@@ -9,6 +9,8 @@ import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserDepart;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @Description: 用户部门mapper接口
|
||||
* @author: jeecg-boot
|
||||
@@ -40,7 +42,18 @@ public interface SysUserDepartMapper extends BaseMapper<SysUserDepart>{
|
||||
*/
|
||||
IPage<SysUser> queryDepartUserPageList(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("username") String username, @Param("realname") String realname);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 根据部门查询部门用户
|
||||
* @param page
|
||||
* @param orgCode
|
||||
* @param username
|
||||
* @param realname
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> queryOneDepartUserPageList(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("username") String username, @Param("realname") String realname);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param page
|
||||
* @param orgCode
|
||||
|
||||
+24
-2
@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysUserDepart;
|
||||
import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
||||
import org.jeecg.modules.system.vo.SysUserDepVo;
|
||||
import org.jeecg.modules.system.vo.SysUserRoleDeptsVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -77,7 +80,16 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> getUserByRoleId(Page page, @Param("roleId") String roleId, @Param("username") String username);
|
||||
|
||||
|
||||
/**
|
||||
* 根据角色Id查询带部门的用户信息
|
||||
* @param page
|
||||
* @param roleId 角色id
|
||||
* @param username 用户登录账户
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUserRoleDeptsVo> getUserByRoleIdWithDeptIds(Page page, @Param("roleId") String roleId, @Param("username") String username);
|
||||
|
||||
/**
|
||||
* 根据用户名设置部门ID
|
||||
* @param username
|
||||
@@ -91,7 +103,8 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
public SysUser getUserByPhone(@Param("phone") String phone);
|
||||
|
||||
|
||||
public List<SysDepart> queryUserAffiliatedDepts(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 根据邮箱查询用户信息
|
||||
@@ -222,4 +235,13 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
*/
|
||||
@Select("select id,phone from sys_user where phone = #{phone} and username = #{username}")
|
||||
SysUser getUserByNameAndPhone(@Param("phone") String phone, @Param("username") String username);
|
||||
|
||||
/**
|
||||
* 通过部门id和角色id,密级获取用户
|
||||
* @param deptId
|
||||
* @param roleId
|
||||
* @parm secretLevel
|
||||
* @return
|
||||
*/
|
||||
List<SysUser> queryUserByDeptAndROle( String deptId, String roleId, Integer secretLevel);
|
||||
}
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.jeecg.modules.system.entity.SysUserRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@@ -40,4 +41,9 @@ public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
@Select("select id from sys_role where id in (select role_id from sys_user_role where user_id = (select id from sys_user where username=#{username}))")
|
||||
List<String> getRoleIdByUserName(@Param("username") String username);
|
||||
|
||||
@Update("UPDATE sys_user_role SET dept_id = #{deptIds} " +
|
||||
"WHERE user_id = #{userId} AND role_id = #{roleId}")
|
||||
int saveDeptForRoleUser(@Param("userId") String userId,
|
||||
@Param("roleId") String roleId,
|
||||
@Param("deptIds") String deptIds);
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.jeecg.modules.system.mapper.SysFileAttachmentMapper">
|
||||
|
||||
</mapper>
|
||||
+17
@@ -39,6 +39,23 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据部门查询部门用户 分页 -->
|
||||
<select id="queryOneDepartUserPageList" resultType="org.jeecg.modules.system.entity.SysUser">
|
||||
select DISTINCT a.* from sys_user a
|
||||
left join sys_user_depart b on b.user_id = a.id
|
||||
left join sys_depart c on b.dep_id = c.id
|
||||
where a.del_flag = 0
|
||||
and a.status = 1
|
||||
and c.org_code = #{orgCode} <!-- 重点:直接等于,不要like -->
|
||||
and a.username!='_reserve_user_external'
|
||||
|
||||
<if test="username!=null and username!=''">
|
||||
and a.username like concat('%',#{username},'%')
|
||||
</if>
|
||||
<if test="realname!=null and realname!=''">
|
||||
and a.realname like concat('%',#{realname},'%')
|
||||
</if>
|
||||
</select>
|
||||
<!--获取用户信息(聊天专用)-->
|
||||
<select id="getUserInformation" resultType="org.jeecg.modules.system.entity.SysUser">
|
||||
select DISTINCT a.* from sys_user a
|
||||
|
||||
+42
-1
@@ -58,7 +58,32 @@
|
||||
and username = #{username}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getUserByRoleIdWithDeptIds" resultType="org.jeecg.modules.system.vo.SysUserRoleDeptsVo">
|
||||
SELECT
|
||||
u.id as user_id,
|
||||
u.*,
|
||||
r.dept_id AS deptId FROM sys_user u
|
||||
INNER JOIN sys_user_role r ON u.id = r.user_id
|
||||
WHERE u.del_flag = 0
|
||||
AND r.role_id = #{roleId}
|
||||
<if test="username != null and username != ''">
|
||||
AND u.username = #{username}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryUserAffiliatedDepts" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
SELECT
|
||||
d.* FROM
|
||||
sys_depart d
|
||||
INNER JOIN sys_user_depart ud ON d.id = ud.dep_id
|
||||
INNER JOIN sys_user u ON ud.user_id = u.id
|
||||
<where>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.username = #{userName}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- 修改用户部门code -->
|
||||
<update id="updateUserDepart">
|
||||
UPDATE sys_user SET
|
||||
@@ -298,4 +323,20 @@
|
||||
and sut.tenant_id=#{tenantId}
|
||||
and sut.status = '1'
|
||||
</select>
|
||||
|
||||
|
||||
<!--根据部门id获取用户数据-->
|
||||
<select id="queryUserByDeptAndROle" resultType="org.jeecg.modules.system.entity.SysUser">
|
||||
SELECT
|
||||
u.*
|
||||
FROM
|
||||
sys_user u
|
||||
INNER JOIN
|
||||
sys_user_role
|
||||
AS tem ON u.id = tem.user_id
|
||||
where u.user_security_level >= #{secretLevel}
|
||||
and tem.dept_id LIKE CONCAT('%', #{deptId}, '%')
|
||||
and tem.role_id = #{roleId}
|
||||
GROUP BY u.username
|
||||
</select>
|
||||
</mapper>
|
||||
+13
-1
@@ -75,6 +75,8 @@ public class SysDepartTreeModel implements Serializable{
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String departType;
|
||||
|
||||
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
||||
/**部门负责人ids*/
|
||||
private String directorUserIds;
|
||||
@@ -113,6 +115,7 @@ public class SysDepartTreeModel implements Serializable{
|
||||
this.updateBy = sysDepart.getUpdateBy();
|
||||
this.updateTime = sysDepart.getUpdateTime();
|
||||
this.directorUserIds = sysDepart.getDirectorUserIds();
|
||||
this.departType = sysDepart.getDepartType();
|
||||
if(0 == sysDepart.getIzLeaf()){
|
||||
this.isLeaf = false;
|
||||
}else{
|
||||
@@ -166,6 +169,14 @@ public class SysDepartTreeModel implements Serializable{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDepartType() {
|
||||
return departType;
|
||||
}
|
||||
|
||||
public void setDepartType(String departType) {
|
||||
this.departType = departType;
|
||||
}
|
||||
|
||||
public List<SysDepartTreeModel> getChildren() {
|
||||
return children;
|
||||
}
|
||||
@@ -385,7 +396,8 @@ public class SysDepartTreeModel implements Serializable{
|
||||
Objects.equals(updateBy, model.updateBy) &&
|
||||
Objects.equals(updateTime, model.updateTime) &&
|
||||
Objects.equals(directorUserIds, model.directorUserIds) &&
|
||||
Objects.equals(children, model.children);
|
||||
Objects.equals(children, model.children) &&
|
||||
Objects.equals(departType, model.departType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
@@ -181,6 +181,10 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||
*/
|
||||
List<SysDepart> getMyDepartList();
|
||||
|
||||
List<SysDepart> queryUserAffiliatedDepts(String userName);
|
||||
|
||||
List<SysDepart> querySecondLevelDepts(Integer departType);
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param id
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import org.jeecg.modules.system.entity.SysFileAttachment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: sys_file_attachment
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFileAttachmentService extends IService<SysFileAttachment> {
|
||||
|
||||
}
|
||||
+9
@@ -61,6 +61,15 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
*/
|
||||
public boolean deleteBatchRole(String[] roleids);
|
||||
|
||||
/**
|
||||
* 批量删除角色
|
||||
* @param userId
|
||||
* @param roleId
|
||||
* @param deptIds
|
||||
* @return
|
||||
*/
|
||||
Boolean saveDeptForRoleUser(String userId,String roleId,String deptIds);
|
||||
|
||||
/**
|
||||
* 根据角色id和当前租户判断当前角色是否存在这个租户中
|
||||
* @param id
|
||||
|
||||
+17
-2
@@ -54,9 +54,24 @@ public interface ISysUserDepartService extends IService<SysUserDepart> {
|
||||
* @param isMultiTranslate 是否多字段翻译
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> queryDepartUserPageList(String departId, String username, String realname, int pageSize, int pageNo,String id,String isMultiTranslate);
|
||||
IPage<SysUser> queryDepartUserPageList(String departId,String username, String realname, int pageSize, int pageNo,String id,Integer userSecurityLevel,String isMultiTranslate);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 用户组件数据查询
|
||||
* @param departId
|
||||
* @param roleId
|
||||
* @param username
|
||||
* @param pageSize
|
||||
* @param pageNo
|
||||
* @param realname
|
||||
* @param id
|
||||
* @param isMultiTranslate 是否多字段翻译
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> queryDepartRoleUserPageList(String departId, String roleId, String username, String realname, int pageSize, int pageNo,String id,Integer userSecurityLevel,String isMultiTranslate);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param tenantId
|
||||
* @param departId
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user