From cfebfa4ae1a9e60691cd61718a55121effdfa06a Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 25 十一月 2024 13:53:51 +0800 Subject: [PATCH] 1 --- se-modules/se-system/src/main/java/com/se/system/mapper/SysJobMapper.java | 5 se-modules/se-system/src/main/java/com/se/system/mapper/SysJobLogMapper.java | 5 se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobLogService.java | 5 se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobService.java | 9 se-modules/se-system/src/main/java/com/se/system/controller/SysJobController.java | 31 ++--- se-modules/se-system/src/main/java/com/se/system/controller/SysJobLogController.java | 23 +-- se-modules/se-system/src/main/java/com/se/system/utils/QuartzJobExecution.java | 4 se-modules/se-system/src/main/java/com/se/system/utils/ScheduleUtils.java | 4 pom.xml | 2 se-modules/se-system/src/main/java/com/se/system/utils/RyTask.java | 4 se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobServiceImpl.java | 25 ++- se-modules/se-system/src/main/java/com/se/system/utils/JobInvokeUtil.java | 9 /dev/null | 111 ------------------ se-modules/se-system/pom.xml | 30 +++- se-modules/se-system/src/main/java/com/se/system/utils/CronUtils.java | 5 se-modules/se-system/src/main/java/com/se/system/utils/QuartzDisallowConcurrentExecution.java | 4 se-modules/se-system/src/main/java/com/se/system/domain/SysJob.java | 15 +- se-modules/se-system/src/main/java/com/se/system/domain/SysJobLog.java | 9 se-modules/se-system/src/main/java/com/se/system/config/ScheduleConfig.java | 2 se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobLogServiceImpl.java | 14 +- se-modules/pom.xml | 4 se-modules/se-system/src/main/java/com/se/system/utils/AbstractQuartzJob.java | 22 +- 22 files changed, 122 insertions(+), 220 deletions(-) diff --git a/pom.xml b/pom.xml index 28981e0..66c72bb 100644 --- a/pom.xml +++ b/pom.xml @@ -226,7 +226,7 @@ </dependencyManagement> <modules> - <module>se-auth</module> + <!--<module>se-auth</module>--> <module>se-gateway</module> <module>se-visual</module> <module>se-modules</module> diff --git a/se-modules/pom.xml b/se-modules/pom.xml index 09ae2ca..c39c8ee 100644 --- a/se-modules/pom.xml +++ b/se-modules/pom.xml @@ -10,9 +10,9 @@ <modules> <module>se-system</module> - <module>se-gen</module> + <!--<module>se-gen</module> <module>se-job</module> - <module>se-file</module> + <module>se-file</module>--> </modules> <artifactId>se-modules</artifactId> diff --git a/se-modules/se-file/pom.xml b/se-modules/se-file/pom.xml deleted file mode 100644 index 9e3c363..0000000 --- a/se-modules/se-file/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>com.se</groupId> - <artifactId>se-modules</artifactId> - <version>3.6.4</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>se-modules-file</artifactId> - - <description> - se-modules-file鏂囦欢鏈嶅姟 - </description> - - <dependencies> - - <!-- SpringCloud Alibaba Nacos --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Nacos Config --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Sentinel --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> - </dependency> - - <!-- SpringBoot Actuator --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - - <!-- FastDFS --> - <dependency> - <groupId>com.github.tobato</groupId> - <artifactId>fastdfs-client</artifactId> - </dependency> - - <!-- Minio --> - <dependency> - <groupId>io.minio</groupId> - <artifactId>minio</artifactId> - <version>8.2.2</version> -<!-- <version>${minio.version}</version>--> - </dependency> - - <!-- SE Api System --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-api-system</artifactId> - </dependency> - - <!-- SE Common Swagger --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-swagger</artifactId> - </dependency> - - </dependencies> - - <build> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file diff --git a/se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java b/se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java deleted file mode 100644 index d853e56..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.se.file; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import com.se.common.swagger.annotation.EnableCustomSwagger2; - -/** - * 鏂囦欢鏈嶅姟 - * - * @author admin - */ -@EnableCustomSwagger2 -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) -public class SeFileApplication -{ - public static void main(String[] args) - { - SpringApplication.run(SeFileApplication.class, args); - System.out.println(" 鏂囦欢妯″潡鍚姩鎴愬姛 "); - } -} diff --git a/se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java b/se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java deleted file mode 100644 index bb02876..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.se.file.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import io.minio.MinioClient; - -/** - * Minio 閰嶇疆淇℃伅 - * - * @author admin - */ -@Configuration -@ConfigurationProperties(prefix = "minio") -public class MinioConfig -{ - /** - * 鏈嶅姟鍦板潃 - */ - private String url; - - /** - * 鐢ㄦ埛鍚� - */ - private String accessKey; - - /** - * 瀵嗙爜 - */ - private String secretKey; - - /** - * 瀛樺偍妗跺悕绉� - */ - private String bucketName; - - public String getUrl() - { - return url; - } - - public void setUrl(String url) - { - this.url = url; - } - - public String getAccessKey() - { - return accessKey; - } - - public void setAccessKey(String accessKey) - { - this.accessKey = accessKey; - } - - public String getSecretKey() - { - return secretKey; - } - - public void setSecretKey(String secretKey) - { - this.secretKey = secretKey; - } - - public String getBucketName() - { - return bucketName; - } - - public void setBucketName(String bucketName) - { - this.bucketName = bucketName; - } - - @Bean - public MinioClient getMinioClient() - { - return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); - } -} diff --git a/se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java b/se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java deleted file mode 100644 index bb0eebe..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.se.file.config; - -import java.io.File; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * 閫氱敤鏄犲皠閰嶇疆 - * - * @author admin - */ -@Configuration -public class ResourcesConfig implements WebMvcConfigurer -{ - /** - * 涓婁紶鏂囦欢瀛樺偍鍦ㄦ湰鍦扮殑鏍硅矾寰� - */ - @Value("${file.path}") - private String localFilePath; - - /** - * 璧勬簮鏄犲皠璺緞 鍓嶇紑 - */ - @Value("${file.prefix}") - public String localFilePrefix; - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) - { - /** 鏈湴鏂囦欢涓婁紶璺緞 */ - registry.addResourceHandler(localFilePrefix + "/**") - .addResourceLocations("file:" + localFilePath + File.separator); - } - - /** - * 寮�鍚法鍩� - */ - @Override - public void addCorsMappings(CorsRegistry registry) { - // 璁剧疆鍏佽璺ㄥ煙鐨勮矾鐢� - registry.addMapping(localFilePrefix + "/**") - // 璁剧疆鍏佽璺ㄥ煙璇锋眰鐨勫煙鍚� - .allowedOrigins("*") - // 璁剧疆鍏佽鐨勬柟娉� - .allowedMethods("GET"); - } -} \ No newline at end of file diff --git a/se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java b/se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java deleted file mode 100644 index e87c238..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.se.file.controller; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; -import com.se.common.core.domain.R; -import com.se.common.core.utils.file.FileUtils; -import com.se.file.service.ISysFileService; -import com.se.system.api.domain.SysFile; - -/** - * 鏂囦欢璇锋眰澶勭悊 - * - * @author admin - */ -@RestController -public class SysFileController -{ - private static final Logger log = LoggerFactory.getLogger(SysFileController.class); - - @Autowired - private ISysFileService sysFileService; - - /** - * 鏂囦欢涓婁紶璇锋眰 - */ - @PostMapping("upload") - public R<SysFile> upload(MultipartFile file) - { - try - { - // 涓婁紶骞惰繑鍥炶闂湴鍧� - String url = sysFileService.uploadFile(file); - SysFile sysFile = new SysFile(); - sysFile.setName(FileUtils.getName(url)); - sysFile.setUrl(url); - return R.ok(sysFile); - } - catch (Exception e) - { - log.error("涓婁紶鏂囦欢澶辫触", e); - return R.fail(e.getMessage()); - } - } -} \ No newline at end of file diff --git a/se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java deleted file mode 100644 index fa25b7b..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.se.file.service; - -import java.io.InputStream; -import com.alibaba.nacos.common.utils.IoUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; -import com.github.tobato.fastdfs.domain.fdfs.StorePath; -import com.github.tobato.fastdfs.service.FastFileStorageClient; -import com.se.common.core.utils.file.FileTypeUtils; - -/** - * FastDFS 鏂囦欢瀛樺偍 - * - * @author admin - */ -@Service -public class FastDfsSysFileServiceImpl implements ISysFileService -{ - /** - * 鍩熷悕鎴栨湰鏈鸿闂湴鍧� - */ - @Value("${fdfs.domain}") - public String domain; - - @Autowired - private FastFileStorageClient storageClient; - - /** - * FastDfs鏂囦欢涓婁紶鎺ュ彛 - * - * @param file 涓婁紶鐨勬枃浠� - * @return 璁块棶鍦板潃 - * @throws Exception - */ - @Override - public String uploadFile(MultipartFile file) throws Exception - { - InputStream inputStream = file.getInputStream(); - StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), - FileTypeUtils.getExtension(file), null); - IoUtils.closeQuietly(inputStream); - return domain + "/" + storePath.getFullPath(); - } -} diff --git a/se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java b/se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java deleted file mode 100644 index 9d4215e..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.se.file.service; - -import org.springframework.web.multipart.MultipartFile; - -/** - * 鏂囦欢涓婁紶鎺ュ彛 - * - * @author admin - */ -public interface ISysFileService -{ - /** - * 鏂囦欢涓婁紶鎺ュ彛 - * - * @param file 涓婁紶鐨勬枃浠� - * @return 璁块棶鍦板潃 - * @throws Exception - */ - public String uploadFile(MultipartFile file) throws Exception; -} diff --git a/se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java deleted file mode 100644 index 0ffaf52..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.se.file.service; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; -import com.se.file.utils.FileUploadUtils; - -/** - * 鏈湴鏂囦欢瀛樺偍 - * - * @author admin - */ -@Primary -@Service -public class LocalSysFileServiceImpl implements ISysFileService -{ - /** - * 璧勬簮鏄犲皠璺緞 鍓嶇紑 - */ - @Value("${file.prefix}") - public String localFilePrefix; - - /** - * 鍩熷悕鎴栨湰鏈鸿闂湴鍧� - */ - @Value("${file.domain}") - public String domain; - - /** - * 涓婁紶鏂囦欢瀛樺偍鍦ㄦ湰鍦扮殑鏍硅矾寰� - */ - @Value("${file.path}") - private String localFilePath; - - /** - * 鏈湴鏂囦欢涓婁紶鎺ュ彛 - * - * @param file 涓婁紶鐨勬枃浠� - * @return 璁块棶鍦板潃 - * @throws Exception - */ - @Override - public String uploadFile(MultipartFile file) throws Exception - { - String name = FileUploadUtils.upload(localFilePath, file); - String url = domain + localFilePrefix + name; - return url; - } -} diff --git a/se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java deleted file mode 100644 index cf7c1a1..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.se.file.service; - -import java.io.InputStream; - -import com.se.file.config.MinioConfig; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; -import com.alibaba.nacos.common.utils.IoUtils; -import com.se.file.utils.FileUploadUtils; -import io.minio.MinioClient; -import io.minio.PutObjectArgs; - -/** - * Minio 鏂囦欢瀛樺偍 - * - * @author admin - */ -@Service -public class MinioSysFileServiceImpl implements ISysFileService -{ - @Autowired - private MinioConfig minioConfig; - - @Autowired - private MinioClient client; - - /** - * Minio鏂囦欢涓婁紶鎺ュ彛 - * - * @param file 涓婁紶鐨勬枃浠� - * @return 璁块棶鍦板潃 - * @throws Exception - */ - @Override - public String uploadFile(MultipartFile file) throws Exception - { - String fileName = FileUploadUtils.extractFilename(file); - InputStream inputStream = file.getInputStream(); - PutObjectArgs args = PutObjectArgs.builder() - .bucket(minioConfig.getBucketName()) - .object(fileName) - .stream(inputStream, file.getSize(), -1) - .contentType(file.getContentType()) - .build(); - client.putObject(args); - IoUtils.closeQuietly(inputStream); - return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; - } -} diff --git a/se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java b/se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java deleted file mode 100644 index c51548d..0000000 --- a/se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.se.file.utils; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.Objects; -import org.apache.commons.io.FilenameUtils; -import org.springframework.web.multipart.MultipartFile; -import com.se.common.core.exception.file.FileException; -import com.se.common.core.exception.file.FileNameLengthLimitExceededException; -import com.se.common.core.exception.file.FileSizeLimitExceededException; -import com.se.common.core.exception.file.InvalidExtensionException; -import com.se.common.core.utils.DateUtils; -import com.se.common.core.utils.StringUtils; -import com.se.common.core.utils.file.FileTypeUtils; -import com.se.common.core.utils.file.MimeTypeUtils; -import com.se.common.core.utils.uuid.Seq; - -/** - * 鏂囦欢涓婁紶宸ュ叿绫� - * - * @author admin - */ -public class FileUploadUtils -{ - /** - * 榛樿澶у皬 50M - */ - public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; - - /** - * 榛樿鐨勬枃浠跺悕鏈�澶ч暱搴� 100 - */ - public static final int DEFAULT_FILE_NAME_LENGTH = 100; - - /** - * 鏍规嵁鏂囦欢璺緞涓婁紶 - * - * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍 - * @param file 涓婁紶鐨勬枃浠� - * @return 鏂囦欢鍚嶇О - * @throws IOException - */ - public static final String upload(String baseDir, MultipartFile file) throws IOException - { - try - { - return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - } - catch (FileException fe) - { - throw new IOException(fe.getDefaultMessage(), fe); - } - catch (Exception e) - { - throw new IOException(e.getMessage(), e); - } - } - - /** - * 鏂囦欢涓婁紶 - * - * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍 - * @param file 涓婁紶鐨勬枃浠� - * @param allowedExtension 涓婁紶鏂囦欢绫诲瀷 - * @return 杩斿洖涓婁紶鎴愬姛鐨勬枃浠跺悕 - * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏� - * @throws FileNameLengthLimitExceededException 鏂囦欢鍚嶅お闀� - * @throws IOException 姣斿璇诲啓鏂囦欢鍑洪敊鏃� - * @throws InvalidExtensionException 鏂囦欢鏍¢獙寮傚父 - */ - public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) - throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, - InvalidExtensionException - { - int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); - if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) - { - throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); - } - - assertAllowed(file, allowedExtension); - - String fileName = extractFilename(file); - - String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); - file.transferTo(Paths.get(absPath)); - return getPathFileName(fileName); - } - - /** - * 缂栫爜鏂囦欢鍚� - */ - public static final String extractFilename(MultipartFile file) - { - return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), - FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file)); - } - - private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException - { - File desc = new File(uploadDir + File.separator + fileName); - - if (!desc.exists()) - { - if (!desc.getParentFile().exists()) - { - desc.getParentFile().mkdirs(); - } - } - return desc.isAbsolute() ? desc : desc.getAbsoluteFile(); - } - - private static final String getPathFileName(String fileName) throws IOException - { - String pathFileName = "/" + fileName; - return pathFileName; - } - - /** - * 鏂囦欢澶у皬鏍¢獙 - * - * @param file 涓婁紶鐨勬枃浠� - * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏� - * @throws InvalidExtensionException 鏂囦欢鏍¢獙寮傚父 - */ - public static final void assertAllowed(MultipartFile file, String[] allowedExtension) - throws FileSizeLimitExceededException, InvalidExtensionException - { - long size = file.getSize(); - if (size > DEFAULT_MAX_SIZE) - { - throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); - } - - String fileName = file.getOriginalFilename(); - String extension = FileTypeUtils.getExtension(file); - if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) - { - if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) - { - throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, - fileName); - } - else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) - { - throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, - fileName); - } - else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) - { - throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, - fileName); - } - else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) - { - throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, - fileName); - } - else - { - throw new InvalidExtensionException(allowedExtension, extension, fileName); - } - } - } - - /** - * 鍒ゆ柇MIME绫诲瀷鏄惁鏄厑璁哥殑MIME绫诲瀷 - * - * @param extension 涓婁紶鏂囦欢绫诲瀷 - * @param allowedExtension 鍏佽涓婁紶鏂囦欢绫诲瀷 - * @return true/false - */ - public static final boolean isAllowedExtension(String extension, String[] allowedExtension) - { - for (String str : allowedExtension) - { - if (str.equalsIgnoreCase(extension)) - { - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/se-modules/se-file/src/main/resources/banner.txt b/se-modules/se-file/src/main/resources/banner.txt deleted file mode 100644 index 9504136..0000000 --- a/se-modules/se-file/src/main/resources/banner.txt +++ /dev/null @@ -1,3 +0,0 @@ -Spring Boot Version: ${spring-boot.version} -Spring Application Name: ${spring.application.name} -SeFileApplication锛屽凡缁忓惎鍔� \ No newline at end of file diff --git a/se-modules/se-file/src/main/resources/bootstrap.yml b/se-modules/se-file/src/main/resources/bootstrap.yml deleted file mode 100644 index 3204f87..0000000 --- a/se-modules/se-file/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Tomcat -server: - port: 9300 - -# Spring -spring: - application: - # 搴旂敤鍚嶇О - name: se-file - profiles: - # 鐜閰嶇疆 - active: dev - cloud: - nacos: - username: nacos - password: nAcos_!9#_admIn - discovery: - # 鏈嶅姟娉ㄥ唽鍦板潃 - server-addr: 127.0.0.1:8848 - config: - # 閰嶇疆涓績鍦板潃 - server-addr: 127.0.0.1:8848 - # 閰嶇疆鏂囦欢鏍煎紡 - file-extension: yml - # 鍏变韩閰嶇疆 - shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/se-modules/se-file/src/main/resources/logback.xml b/se-modules/se-file/src/main/resources/logback.xml deleted file mode 100644 index 46941d6..0000000 --- a/se-modules/se-file/src/main/resources/logback.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration scan="true" scanPeriod="60 seconds" debug="false"> - <!-- 鏃ュ織瀛樻斁璺緞 --> - <property name="log.path" value="logs/se-file" /> - <!-- 鏃ュ織杈撳嚭鏍煎紡 --> - <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> - - <!-- 鎺у埗鍙拌緭鍑� --> - <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - </appender> - - <!-- 绯荤粺鏃ュ織杈撳嚭 --> - <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/info.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>INFO</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/error.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>ERROR</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 --> - <logger name="com.se" level="info" /> - <!-- Spring鏃ュ織绾у埆鎺у埗 --> - <logger name="org.springframework" level="warn" /> - - <root level="info"> - <appender-ref ref="console" /> - </root> - - <!--绯荤粺鎿嶄綔鏃ュ織--> - <root level="info"> - <appender-ref ref="file_info" /> - <appender-ref ref="file_error" /> - </root> -</configuration> \ No newline at end of file diff --git a/se-modules/se-gen/pom.xml b/se-modules/se-gen/pom.xml deleted file mode 100644 index bf25817..0000000 --- a/se-modules/se-gen/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>com.se</groupId> - <artifactId>se-modules</artifactId> - <version>3.6.4</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>se-modules-gen</artifactId> - - <description> - se-modules-gen浠g爜鐢熸垚 - </description> - - <dependencies> - - <!-- SpringCloud Alibaba Nacos --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Nacos Config --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Sentinel --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> - </dependency> - - <!-- SpringBoot Actuator --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - - <!-- Swagger UI --> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger-ui</artifactId> - <version>${swagger.fox.version}</version> - </dependency> - - <!-- Apache Velocity --> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity-engine-core</artifactId> - </dependency> - - <!-- Mysql Connector --> - <dependency> - <groupId>com.mysql</groupId> - <artifactId>mysql-connector-j</artifactId> - </dependency> - - <!-- SE Common Log --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-log</artifactId> - </dependency> - - <!-- SE Common Swagger --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-swagger</artifactId> - </dependency> - - </dependencies> - - <build> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file diff --git a/se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java b/se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java deleted file mode 100644 index 8094ee0..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.se.gen; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import com.se.common.security.annotation.EnableCustomConfig; -import com.se.common.security.annotation.EnableRyFeignClients; -import com.se.common.swagger.annotation.EnableCustomSwagger2; - -/** - * 浠g爜鐢熸垚 - * - * @author admin - */ -@EnableCustomConfig -@EnableCustomSwagger2 -@EnableRyFeignClients -@SpringBootApplication -public class SeGenApplication -{ - public static void main(String[] args) - { - SpringApplication.run(SeGenApplication.class, args); - System.out.println(" 浠g爜鐢熸垚妯″潡鍚姩鎴愬姛 "); - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java b/se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java deleted file mode 100644 index 28143c1..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.se.gen.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 浠g爜鐢熸垚鐩稿叧閰嶇疆 - * - * @author admin - */ -@Component -@ConfigurationProperties(prefix = "gen") -public class GenConfig -{ - /** 浣滆�� */ - public static String author; - - /** 鐢熸垚鍖呰矾寰� */ - public static String packageName; - - /** 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false */ - public static boolean autoRemovePre; - - /** 琛ㄥ墠缂�(绫诲悕涓嶄細鍖呭惈琛ㄥ墠缂�) */ - public static String tablePrefix; - - public static String getAuthor() - { - return author; - } - - public void setAuthor(String author) - { - GenConfig.author = author; - } - - public static String getPackageName() - { - return packageName; - } - - public void setPackageName(String packageName) - { - GenConfig.packageName = packageName; - } - - public static boolean getAutoRemovePre() - { - return autoRemovePre; - } - - public void setAutoRemovePre(boolean autoRemovePre) - { - GenConfig.autoRemovePre = autoRemovePre; - } - - public static String getTablePrefix() - { - return tablePrefix; - } - - public void setTablePrefix(String tablePrefix) - { - GenConfig.tablePrefix = tablePrefix; - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java b/se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java deleted file mode 100644 index 7a5dc12..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.se.gen.controller; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletResponse; - -import com.se.gen.domain.GenTableColumn; -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.se.common.core.text.Convert; -import com.se.common.core.web.controller.BaseController; -import com.se.common.core.web.domain.AjaxResult; -import com.se.common.core.web.page.TableDataInfo; -import com.se.common.log.annotation.Log; -import com.se.common.log.enums.BusinessType; -import com.se.common.security.annotation.RequiresPermissions; -import com.se.gen.domain.GenTable; -import com.se.gen.service.IGenTableColumnService; -import com.se.gen.service.IGenTableService; - -/** - * 浠g爜鐢熸垚 鎿嶄綔澶勭悊 - * - * @author admin - */ -@RequestMapping("/gen") -@RestController -public class GenController extends BaseController -{ - @Autowired - private IGenTableService genTableService; - - @Autowired - private IGenTableColumnService genTableColumnService; - - /** - * 鏌ヨ浠g爜鐢熸垚鍒楄〃 - */ - @RequiresPermissions("tool:gen:list") - @GetMapping("/list") - public TableDataInfo genList(GenTable genTable) - { - startPage(); - List<GenTable> list = genTableService.selectGenTableList(genTable); - return getDataTable(list); - } - - /** - * 淇敼浠g爜鐢熸垚涓氬姟 - */ - @RequiresPermissions("tool:gen:query") - @GetMapping(value = "/{tableId}") - public AjaxResult getInfo(@PathVariable Long tableId) - { - GenTable table = genTableService.selectGenTableById(tableId); - List<GenTable> tables = genTableService.selectGenTableAll(); - List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); - Map<String, Object> map = new HashMap<String, Object>(); - map.put("info", table); - map.put("rows", list); - map.put("tables", tables); - return success(map); - } - - /** - * 鏌ヨ鏁版嵁搴撳垪琛� - */ - @RequiresPermissions("tool:gen:list") - @GetMapping("/db/list") - public TableDataInfo dataList(GenTable genTable) - { - startPage(); - List<GenTable> list = genTableService.selectDbTableList(genTable); - return getDataTable(list); - } - - /** - * 鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛� - */ - @GetMapping(value = "/column/{tableId}") - public TableDataInfo columnList(Long tableId) - { - TableDataInfo dataInfo = new TableDataInfo(); - List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); - dataInfo.setRows(list); - dataInfo.setTotal(list.size()); - return dataInfo; - } - - /** - * 瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛� - */ - @RequiresPermissions("tool:gen:import") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT) - @PostMapping("/importTable") - public AjaxResult importTableSave(String tables) - { - String[] tableNames = Convert.toStrArray(tables); - // 鏌ヨ琛ㄤ俊鎭� - List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames); - genTableService.importGenTable(tableList); - return success(); - } - - /** - * 淇敼淇濆瓨浠g爜鐢熸垚涓氬姟 - */ - @RequiresPermissions("tool:gen:edit") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) - { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return success(); - } - - /** - * 鍒犻櫎浠g爜鐢熸垚 - */ - @RequiresPermissions("tool:gen:remove") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE) - @DeleteMapping("/{tableIds}") - public AjaxResult remove(@PathVariable Long[] tableIds) - { - genTableService.deleteGenTableByIds(tableIds); - return success(); - } - - /** - * 棰勮浠g爜 - */ - @RequiresPermissions("tool:gen:preview") - @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException - { - Map<String, String> dataMap = genTableService.previewCode(tableId); - return success(dataMap); - } - - /** - * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 - */ - @RequiresPermissions("tool:gen:code") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) - @GetMapping("/download/{tableName}") - public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException - { - byte[] data = genTableService.downloadCode(tableName); - genCode(response, data); - } - - /** - * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� - */ - @RequiresPermissions("tool:gen:code") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) - @GetMapping("/genCode/{tableName}") - public AjaxResult genCode(@PathVariable("tableName") String tableName) - { - genTableService.generatorCode(tableName); - return success(); - } - - /** - * 鍚屾鏁版嵁搴� - */ - @RequiresPermissions("tool:gen:edit") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE) - @GetMapping("/synchDb/{tableName}") - public AjaxResult synchDb(@PathVariable("tableName") String tableName) - { - genTableService.synchDb(tableName); - return success(); - } - - /** - * 鎵归噺鐢熸垚浠g爜 - */ - @RequiresPermissions("tool:gen:code") - @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) - @GetMapping("/batchGenCode") - public void batchGenCode(HttpServletResponse response, String tables) throws IOException - { - String[] tableNames = Convert.toStrArray(tables); - byte[] data = genTableService.downloadCode(tableNames); - genCode(response, data); - } - - /** - * 鐢熸垚zip鏂囦欢 - */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException - { - response.reset(); - response.setHeader("Content-Disposition", "attachment; filename=\"se.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java b/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java deleted file mode 100644 index 7878289..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java +++ /dev/null @@ -1,383 +0,0 @@ -package com.se.gen.domain; - -import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import org.apache.commons.lang3.ArrayUtils; -import com.se.common.core.constant.GenConstants; -import com.se.common.core.utils.StringUtils; -import com.se.common.core.web.domain.BaseEntity; - -/** - * 涓氬姟琛� gen_table - * - * @author admin - */ -public class GenTable extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 缂栧彿 */ - private Long tableId; - - /** 琛ㄥ悕绉� */ - @NotBlank(message = "琛ㄥ悕绉颁笉鑳戒负绌�") - private String tableName; - - /** 琛ㄦ弿杩� */ - @NotBlank(message = "琛ㄦ弿杩颁笉鑳戒负绌�") - private String tableComment; - - /** 鍏宠仈鐖惰〃鐨勮〃鍚� */ - private String subTableName; - - /** 鏈〃鍏宠仈鐖惰〃鐨勫閿悕 */ - private String subTableFkName; - - /** 瀹炰綋绫诲悕绉�(棣栧瓧姣嶅ぇ鍐�) */ - @NotBlank(message = "瀹炰綋绫诲悕绉颁笉鑳戒负绌�") - private String className; - - /** 浣跨敤鐨勬ā鏉匡紙crud鍗曡〃鎿嶄綔 tree鏍戣〃鎿嶄綔 sub涓诲瓙琛ㄦ搷浣滐級 */ - private String tplCategory; - - /** 鍓嶇绫诲瀷锛坋lement-ui妯$増 element-plus妯$増锛� */ - private String tplWebType; - - /** 鐢熸垚鍖呰矾寰� */ - @NotBlank(message = "鐢熸垚鍖呰矾寰勪笉鑳戒负绌�") - private String packageName; - - /** 鐢熸垚妯″潡鍚� */ - @NotBlank(message = "鐢熸垚妯″潡鍚嶄笉鑳戒负绌�") - private String moduleName; - - /** 鐢熸垚涓氬姟鍚� */ - @NotBlank(message = "鐢熸垚涓氬姟鍚嶄笉鑳戒负绌�") - private String businessName; - - /** 鐢熸垚鍔熻兘鍚� */ - @NotBlank(message = "鐢熸垚鍔熻兘鍚嶄笉鑳戒负绌�") - private String functionName; - - /** 鐢熸垚浣滆�� */ - @NotBlank(message = "浣滆�呬笉鑳戒负绌�") - private String functionAuthor; - - /** 鐢熸垚浠g爜鏂瑰紡锛�0zip鍘嬬缉鍖� 1鑷畾涔夎矾寰勶級 */ - private String genType; - - /** 鐢熸垚璺緞锛堜笉濉粯璁ら」鐩矾寰勶級 */ - private String genPath; - - /** 涓婚敭淇℃伅 */ - private GenTableColumn pkColumn; - - /** 瀛愯〃淇℃伅 */ - private GenTable subTable; - - /** 琛ㄥ垪淇℃伅 */ - @Valid - private List<GenTableColumn> columns; - - /** 鍏跺畠鐢熸垚閫夐」 */ - private String options; - - /** 鏍戠紪鐮佸瓧娈� */ - private String treeCode; - - /** 鏍戠埗缂栫爜瀛楁 */ - private String treeParentCode; - - /** 鏍戝悕绉板瓧娈� */ - private String treeName; - - /** 涓婄骇鑿滃崟ID瀛楁 */ - private String parentMenuId; - - /** 涓婄骇鑿滃崟鍚嶇О瀛楁 */ - private String parentMenuName; - - public Long getTableId() - { - return tableId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public String getTableName() - { - return tableName; - } - - public void setTableName(String tableName) - { - this.tableName = tableName; - } - - public String getTableComment() - { - return tableComment; - } - - public void setTableComment(String tableComment) - { - this.tableComment = tableComment; - } - - public String getSubTableName() - { - return subTableName; - } - - public void setSubTableName(String subTableName) - { - this.subTableName = subTableName; - } - - public String getSubTableFkName() - { - return subTableFkName; - } - - public void setSubTableFkName(String subTableFkName) - { - this.subTableFkName = subTableFkName; - } - - public String getClassName() - { - return className; - } - - public void setClassName(String className) - { - this.className = className; - } - - public String getTplCategory() - { - return tplCategory; - } - - public void setTplCategory(String tplCategory) - { - this.tplCategory = tplCategory; - } - - public String getTplWebType() - { - return tplWebType; - } - - public void setTplWebType(String tplWebType) - { - this.tplWebType = tplWebType; - } - - public String getPackageName() - { - return packageName; - } - - public void setPackageName(String packageName) - { - this.packageName = packageName; - } - - public String getModuleName() - { - return moduleName; - } - - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public String getBusinessName() - { - return businessName; - } - - public void setBusinessName(String businessName) - { - this.businessName = businessName; - } - - public String getFunctionName() - { - return functionName; - } - - public void setFunctionName(String functionName) - { - this.functionName = functionName; - } - - public String getFunctionAuthor() - { - return functionAuthor; - } - - public void setFunctionAuthor(String functionAuthor) - { - this.functionAuthor = functionAuthor; - } - - public String getGenType() - { - return genType; - } - - public void setGenType(String genType) - { - this.genType = genType; - } - - public String getGenPath() - { - return genPath; - } - - public void setGenPath(String genPath) - { - this.genPath = genPath; - } - - public GenTableColumn getPkColumn() - { - return pkColumn; - } - - public void setPkColumn(GenTableColumn pkColumn) - { - this.pkColumn = pkColumn; - } - - public GenTable getSubTable() - { - return subTable; - } - - public void setSubTable(GenTable subTable) - { - this.subTable = subTable; - } - public List<GenTableColumn> getColumns() - { - return columns; - } - - public void setColumns(List<GenTableColumn> columns) - { - this.columns = columns; - } - - public String getOptions() - { - return options; - } - - public void setOptions(String options) - { - this.options = options; - } - - public String getTreeCode() - { - return treeCode; - } - - public void setTreeCode(String treeCode) - { - this.treeCode = treeCode; - } - - public String getTreeParentCode() - { - return treeParentCode; - } - - public void setTreeParentCode(String treeParentCode) - { - this.treeParentCode = treeParentCode; - } - - public String getTreeName() - { - return treeName; - } - - public void setTreeName(String treeName) - { - this.treeName = treeName; - } - - public String getParentMenuId() - { - return parentMenuId; - } - - public void setParentMenuId(String parentMenuId) - { - this.parentMenuId = parentMenuId; - } - - public String getParentMenuName() - { - return parentMenuName; - } - - public void setParentMenuName(String parentMenuName) - { - this.parentMenuName = parentMenuName; - } - - public boolean isSub() - { - return isSub(this.tplCategory); - } - - public static boolean isSub(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); - } - public boolean isTree() - { - return isTree(this.tplCategory); - } - - public static boolean isTree(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); - } - - public boolean isCrud() - { - return isCrud(this.tplCategory); - } - - public static boolean isCrud(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); - } - - public boolean isSuperColumn(String javaField) - { - return isSuperColumn(this.tplCategory, javaField); - } - - public static boolean isSuperColumn(String tplCategory, String javaField) - { - if (isTree(tplCategory)) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); - } - return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java b/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java deleted file mode 100644 index 36200be..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java +++ /dev/null @@ -1,374 +0,0 @@ -package com.se.gen.domain; - -import javax.validation.constraints.NotBlank; - -import com.se.common.core.utils.StringUtils; -import com.se.common.core.web.domain.BaseEntity; - -/** - * 浠g爜鐢熸垚涓氬姟瀛楁琛� gen_table_column - * - * @author admin - */ -public class GenTableColumn extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 缂栧彿 */ - private Long columnId; - - /** 褰掑睘琛ㄧ紪鍙� */ - private Long tableId; - - /** 鍒楀悕绉� */ - private String columnName; - - /** 鍒楁弿杩� */ - private String columnComment; - - /** 鍒楃被鍨� */ - private String columnType; - - /** JAVA绫诲瀷 */ - private String javaType; - - /** JAVA瀛楁鍚� */ - @NotBlank(message = "Java灞炴�т笉鑳戒负绌�") - private String javaField; - - /** 鏄惁涓婚敭锛�1鏄級 */ - private String isPk; - - /** 鏄惁鑷锛�1鏄級 */ - private String isIncrement; - - /** 鏄惁蹇呭~锛�1鏄級 */ - private String isRequired; - - /** 鏄惁涓烘彃鍏ュ瓧娈碉紙1鏄級 */ - private String isInsert; - - /** 鏄惁缂栬緫瀛楁锛�1鏄級 */ - private String isEdit; - - /** 鏄惁鍒楄〃瀛楁锛�1鏄級 */ - private String isList; - - /** 鏄惁鏌ヨ瀛楁锛�1鏄級 */ - private String isQuery; - - /** 鏌ヨ鏂瑰紡锛圗Q绛変簬銆丯E涓嶇瓑浜庛�丟T澶т簬銆丩T灏忎簬銆丩IKE妯$硦銆丅ETWEEN鑼冨洿锛� */ - private String queryType; - - /** 鏄剧ず绫诲瀷锛坕nput鏂囨湰妗嗐�乼extarea鏂囨湰鍩熴�乻elect涓嬫媺妗嗐�乧heckbox澶嶉�夋銆乺adio鍗曢�夋銆乨atetime鏃ユ湡鎺т欢銆乮mage鍥剧墖涓婁紶鎺т欢銆乽pload鏂囦欢涓婁紶鎺т欢銆乪ditor瀵屾枃鏈帶浠讹級 */ - private String htmlType; - - /** 瀛楀吀绫诲瀷 */ - private String dictType; - - /** 鎺掑簭 */ - private Integer sort; - - public void setColumnId(Long columnId) - { - this.columnId = columnId; - } - - public Long getColumnId() - { - return columnId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public Long getTableId() - { - return tableId; - } - - public void setColumnName(String columnName) - { - this.columnName = columnName; - } - - public String getColumnName() - { - return columnName; - } - - public void setColumnComment(String columnComment) - { - this.columnComment = columnComment; - } - - public String getColumnComment() - { - return columnComment; - } - - public void setColumnType(String columnType) - { - this.columnType = columnType; - } - - public String getColumnType() - { - return columnType; - } - - public void setJavaType(String javaType) - { - this.javaType = javaType; - } - - public String getJavaType() - { - return javaType; - } - - public void setJavaField(String javaField) - { - this.javaField = javaField; - } - - public String getJavaField() - { - return javaField; - } - - public String getCapJavaField() - { - return StringUtils.capitalize(javaField); - } - - public void setIsPk(String isPk) - { - this.isPk = isPk; - } - - public String getIsPk() - { - return isPk; - } - - public boolean isPk() - { - return isPk(this.isPk); - } - - public boolean isPk(String isPk) - { - return isPk != null && StringUtils.equals("1", isPk); - } - - public String getIsIncrement() - { - return isIncrement; - } - - public void setIsIncrement(String isIncrement) - { - this.isIncrement = isIncrement; - } - - public boolean isIncrement() - { - return isIncrement(this.isIncrement); - } - - public boolean isIncrement(String isIncrement) - { - return isIncrement != null && StringUtils.equals("1", isIncrement); - } - - public void setIsRequired(String isRequired) - { - this.isRequired = isRequired; - } - - public String getIsRequired() - { - return isRequired; - } - - public boolean isRequired() - { - return isRequired(this.isRequired); - } - - public boolean isRequired(String isRequired) - { - return isRequired != null && StringUtils.equals("1", isRequired); - } - - public void setIsInsert(String isInsert) - { - this.isInsert = isInsert; - } - - public String getIsInsert() - { - return isInsert; - } - - public boolean isInsert() - { - return isInsert(this.isInsert); - } - - public boolean isInsert(String isInsert) - { - return isInsert != null && StringUtils.equals("1", isInsert); - } - - public void setIsEdit(String isEdit) - { - this.isEdit = isEdit; - } - - public String getIsEdit() - { - return isEdit; - } - - public boolean isEdit() - { - return isInsert(this.isEdit); - } - - public boolean isEdit(String isEdit) - { - return isEdit != null && StringUtils.equals("1", isEdit); - } - - public void setIsList(String isList) - { - this.isList = isList; - } - - public String getIsList() - { - return isList; - } - - public boolean isList() - { - return isList(this.isList); - } - - public boolean isList(String isList) - { - return isList != null && StringUtils.equals("1", isList); - } - - public void setIsQuery(String isQuery) - { - this.isQuery = isQuery; - } - - public String getIsQuery() - { - return isQuery; - } - - public boolean isQuery() - { - return isQuery(this.isQuery); - } - - public boolean isQuery(String isQuery) - { - return isQuery != null && StringUtils.equals("1", isQuery); - } - - public void setQueryType(String queryType) - { - this.queryType = queryType; - } - - public String getQueryType() - { - return queryType; - } - - public String getHtmlType() - { - return htmlType; - } - - public void setHtmlType(String htmlType) - { - this.htmlType = htmlType; - } - - public void setDictType(String dictType) - { - this.dictType = dictType; - } - - public String getDictType() - { - return dictType; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public boolean isSuperColumn() - { - return isSuperColumn(this.javaField); - } - - public static boolean isSuperColumn(String javaField) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", - // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); - } - - public boolean isUsableColumn() - { - return isUsableColumn(javaField); - } - - public static boolean isUsableColumn(String javaField) - { - // isSuperColumn()涓殑鍚嶅崟鐢ㄤ簬閬垮厤鐢熸垚澶氫綑Domain灞炴�э紝鑻ユ煇浜涘睘鎬у湪鐢熸垚椤甸潰鏃堕渶瑕佺敤鍒颁笉鑳藉拷鐣ワ紝鍒欐斁鍦ㄦ澶勭櫧鍚嶅崟 - return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); - } - - public String readConverterExp() - { - String remarks = StringUtils.substringBetween(this.columnComment, "锛�", "锛�"); - StringBuffer sb = new StringBuffer(); - if (StringUtils.isNotEmpty(remarks)) - { - for (String value : remarks.split(" ")) - { - if (StringUtils.isNotEmpty(value)) - { - Object startStr = value.subSequence(0, 1); - String endStr = value.substring(1); - sb.append("").append(startStr).append("=").append(endStr).append(","); - } - } - return sb.deleteCharAt(sb.length() - 1).toString(); - } - else - { - return this.columnComment; - } - } -} \ No newline at end of file diff --git a/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java b/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java deleted file mode 100644 index 9e8aca2..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.se.gen.mapper; - -import java.util.List; -import com.se.gen.domain.GenTableColumn; - -/** - * 涓氬姟瀛楁 鏁版嵁灞� - * - * @author admin - */ -public interface GenTableColumnMapper -{ - /** - * 鏍规嵁琛ㄥ悕绉版煡璇㈠垪淇℃伅 - * - * @param tableName 琛ㄥ悕绉� - * @return 鍒椾俊鎭� - */ - public List<GenTableColumn> selectDbTableColumnsByName(String tableName); - - /** - * 鏌ヨ涓氬姟瀛楁鍒楄〃 - * - * @param tableId 涓氬姟瀛楁缂栧彿 - * @return 涓氬姟瀛楁闆嗗悎 - */ - public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); - - /** - * 鏂板涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 淇敼涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 鍒犻櫎涓氬姟瀛楁 - * - * @param genTableColumns 鍒楁暟鎹� - * @return 缁撴灉 - */ - public int deleteGenTableColumns(List<GenTableColumn> genTableColumns); - - /** - * 鎵归噺鍒犻櫎涓氬姟瀛楁 - * - * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID - * @return 缁撴灉 - */ - public int deleteGenTableColumnByIds(Long[] ids); -} \ No newline at end of file diff --git a/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java b/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java deleted file mode 100644 index 0f781b4..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.se.gen.mapper; - -import java.util.List; -import com.se.gen.domain.GenTable; - -/** - * 涓氬姟 鏁版嵁灞� - * - * @author admin - */ -public interface GenTableMapper -{ - /** - * 鏌ヨ涓氬姟鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 涓氬姟闆嗗悎 - */ - public List<GenTable> selectGenTableList(GenTable genTable); - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - public List<GenTable> selectDbTableList(GenTable genTable); - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param tableNames 琛ㄥ悕绉扮粍 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - public List<GenTable> selectDbTableListByNames(String[] tableNames); - - /** - * 鏌ヨ鎵�鏈夎〃淇℃伅 - * - * @return 琛ㄤ俊鎭泦鍚� - */ - public List<GenTable> selectGenTableAll(); - - /** - * 鏌ヨ琛↖D涓氬姟淇℃伅 - * - * @param id 涓氬姟ID - * @return 涓氬姟淇℃伅 - */ - public GenTable selectGenTableById(Long id); - - /** - * 鏌ヨ琛ㄥ悕绉颁笟鍔′俊鎭� - * - * @param tableName 琛ㄥ悕绉� - * @return 涓氬姟淇℃伅 - */ - public GenTable selectGenTableByName(String tableName); - - /** - * 鏂板涓氬姟 - * - * @param genTable 涓氬姟淇℃伅 - * @return 缁撴灉 - */ - public int insertGenTable(GenTable genTable); - - /** - * 淇敼涓氬姟 - * - * @param genTable 涓氬姟淇℃伅 - * @return 缁撴灉 - */ - public int updateGenTable(GenTable genTable); - - /** - * 鎵归噺鍒犻櫎涓氬姟 - * - * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID - * @return 缁撴灉 - */ - public int deleteGenTableByIds(Long[] ids); -} \ No newline at end of file diff --git a/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java b/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java deleted file mode 100644 index 9eb75e4..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.se.gen.service; - -import java.util.List; - -import com.se.gen.domain.GenTableColumn; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.se.common.core.text.Convert; -import com.se.gen.mapper.GenTableColumnMapper; - -/** - * 涓氬姟瀛楁 鏈嶅姟灞傚疄鐜� - * - * @author admin - */ -@Service -public class GenTableColumnServiceImpl implements IGenTableColumnService -{ - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 鏌ヨ涓氬姟瀛楁鍒楄〃 - * - * @param tableId 涓氬姟瀛楁缂栧彿 - * @return 涓氬姟瀛楁闆嗗悎 - */ - @Override - public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) - { - return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); - } - - /** - * 鏂板涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 淇敼涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); - } - - /** - * 鍒犻櫎涓氬姟瀛楁瀵硅薄 - * - * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID - * @return 缁撴灉 - */ - @Override - public int deleteGenTableColumnByIds(String ids) - { - return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); - } -} \ No newline at end of file diff --git a/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java b/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java deleted file mode 100644 index e636ad8..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java +++ /dev/null @@ -1,522 +0,0 @@ -package com.se.gen.service; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import com.se.gen.domain.GenTableColumn; -import com.se.gen.util.GenUtils; -import com.se.gen.util.VelocityInitializer; -import com.se.gen.util.VelocityUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.se.common.core.constant.Constants; -import com.se.common.core.constant.GenConstants; -import com.se.common.core.exception.ServiceException; -import com.se.common.core.text.CharsetKit; -import com.se.common.core.utils.StringUtils; -import com.se.common.security.utils.SecurityUtils; -import com.se.gen.domain.GenTable; -import com.se.gen.mapper.GenTableColumnMapper; -import com.se.gen.mapper.GenTableMapper; - -/** - * 涓氬姟 鏈嶅姟灞傚疄鐜� - * - * @author admin - */ -@Service -public class GenTableServiceImpl implements IGenTableService -{ - private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); - - @Autowired - private GenTableMapper genTableMapper; - - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 鏌ヨ涓氬姟淇℃伅 - * - * @param id 涓氬姟ID - * @return 涓氬姟淇℃伅 - */ - @Override - public GenTable selectGenTableById(Long id) - { - GenTable genTable = genTableMapper.selectGenTableById(id); - setTableFromOptions(genTable); - return genTable; - } - - /** - * 鏌ヨ涓氬姟鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 涓氬姟闆嗗悎 - */ - @Override - public List<GenTable> selectGenTableList(GenTable genTable) - { - return genTableMapper.selectGenTableList(genTable); - } - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - @Override - public List<GenTable> selectDbTableList(GenTable genTable) - { - return genTableMapper.selectDbTableList(genTable); - } - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param tableNames 琛ㄥ悕绉扮粍 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - @Override - public List<GenTable> selectDbTableListByNames(String[] tableNames) - { - return genTableMapper.selectDbTableListByNames(tableNames); - } - - /** - * 鏌ヨ鎵�鏈夎〃淇℃伅 - * - * @return 琛ㄤ俊鎭泦鍚� - */ - @Override - public List<GenTable> selectGenTableAll() - { - return genTableMapper.selectGenTableAll(); - } - - /** - * 淇敼涓氬姟 - * - * @param genTable 涓氬姟淇℃伅 - * @return 缁撴灉 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void updateGenTable(GenTable genTable) - { - String options = JSON.toJSONString(genTable.getParams()); - genTable.setOptions(options); - int row = genTableMapper.updateGenTable(genTable); - if (row > 0) - { - for (GenTableColumn cenTableColumn : genTable.getColumns()) - { - genTableColumnMapper.updateGenTableColumn(cenTableColumn); - } - } - } - - /** - * 鍒犻櫎涓氬姟瀵硅薄 - * - * @param tableIds 闇�瑕佸垹闄ょ殑鏁版嵁ID - * @return 缁撴灉 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteGenTableByIds(Long[] tableIds) - { - genTableMapper.deleteGenTableByIds(tableIds); - genTableColumnMapper.deleteGenTableColumnByIds(tableIds); - } - - /** - * 瀵煎叆琛ㄧ粨鏋� - * - * @param tableList 瀵煎叆琛ㄥ垪琛� - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void importGenTable(List<GenTable> tableList) - { - String operName = SecurityUtils.getUsername(); - try - { - for (GenTable table : tableList) - { - String tableName = table.getTableName(); - GenUtils.initTable(table, operName); - int row = genTableMapper.insertGenTable(table); - if (row > 0) - { - // 淇濆瓨鍒椾俊鎭� - List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - for (GenTableColumn column : genTableColumns) - { - GenUtils.initColumnField(column, table); - genTableColumnMapper.insertGenTableColumn(column); - } - } - } - } - catch (Exception e) - { - throw new ServiceException("瀵煎叆澶辫触锛�" + e.getMessage()); - } - } - - /** - * 棰勮浠g爜 - * - * @param tableId 琛ㄧ紪鍙� - * @return 棰勮鏁版嵁鍒楄〃 - */ - @Override - public Map<String, String> previewCode(Long tableId) - { - Map<String, String> dataMap = new LinkedHashMap<>(); - // 鏌ヨ琛ㄤ俊鎭� - GenTable table = genTableMapper.selectGenTableById(tableId); - // 璁剧疆涓诲瓙琛ㄤ俊鎭� - setSubTable(table); - // 璁剧疆涓婚敭鍒椾俊鎭� - setPkColumn(table); - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 鑾峰彇妯℃澘鍒楄〃 - List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); - for (String template : templates) - { - // 娓叉煋妯℃澘 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - dataMap.put(template, sw.toString()); - } - return dataMap; - } - - /** - * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 - * - * @param tableName 琛ㄥ悕绉� - * @return 鏁版嵁 - */ - @Override - public byte[] downloadCode(String tableName) - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - generatorCode(tableName, zip); - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - /** - * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� - * - * @param tableName 琛ㄥ悕绉� - */ - @Override - public void generatorCode(String tableName) - { - // 鏌ヨ琛ㄤ俊鎭� - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 璁剧疆涓诲瓙琛ㄤ俊鎭� - setSubTable(table); - // 璁剧疆涓婚敭鍒椾俊鎭� - setPkColumn(table); - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 鑾峰彇妯℃澘鍒楄〃 - List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); - for (String template : templates) - { - if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) - { - // 娓叉煋妯℃澘 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try - { - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); - } - catch (IOException e) - { - throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); - } - } - } - } - - /** - * 鍚屾鏁版嵁搴� - * - * @param tableName 琛ㄥ悕绉� - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void synchDb(String tableName) - { - GenTable table = genTableMapper.selectGenTableByName(tableName); - List<GenTableColumn> tableColumns = table.getColumns(); - Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity())); - - List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - if (StringUtils.isEmpty(dbTableColumns)) - { - throw new ServiceException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪"); - } - List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - dbTableColumns.forEach(column -> { - GenUtils.initColumnField(column, table); - if (tableColumnMap.containsKey(column.getColumnName())) - { - GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName()); - column.setColumnId(prevColumn.getColumnId()); - if (column.isList()) - { - // 濡傛灉鏄垪琛紝缁х画淇濈暀鏌ヨ鏂瑰紡/瀛楀吀绫诲瀷閫夐」 - column.setDictType(prevColumn.getDictType()); - column.setQueryType(prevColumn.getQueryType()); - } - if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() - && (column.isInsert() || column.isEdit()) - && ((column.isUsableColumn()) || (!column.isSuperColumn()))) - { - // 濡傛灉鏄�(鏂板/淇敼&闈炰富閿�/闈炲拷鐣ュ強鐖跺睘鎬�)锛岀户缁繚鐣欏繀濉�/鏄剧ず绫诲瀷閫夐」 - column.setIsRequired(prevColumn.getIsRequired()); - column.setHtmlType(prevColumn.getHtmlType()); - } - genTableColumnMapper.updateGenTableColumn(column); - } - else - { - genTableColumnMapper.insertGenTableColumn(column); - } - }); - - List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); - if (StringUtils.isNotEmpty(delColumns)) - { - genTableColumnMapper.deleteGenTableColumns(delColumns); - } - } - - /** - * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 - * - * @param tableNames 琛ㄦ暟缁� - * @return 鏁版嵁 - */ - @Override - public byte[] downloadCode(String[] tableNames) - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - for (String tableName : tableNames) - { - generatorCode(tableName, zip); - } - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - /** - * 鏌ヨ琛ㄤ俊鎭苟鐢熸垚浠g爜 - */ - private void generatorCode(String tableName, ZipOutputStream zip) - { - // 鏌ヨ琛ㄤ俊鎭� - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 璁剧疆涓诲瓙琛ㄤ俊鎭� - setSubTable(table); - // 璁剧疆涓婚敭鍒椾俊鎭� - setPkColumn(table); - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 鑾峰彇妯℃澘鍒楄〃 - List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); - for (String template : templates) - { - // 娓叉煋妯℃澘 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try - { - // 娣诲姞鍒皕ip - zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - } - catch (IOException e) - { - log.error("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName(), e); - } - } - } - - /** - * 淇敼淇濆瓨鍙傛暟鏍¢獙 - * - * @param genTable 涓氬姟淇℃伅 - */ - @Override - public void validateEdit(GenTable genTable) - { - if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) - { - String options = JSON.toJSONString(genTable.getParams()); - JSONObject paramsObj = JSON.parseObject(options); - if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) - { - throw new ServiceException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌�"); - } - else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) - { - throw new ServiceException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖"); - } - else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) - { - throw new ServiceException("鏍戝悕绉板瓧娈典笉鑳戒负绌�"); - } - else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) - { - if (StringUtils.isEmpty(genTable.getSubTableName())) - { - throw new ServiceException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌�"); - } - else if (StringUtils.isEmpty(genTable.getSubTableFkName())) - { - throw new ServiceException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖"); - } - } - } - } - - /** - * 璁剧疆涓婚敭鍒椾俊鎭� - * - * @param table 涓氬姟琛ㄤ俊鎭� - */ - public void setPkColumn(GenTable table) - { - for (GenTableColumn column : table.getColumns()) - { - if (column.isPk()) - { - table.setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getPkColumn())) - { - table.setPkColumn(table.getColumns().get(0)); - } - if (GenConstants.TPL_SUB.equals(table.getTplCategory())) - { - for (GenTableColumn column : table.getSubTable().getColumns()) - { - if (column.isPk()) - { - table.getSubTable().setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getSubTable().getPkColumn())) - { - table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); - } - } - } - - /** - * 璁剧疆涓诲瓙琛ㄤ俊鎭� - * - * @param table 涓氬姟琛ㄤ俊鎭� - */ - public void setSubTable(GenTable table) - { - String subTableName = table.getSubTableName(); - if (StringUtils.isNotEmpty(subTableName)) - { - table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); - } - } - - /** - * 璁剧疆浠g爜鐢熸垚鍏朵粬閫夐」鍊� - * - * @param genTable 璁剧疆鍚庣殑鐢熸垚瀵硅薄 - */ - public void setTableFromOptions(GenTable genTable) - { - JSONObject paramsObj = JSON.parseObject(genTable.getOptions()); - if (StringUtils.isNotNull(paramsObj)) - { - String treeCode = paramsObj.getString(GenConstants.TREE_CODE); - String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); - String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); - - genTable.setTreeCode(treeCode); - genTable.setTreeParentCode(treeParentCode); - genTable.setTreeName(treeName); - genTable.setParentMenuId(parentMenuId); - genTable.setParentMenuName(parentMenuName); - } - } - - /** - * 鑾峰彇浠g爜鐢熸垚鍦板潃 - * - * @param table 涓氬姟琛ㄤ俊鎭� - * @param template 妯℃澘鏂囦欢璺緞 - * @return 鐢熸垚鍦板潃 - */ - public static String getGenPath(GenTable table, String template) - { - String genPath = table.getGenPath(); - if (StringUtils.equals(genPath, "/")) - { - return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); - } - return genPath + File.separator + VelocityUtils.getFileName(template, table); - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java b/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java deleted file mode 100644 index 0a0c6af..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.se.gen.service; - -import java.util.List; -import com.se.gen.domain.GenTableColumn; - -/** - * 涓氬姟瀛楁 鏈嶅姟灞� - * - * @author admin - */ -public interface IGenTableColumnService -{ - /** - * 鏌ヨ涓氬姟瀛楁鍒楄〃 - * - * @param tableId 涓氬姟瀛楁缂栧彿 - * @return 涓氬姟瀛楁闆嗗悎 - */ - public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); - - /** - * 鏂板涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 淇敼涓氬姟瀛楁 - * - * @param genTableColumn 涓氬姟瀛楁淇℃伅 - * @return 缁撴灉 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 鍒犻櫎涓氬姟瀛楁淇℃伅 - * - * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID - * @return 缁撴灉 - */ - public int deleteGenTableColumnByIds(String ids); -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java b/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java deleted file mode 100644 index ff8cd09..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.se.gen.service; - -import java.util.List; -import java.util.Map; -import com.se.gen.domain.GenTable; - -/** - * 涓氬姟 鏈嶅姟灞� - * - * @author admin - */ -public interface IGenTableService -{ - /** - * 鏌ヨ涓氬姟鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 涓氬姟闆嗗悎 - */ - public List<GenTable> selectGenTableList(GenTable genTable); - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param genTable 涓氬姟淇℃伅 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - public List<GenTable> selectDbTableList(GenTable genTable); - - /** - * 鏌ヨ鎹簱鍒楄〃 - * - * @param tableNames 琛ㄥ悕绉扮粍 - * @return 鏁版嵁搴撹〃闆嗗悎 - */ - public List<GenTable> selectDbTableListByNames(String[] tableNames); - - /** - * 鏌ヨ鎵�鏈夎〃淇℃伅 - * - * @return 琛ㄤ俊鎭泦鍚� - */ - public List<GenTable> selectGenTableAll(); - - /** - * 鏌ヨ涓氬姟淇℃伅 - * - * @param id 涓氬姟ID - * @return 涓氬姟淇℃伅 - */ - public GenTable selectGenTableById(Long id); - - /** - * 淇敼涓氬姟 - * - * @param genTable 涓氬姟淇℃伅 - * @return 缁撴灉 - */ - public void updateGenTable(GenTable genTable); - - /** - * 鍒犻櫎涓氬姟淇℃伅 - * - * @param tableIds 闇�瑕佸垹闄ょ殑琛ㄦ暟鎹甀D - * @return 缁撴灉 - */ - public void deleteGenTableByIds(Long[] tableIds); - - /** - * 瀵煎叆琛ㄧ粨鏋� - * - * @param tableList 瀵煎叆琛ㄥ垪琛� - */ - public void importGenTable(List<GenTable> tableList); - - /** - * 棰勮浠g爜 - * - * @param tableId 琛ㄧ紪鍙� - * @return 棰勮鏁版嵁鍒楄〃 - */ - public Map<String, String> previewCode(Long tableId); - - /** - * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 - * - * @param tableName 琛ㄥ悕绉� - * @return 鏁版嵁 - */ - public byte[] downloadCode(String tableName); - - /** - * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� - * - * @param tableName 琛ㄥ悕绉� - * @return 鏁版嵁 - */ - public void generatorCode(String tableName); - - /** - * 鍚屾鏁版嵁搴� - * - * @param tableName 琛ㄥ悕绉� - */ - public void synchDb(String tableName); - - /** - * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 - * - * @param tableNames 琛ㄦ暟缁� - * @return 鏁版嵁 - */ - public byte[] downloadCode(String[] tableNames); - - /** - * 淇敼淇濆瓨鍙傛暟鏍¢獙 - * - * @param genTable 涓氬姟淇℃伅 - */ - public void validateEdit(GenTable genTable); -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java b/se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java deleted file mode 100644 index 7dd5d14..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.se.gen.util; - -import java.util.Arrays; - -import com.se.gen.config.GenConfig; -import com.se.gen.domain.GenTableColumn; -import org.apache.commons.lang3.RegExUtils; -import com.se.common.core.constant.GenConstants; -import com.se.common.core.utils.StringUtils; -import com.se.gen.domain.GenTable; - -/** - * 浠g爜鐢熸垚鍣� 宸ュ叿绫� - * - * @author admin - */ -public class GenUtils -{ - /** - * 鍒濆鍖栬〃淇℃伅 - */ - public static void initTable(GenTable genTable, String operName) - { - genTable.setClassName(convertClassName(genTable.getTableName())); - genTable.setPackageName(GenConfig.getPackageName()); - genTable.setModuleName(getModuleName(GenConfig.getPackageName())); - genTable.setBusinessName(getBusinessName(genTable.getTableName())); - genTable.setFunctionName(replaceText(genTable.getTableComment())); - genTable.setFunctionAuthor(GenConfig.getAuthor()); - genTable.setCreateBy(operName); - } - - /** - * 鍒濆鍖栧垪灞炴�у瓧娈� - */ - public static void initColumnField(GenTableColumn column, GenTable table) - { - String dataType = getDbType(column.getColumnType()); - String columnName = column.getColumnName(); - column.setTableId(table.getTableId()); - column.setCreateBy(table.getCreateBy()); - // 璁剧疆java瀛楁鍚� - column.setJavaField(StringUtils.toCamelCase(columnName)); - // 璁剧疆榛樿绫诲瀷 - column.setJavaType(GenConstants.TYPE_STRING); - column.setQueryType(GenConstants.QUERY_EQ); - - if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) - { - // 瀛楃涓查暱搴﹁秴杩�500璁剧疆涓烘枃鏈煙 - Integer columnLength = getColumnLength(column.getColumnType()); - String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; - column.setHtmlType(htmlType); - } - else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) - { - column.setJavaType(GenConstants.TYPE_DATE); - column.setHtmlType(GenConstants.HTML_DATETIME); - } - else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) - { - column.setHtmlType(GenConstants.HTML_INPUT); - - // 濡傛灉鏄诞鐐瑰瀷 缁熶竴鐢˙igDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); - if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) - { - column.setJavaType(GenConstants.TYPE_BIGDECIMAL); - } - // 濡傛灉鏄暣褰� - else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) - { - column.setJavaType(GenConstants.TYPE_INTEGER); - } - // 闀挎暣褰� - else - { - column.setJavaType(GenConstants.TYPE_LONG); - } - } - - // 鎻掑叆瀛楁锛堥粯璁ゆ墍鏈夊瓧娈甸兘闇�瑕佹彃鍏ワ級 - column.setIsInsert(GenConstants.REQUIRE); - - // 缂栬緫瀛楁 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) - { - column.setIsEdit(GenConstants.REQUIRE); - } - // 鍒楄〃瀛楁 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) - { - column.setIsList(GenConstants.REQUIRE); - } - // 鏌ヨ瀛楁 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) - { - column.setIsQuery(GenConstants.REQUIRE); - } - - // 鏌ヨ瀛楁绫诲瀷 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) - { - column.setQueryType(GenConstants.QUERY_LIKE); - } - // 鐘舵�佸瓧娈佃缃崟閫夋 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) - { - column.setHtmlType(GenConstants.HTML_RADIO); - } - // 绫诲瀷&鎬у埆瀛楁璁剧疆涓嬫媺妗� - else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) - { - column.setHtmlType(GenConstants.HTML_SELECT); - } - // 鍥剧墖瀛楁璁剧疆鍥剧墖涓婁紶鎺т欢 - else if (StringUtils.endsWithIgnoreCase(columnName, "image")) - { - column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); - } - // 鏂囦欢瀛楁璁剧疆鏂囦欢涓婁紶鎺т欢 - else if (StringUtils.endsWithIgnoreCase(columnName, "file")) - { - column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); - } - // 鍐呭瀛楁璁剧疆瀵屾枃鏈帶浠� - else if (StringUtils.endsWithIgnoreCase(columnName, "content")) - { - column.setHtmlType(GenConstants.HTML_EDITOR); - } - } - - /** - * 鏍¢獙鏁扮粍鏄惁鍖呭惈鎸囧畾鍊� - * - * @param arr 鏁扮粍 - * @param targetValue 鍊� - * @return 鏄惁鍖呭惈 - */ - public static boolean arraysContains(String[] arr, String targetValue) - { - return Arrays.asList(arr).contains(targetValue); - } - - /** - * 鑾峰彇妯″潡鍚� - * - * @param packageName 鍖呭悕 - * @return 妯″潡鍚� - */ - public static String getModuleName(String packageName) - { - int lastIndex = packageName.lastIndexOf("."); - int nameLength = packageName.length(); - return StringUtils.substring(packageName, lastIndex + 1, nameLength); - } - - /** - * 鑾峰彇涓氬姟鍚� - * - * @param tableName 琛ㄥ悕 - * @return 涓氬姟鍚� - */ - public static String getBusinessName(String tableName) - { - int lastIndex = tableName.lastIndexOf("_"); - int nameLength = tableName.length(); - return StringUtils.substring(tableName, lastIndex + 1, nameLength); - } - - /** - * 琛ㄥ悕杞崲鎴怞ava绫诲悕 - * - * @param tableName 琛ㄥ悕绉� - * @return 绫诲悕 - */ - public static String convertClassName(String tableName) - { - boolean autoRemovePre = GenConfig.getAutoRemovePre(); - String tablePrefix = GenConfig.getTablePrefix(); - if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) - { - String[] searchList = StringUtils.split(tablePrefix, ","); - tableName = replaceFirst(tableName, searchList); - } - return StringUtils.convertToCamelCase(tableName); - } - - /** - * 鎵归噺鏇挎崲鍓嶇紑 - * - * @param replacementm 鏇挎崲鍊� - * @param searchList 鏇挎崲鍒楄〃 - * @return - */ - public static String replaceFirst(String replacementm, String[] searchList) - { - String text = replacementm; - for (String searchString : searchList) - { - if (replacementm.startsWith(searchString)) - { - text = replacementm.replaceFirst(searchString, ""); - break; - } - } - return text; - } - - /** - * 鍏抽敭瀛楁浛鎹� - * - * @param text 闇�瑕佽鏇挎崲鐨勫悕瀛� - * @return 鏇挎崲鍚庣殑鍚嶅瓧 - */ - public static String replaceText(String text) - { - return RegExUtils.replaceAll(text, "(?:琛▅SE)", ""); - } - - /** - * 鑾峰彇鏁版嵁搴撶被鍨嬪瓧娈� - * - * @param columnType 鍒楃被鍨� - * @return 鎴彇鍚庣殑鍒楃被鍨� - */ - public static String getDbType(String columnType) - { - if (StringUtils.indexOf(columnType, "(") > 0) - { - return StringUtils.substringBefore(columnType, "("); - } - else - { - return columnType; - } - } - - /** - * 鑾峰彇瀛楁闀垮害 - * - * @param columnType 鍒楃被鍨� - * @return 鎴彇鍚庣殑鍒楃被鍨� - */ - public static Integer getColumnLength(String columnType) - { - if (StringUtils.indexOf(columnType, "(") > 0) - { - String length = StringUtils.substringBetween(columnType, "(", ")"); - return Integer.valueOf(length); - } - else - { - return 0; - } - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java b/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java deleted file mode 100644 index 5301486..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.se.gen.util; - -import java.util.Properties; -import org.apache.velocity.app.Velocity; -import com.se.common.core.constant.Constants; - -/** - * VelocityEngine宸ュ巶 - * - * @author admin - */ -public class VelocityInitializer -{ - /** - * 鍒濆鍖杤m鏂规硶 - */ - public static void initVelocity() - { - Properties p = new Properties(); - try - { - // 鍔犺浇classpath鐩綍涓嬬殑vm鏂囦欢 - p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - // 瀹氫箟瀛楃闆� - p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); - // 鍒濆鍖朧elocity寮曟搸锛屾寚瀹氶厤缃甈roperties - Velocity.init(p); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } -} diff --git a/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java b/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java deleted file mode 100644 index f9de77c..0000000 --- a/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java +++ /dev/null @@ -1,409 +0,0 @@ -package com.se.gen.util; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import com.se.gen.domain.GenTableColumn; -import org.apache.velocity.VelocityContext; -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.se.common.core.constant.GenConstants; -import com.se.common.core.utils.DateUtils; -import com.se.common.core.utils.StringUtils; -import com.se.gen.domain.GenTable; - -/** - * 妯℃澘宸ュ叿绫� - * - * @author admin - */ -public class VelocityUtils -{ - /** 椤圭洰绌洪棿璺緞 */ - private static final String PROJECT_PATH = "main/java"; - - /** mybatis绌洪棿璺緞 */ - private static final String MYBATIS_PATH = "main/resources/mapper"; - - /** 榛樿涓婄骇鑿滃崟锛岀郴缁熷伐鍏� */ - private static final String DEFAULT_PARENT_MENU_ID = "3"; - - /** - * 璁剧疆妯℃澘鍙橀噺淇℃伅 - * - * @return 妯℃澘鍒楄〃 - */ - public static VelocityContext prepareContext(GenTable genTable) - { - String moduleName = genTable.getModuleName(); - String businessName = genTable.getBusinessName(); - String packageName = genTable.getPackageName(); - String tplCategory = genTable.getTplCategory(); - String functionName = genTable.getFunctionName(); - - VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("tplCategory", genTable.getTplCategory()); - velocityContext.put("tableName", genTable.getTableName()); - velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "銆愯濉啓鍔熻兘鍚嶇О銆�"); - velocityContext.put("ClassName", genTable.getClassName()); - velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); - velocityContext.put("moduleName", genTable.getModuleName()); - velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); - velocityContext.put("businessName", genTable.getBusinessName()); - velocityContext.put("basePackage", getPackagePrefix(packageName)); - velocityContext.put("packageName", packageName); - velocityContext.put("author", genTable.getFunctionAuthor()); - velocityContext.put("datetime", DateUtils.getDate()); - velocityContext.put("pkColumn", genTable.getPkColumn()); - velocityContext.put("importList", getImportList(genTable)); - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); - velocityContext.put("columns", genTable.getColumns()); - velocityContext.put("table", genTable); - velocityContext.put("dicts", getDicts(genTable)); - setMenuVelocityContext(velocityContext, genTable); - if (GenConstants.TPL_TREE.equals(tplCategory)) - { - setTreeVelocityContext(velocityContext, genTable); - } - if (GenConstants.TPL_SUB.equals(tplCategory)) - { - setSubVelocityContext(velocityContext, genTable); - } - return velocityContext; - } - - public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSON.parseObject(options); - String parentMenuId = getParentMenuId(paramsObj); - context.put("parentMenuId", parentMenuId); - } - - public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSON.parseObject(options); - String treeCode = getTreecode(paramsObj); - String treeParentCode = getTreeParentCode(paramsObj); - String treeName = getTreeName(paramsObj); - - context.put("treeCode", treeCode); - context.put("treeParentCode", treeParentCode); - context.put("treeName", treeName); - context.put("expandColumn", getExpandColumn(genTable)); - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); - } - } - - public static void setSubVelocityContext(VelocityContext context, GenTable genTable) - { - GenTable subTable = genTable.getSubTable(); - String subTableName = genTable.getSubTableName(); - String subTableFkName = genTable.getSubTableFkName(); - String subClassName = genTable.getSubTable().getClassName(); - String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); - - context.put("subTable", subTable); - context.put("subTableName", subTableName); - context.put("subTableFkName", subTableFkName); - context.put("subTableFkClassName", subTableFkClassName); - context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); - context.put("subClassName", subClassName); - context.put("subclassName", StringUtils.uncapitalize(subClassName)); - context.put("subImportList", getImportList(genTable.getSubTable())); - } - - /** - * 鑾峰彇妯℃澘淇℃伅 - * @param tplCategory 鐢熸垚鐨勬ā鏉� - * @param tplWebType 鍓嶇绫诲瀷 - * @return 妯℃澘鍒楄〃 - */ - public static List<String> getTemplateList(String tplCategory, String tplWebType) - { - String useWebType = "vm/vue"; - if ("element-plus".equals(tplWebType)) - { - useWebType = "vm/vue/v3"; - } - List<String> templates = new ArrayList<String>(); - templates.add("vm/java/domain.java.vm"); - templates.add("vm/java/mapper.java.vm"); - templates.add("vm/java/service.java.vm"); - templates.add("vm/java/serviceImpl.java.vm"); - templates.add("vm/java/controller.java.vm"); - templates.add("vm/xml/mapper.xml.vm"); - templates.add("vm/sql/sql.vm"); - templates.add("vm/js/api.js.vm"); - if (GenConstants.TPL_CRUD.equals(tplCategory)) - { - templates.add(useWebType + "/index.vue.vm"); - } - else if (GenConstants.TPL_TREE.equals(tplCategory)) - { - templates.add(useWebType + "/index-tree.vue.vm"); - } - else if (GenConstants.TPL_SUB.equals(tplCategory)) - { - templates.add(useWebType + "/index.vue.vm"); - templates.add("vm/java/sub-domain.java.vm"); - } - return templates; - } - - /** - * 鑾峰彇鏂囦欢鍚� - */ - public static String getFileName(String template, GenTable genTable) - { - // 鏂囦欢鍚嶇О - String fileName = ""; - // 鍖呰矾寰� - String packageName = genTable.getPackageName(); - // 妯″潡鍚� - String moduleName = genTable.getModuleName(); - // 澶у啓绫诲悕 - String className = genTable.getClassName(); - // 涓氬姟鍚嶇О - String businessName = genTable.getBusinessName(); - - String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); - String mybatisPath = MYBATIS_PATH + "/" + moduleName; - String vuePath = "vue"; - - if (template.contains("domain.java.vm")) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); - } - if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); - } - else if (template.contains("mapper.java.vm")) - { - fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); - } - else if (template.contains("service.java.vm")) - { - fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); - } - else if (template.contains("serviceImpl.java.vm")) - { - fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); - } - else if (template.contains("controller.java.vm")) - { - fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); - } - else if (template.contains("mapper.xml.vm")) - { - fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); - } - else if (template.contains("sql.vm")) - { - fileName = businessName + "Menu.sql"; - } - else if (template.contains("api.js.vm")) - { - fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); - } - else if (template.contains("index.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - else if (template.contains("index-tree.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - return fileName; - } - - /** - * 鑾峰彇鍖呭墠缂� - * - * @param packageName 鍖呭悕绉� - * @return 鍖呭墠缂�鍚嶇О - */ - public static String getPackagePrefix(String packageName) - { - int lastIndex = packageName.lastIndexOf("."); - return StringUtils.substring(packageName, 0, lastIndex); - } - - /** - * 鏍规嵁鍒楃被鍨嬭幏鍙栧鍏ュ寘 - * - * @param genTable 涓氬姟琛ㄥ璞� - * @return 杩斿洖闇�瑕佸鍏ョ殑鍖呭垪琛� - */ - public static HashSet<String> getImportList(GenTable genTable) - { - List<GenTableColumn> columns = genTable.getColumns(); - GenTable subGenTable = genTable.getSubTable(); - HashSet<String> importList = new HashSet<String>(); - if (StringUtils.isNotNull(subGenTable)) - { - importList.add("java.util.List"); - } - for (GenTableColumn column : columns) - { - if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) - { - importList.add("java.util.Date"); - importList.add("com.fasterxml.jackson.annotation.JsonFormat"); - } - else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) - { - importList.add("java.math.BigDecimal"); - } - } - return importList; - } - - /** - * 鏍规嵁鍒楃被鍨嬭幏鍙栧瓧鍏哥粍 - * - * @param genTable 涓氬姟琛ㄥ璞� - * @return 杩斿洖瀛楀吀缁� - */ - public static String getDicts(GenTable genTable) - { - List<GenTableColumn> columns = genTable.getColumns(); - Set<String> dicts = new HashSet<String>(); - addDicts(dicts, columns); - if (StringUtils.isNotNull(genTable.getSubTable())) - { - List<GenTableColumn> subColumns = genTable.getSubTable().getColumns(); - addDicts(dicts, subColumns); - } - return StringUtils.join(dicts, ", "); - } - - /** - * 娣诲姞瀛楀吀鍒楄〃 - * - * @param dicts 瀛楀吀鍒楄〃 - * @param columns 鍒楅泦鍚� - */ - public static void addDicts(Set<String> dicts, List<GenTableColumn> columns) - { - for (GenTableColumn column : columns) - { - if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( - column.getHtmlType(), - new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) - { - dicts.add("'" + column.getDictType() + "'"); - } - } - } - - /** - * 鑾峰彇鏉冮檺鍓嶇紑 - * - * @param moduleName 妯″潡鍚嶇О - * @param businessName 涓氬姟鍚嶇О - * @return 杩斿洖鏉冮檺鍓嶇紑 - */ - public static String getPermissionPrefix(String moduleName, String businessName) - { - return StringUtils.format("{}:{}", moduleName, businessName); - } - - /** - * 鑾峰彇涓婄骇鑿滃崟ID瀛楁 - * - * @param paramsObj 鐢熸垚鍏朵粬閫夐」 - * @return 涓婄骇鑿滃崟ID瀛楁 - */ - public static String getParentMenuId(JSONObject paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID) - && StringUtils.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID))) - { - return paramsObj.getString(GenConstants.PARENT_MENU_ID); - } - return DEFAULT_PARENT_MENU_ID; - } - - /** - * 鑾峰彇鏍戠紪鐮� - * - * @param paramsObj 鐢熸垚鍏朵粬閫夐」 - * @return 鏍戠紪鐮� - */ - public static String getTreecode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 鑾峰彇鏍戠埗缂栫爜 - * - * @param paramsObj 鐢熸垚鍏朵粬閫夐」 - * @return 鏍戠埗缂栫爜 - */ - public static String getTreeParentCode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 鑾峰彇鏍戝悕绉� - * - * @param paramsObj 鐢熸垚鍏朵粬閫夐」 - * @return 鏍戝悕绉� - */ - public static String getTreeName(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); - } - return StringUtils.EMPTY; - } - - /** - * 鑾峰彇闇�瑕佸湪鍝竴鍒椾笂闈㈡樉绀哄睍寮�鎸夐挳 - * - * @param genTable 涓氬姟琛ㄥ璞� - * @return 灞曞紑鎸夐挳鍒楀簭鍙� - */ - public static int getExpandColumn(GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSON.parseObject(options); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - int num = 0; - for (GenTableColumn column : genTable.getColumns()) - { - if (column.isList()) - { - num++; - String columnName = column.getColumnName(); - if (columnName.equals(treeName)) - { - break; - } - } - } - return num; - } -} diff --git a/se-modules/se-gen/src/main/resources/banner.txt b/se-modules/se-gen/src/main/resources/banner.txt deleted file mode 100644 index b951c98..0000000 --- a/se-modules/se-gen/src/main/resources/banner.txt +++ /dev/null @@ -1,3 +0,0 @@ -Spring Boot Version: ${spring-boot.version} -Spring Application Name: ${spring.application.name} -SeGenApplication锛屽凡缁忓惎鍔� \ No newline at end of file diff --git a/se-modules/se-gen/src/main/resources/bootstrap.yml b/se-modules/se-gen/src/main/resources/bootstrap.yml deleted file mode 100644 index d041ebe..0000000 --- a/se-modules/se-gen/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Tomcat -server: - port: 9202 - -# Spring -spring: - application: - # 搴旂敤鍚嶇О - name: se-gen - profiles: - # 鐜閰嶇疆 - active: dev - cloud: - nacos: - username: nacos - password: nAcos_!9#_admIn - discovery: - # 鏈嶅姟娉ㄥ唽鍦板潃 - server-addr: 127.0.0.1:8848 - config: - # 閰嶇疆涓績鍦板潃 - server-addr: 127.0.0.1:8848 - # 閰嶇疆鏂囦欢鏍煎紡 - file-extension: yml - # 鍏变韩閰嶇疆 - shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/se-modules/se-gen/src/main/resources/logback.xml b/se-modules/se-gen/src/main/resources/logback.xml deleted file mode 100644 index eeb9a55..0000000 --- a/se-modules/se-gen/src/main/resources/logback.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration scan="true" scanPeriod="60 seconds" debug="false"> - <!-- 鏃ュ織瀛樻斁璺緞 --> - <property name="log.path" value="logs/se-gen" /> - <!-- 鏃ュ織杈撳嚭鏍煎紡 --> - <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> - - <!-- 鎺у埗鍙拌緭鍑� --> - <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - </appender> - - <!-- 绯荤粺鏃ュ織杈撳嚭 --> - <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/info.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>INFO</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/error.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>ERROR</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 --> - <logger name="com.se" level="info" /> - <!-- Spring鏃ュ織绾у埆鎺у埗 --> - <logger name="org.springframework" level="warn" /> - - <root level="info"> - <appender-ref ref="console" /> - </root> - - <!--绯荤粺鎿嶄綔鏃ュ織--> - <root level="info"> - <appender-ref ref="file_info" /> - <appender-ref ref="file_error" /> - </root> -</configuration> \ No newline at end of file diff --git a/se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml deleted file mode 100644 index 57726e8..0000000 --- a/se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ /dev/null @@ -1,127 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.se.gen.mapper.GenTableColumnMapper"> - - <resultMap type="GenTableColumn" id="GenTableColumnResult"> - <id property="columnId" column="column_id" /> - <result property="tableId" column="table_id" /> - <result property="columnName" column="column_name" /> - <result property="columnComment" column="column_comment" /> - <result property="columnType" column="column_type" /> - <result property="javaType" column="java_type" /> - <result property="javaField" column="java_field" /> - <result property="isPk" column="is_pk" /> - <result property="isIncrement" column="is_increment" /> - <result property="isRequired" column="is_required" /> - <result property="isInsert" column="is_insert" /> - <result property="isEdit" column="is_edit" /> - <result property="isList" column="is_list" /> - <result property="isQuery" column="is_query" /> - <result property="queryType" column="query_type" /> - <result property="htmlType" column="html_type" /> - <result property="dictType" column="dict_type" /> - <result property="sort" column="sort" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - </resultMap> - - <sql id="selectGenTableColumnVo"> - select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column - </sql> - - <select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult"> - <include refid="selectGenTableColumnVo"/> - where table_id = #{tableId} - order by sort - </select> - - <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> - select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type - from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) - order by ordinal_position - </select> - - <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> - insert into gen_table_column ( - <if test="tableId != null and tableId != ''">table_id,</if> - <if test="columnName != null and columnName != ''">column_name,</if> - <if test="columnComment != null and columnComment != ''">column_comment,</if> - <if test="columnType != null and columnType != ''">column_type,</if> - <if test="javaType != null and javaType != ''">java_type,</if> - <if test="javaField != null and javaField != ''">java_field,</if> - <if test="isPk != null and isPk != ''">is_pk,</if> - <if test="isIncrement != null and isIncrement != ''">is_increment,</if> - <if test="isRequired != null and isRequired != ''">is_required,</if> - <if test="isInsert != null and isInsert != ''">is_insert,</if> - <if test="isEdit != null and isEdit != ''">is_edit,</if> - <if test="isList != null and isList != ''">is_list,</if> - <if test="isQuery != null and isQuery != ''">is_query,</if> - <if test="queryType != null and queryType != ''">query_type,</if> - <if test="htmlType != null and htmlType != ''">html_type,</if> - <if test="dictType != null and dictType != ''">dict_type,</if> - <if test="sort != null">sort,</if> - <if test="createBy != null and createBy != ''">create_by,</if> - create_time - )values( - <if test="tableId != null and tableId != ''">#{tableId},</if> - <if test="columnName != null and columnName != ''">#{columnName},</if> - <if test="columnComment != null and columnComment != ''">#{columnComment},</if> - <if test="columnType != null and columnType != ''">#{columnType},</if> - <if test="javaType != null and javaType != ''">#{javaType},</if> - <if test="javaField != null and javaField != ''">#{javaField},</if> - <if test="isPk != null and isPk != ''">#{isPk},</if> - <if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if> - <if test="isRequired != null and isRequired != ''">#{isRequired},</if> - <if test="isInsert != null and isInsert != ''">#{isInsert},</if> - <if test="isEdit != null and isEdit != ''">#{isEdit},</if> - <if test="isList != null and isList != ''">#{isList},</if> - <if test="isQuery != null and isQuery != ''">#{isQuery},</if> - <if test="queryType != null and queryType != ''">#{queryType},</if> - <if test="htmlType != null and htmlType != ''">#{htmlType},</if> - <if test="dictType != null and dictType != ''">#{dictType},</if> - <if test="sort != null">#{sort},</if> - <if test="createBy != null and createBy != ''">#{createBy},</if> - sysdate() - ) - </insert> - - <update id="updateGenTableColumn" parameterType="GenTableColumn"> - update gen_table_column - <set> - <if test="columnComment != null">column_comment = #{columnComment},</if> - <if test="javaType != null">java_type = #{javaType},</if> - <if test="javaField != null">java_field = #{javaField},</if> - <if test="isInsert != null">is_insert = #{isInsert},</if> - <if test="isEdit != null">is_edit = #{isEdit},</if> - <if test="isList != null">is_list = #{isList},</if> - <if test="isQuery != null">is_query = #{isQuery},</if> - <if test="isRequired != null">is_required = #{isRequired},</if> - <if test="queryType != null">query_type = #{queryType},</if> - <if test="htmlType != null">html_type = #{htmlType},</if> - <if test="dictType != null">dict_type = #{dictType},</if> - <if test="sort != null">sort = #{sort},</if> - <if test="updateBy != null">update_by = #{updateBy},</if> - update_time = sysdate() - </set> - where column_id = #{columnId} - </update> - - <delete id="deleteGenTableColumnByIds" parameterType="Long"> - delete from gen_table_column where table_id in - <foreach collection="array" item="tableId" open="(" separator="," close=")"> - #{tableId} - </foreach> - </delete> - - <delete id="deleteGenTableColumns"> - delete from gen_table_column where column_id in - <foreach collection="list" item="item" open="(" separator="," close=")"> - #{item.columnId} - </foreach> - </delete> - -</mapper> \ No newline at end of file diff --git a/se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml b/se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml deleted file mode 100644 index 074d782..0000000 --- a/se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml +++ /dev/null @@ -1,206 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.se.gen.mapper.GenTableMapper"> - - <resultMap type="GenTable" id="GenTableResult"> - <id property="tableId" column="table_id" /> - <result property="tableName" column="table_name" /> - <result property="tableComment" column="table_comment" /> - <result property="subTableName" column="sub_table_name" /> - <result property="subTableFkName" column="sub_table_fk_name" /> - <result property="className" column="class_name" /> - <result property="tplCategory" column="tpl_category" /> - <result property="tplWebType" column="tpl_web_type" /> - <result property="packageName" column="package_name" /> - <result property="moduleName" column="module_name" /> - <result property="businessName" column="business_name" /> - <result property="functionName" column="function_name" /> - <result property="functionAuthor" column="function_author" /> - <result property="genType" column="gen_type" /> - <result property="genPath" column="gen_path" /> - <result property="options" column="options" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="remark" column="remark" /> - <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" /> - </resultMap> - - <resultMap type="GenTableColumn" id="GenTableColumnResult"> - <id property="columnId" column="column_id" /> - <result property="tableId" column="table_id" /> - <result property="columnName" column="column_name" /> - <result property="columnComment" column="column_comment" /> - <result property="columnType" column="column_type" /> - <result property="javaType" column="java_type" /> - <result property="javaField" column="java_field" /> - <result property="isPk" column="is_pk" /> - <result property="isIncrement" column="is_increment" /> - <result property="isRequired" column="is_required" /> - <result property="isInsert" column="is_insert" /> - <result property="isEdit" column="is_edit" /> - <result property="isList" column="is_list" /> - <result property="isQuery" column="is_query" /> - <result property="queryType" column="query_type" /> - <result property="htmlType" column="html_type" /> - <result property="dictType" column="dict_type" /> - <result property="sort" column="sort" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - </resultMap> - - <sql id="selectGenTableVo"> - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table - </sql> - - <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> - <include refid="selectGenTableVo"/> - <where> - <if test="tableName != null and tableName != ''"> - AND lower(table_name) like lower(concat('%', #{tableName}, '%')) - </if> - <if test="tableComment != null and tableComment != ''"> - AND lower(table_comment) like lower(concat('%', #{tableComment}, '%')) - </if> - <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� --> - AND date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d') - </if> - <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> - AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') - </if> - </where> - </select> - - <select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult"> - select table_name, table_comment, create_time, update_time from information_schema.tables - where table_schema = (select database()) - AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%' - AND table_name NOT IN (select table_name from gen_table) - <if test="tableName != null and tableName != ''"> - AND lower(table_name) like lower(concat('%', #{tableName}, '%')) - </if> - <if test="tableComment != null and tableComment != ''"> - AND lower(table_comment) like lower(concat('%', #{tableComment}, '%')) - </if> - <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� --> - AND date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d') - </if> - <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> - AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') - </if> - order by create_time desc - </select> - - <select id="selectDbTableListByNames" resultMap="GenTableResult"> - select table_name, table_comment, create_time, update_time from information_schema.tables - where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database()) - and table_name in - <foreach collection="array" item="name" open="(" separator="," close=")"> - #{name} - </foreach> - </select> - - <select id="selectTableByName" parameterType="String" resultMap="GenTableResult"> - select table_name, table_comment, create_time, update_time from information_schema.tables - where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database()) - and table_name = #{tableName} - </select> - - <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> - SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, - c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort - FROM gen_table t - LEFT JOIN gen_table_column c ON t.table_id = c.table_id - where t.table_id = #{tableId} order by c.sort - </select> - - <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> - SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, - c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort - FROM gen_table t - LEFT JOIN gen_table_column c ON t.table_id = c.table_id - where t.table_name = #{tableName} order by c.sort - </select> - - <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult"> - SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, - c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort - FROM gen_table t - LEFT JOIN gen_table_column c ON t.table_id = c.table_id - order by c.sort - </select> - - <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId"> - insert into gen_table ( - <if test="tableName != null">table_name,</if> - <if test="tableComment != null and tableComment != ''">table_comment,</if> - <if test="className != null and className != ''">class_name,</if> - <if test="tplCategory != null and tplCategory != ''">tpl_category,</if> - <if test="tplWebType != null and tplWebType != ''">tpl_web_type,</if> - <if test="packageName != null and packageName != ''">package_name,</if> - <if test="moduleName != null and moduleName != ''">module_name,</if> - <if test="businessName != null and businessName != ''">business_name,</if> - <if test="functionName != null and functionName != ''">function_name,</if> - <if test="functionAuthor != null and functionAuthor != ''">function_author,</if> - <if test="genType != null and genType != ''">gen_type,</if> - <if test="genPath != null and genPath != ''">gen_path,</if> - <if test="remark != null and remark != ''">remark,</if> - <if test="createBy != null and createBy != ''">create_by,</if> - create_time - )values( - <if test="tableName != null">#{tableName},</if> - <if test="tableComment != null and tableComment != ''">#{tableComment},</if> - <if test="className != null and className != ''">#{className},</if> - <if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if> - <if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if> - <if test="packageName != null and packageName != ''">#{packageName},</if> - <if test="moduleName != null and moduleName != ''">#{moduleName},</if> - <if test="businessName != null and businessName != ''">#{businessName},</if> - <if test="functionName != null and functionName != ''">#{functionName},</if> - <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if> - <if test="genType != null and genType != ''">#{genType},</if> - <if test="genPath != null and genPath != ''">#{genPath},</if> - <if test="remark != null and remark != ''">#{remark},</if> - <if test="createBy != null and createBy != ''">#{createBy},</if> - sysdate() - ) - </insert> - - <update id="updateGenTable" parameterType="GenTable"> - update gen_table - <set> - <if test="tableName != null">table_name = #{tableName},</if> - <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if> - <if test="subTableName != null">sub_table_name = #{subTableName},</if> - <if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if> - <if test="className != null and className != ''">class_name = #{className},</if> - <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if> - <if test="genType != null and genType != ''">gen_type = #{genType},</if> - <if test="genPath != null and genPath != ''">gen_path = #{genPath},</if> - <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if> - <if test="tplWebType != null and tplWebType != ''">tpl_web_type = #{tplWebType},</if> - <if test="packageName != null and packageName != ''">package_name = #{packageName},</if> - <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if> - <if test="businessName != null and businessName != ''">business_name = #{businessName},</if> - <if test="functionName != null and functionName != ''">function_name = #{functionName},</if> - <if test="options != null and options != ''">options = #{options},</if> - <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> - <if test="remark != null">remark = #{remark},</if> - update_time = sysdate() - </set> - where table_id = #{tableId} - </update> - - <delete id="deleteGenTableByIds" parameterType="Long"> - delete from gen_table where table_id in - <foreach collection="array" item="tableId" open="(" separator="," close=")"> - #{tableId} - </foreach> - </delete> - -</mapper> \ No newline at end of file diff --git a/se-modules/se-gen/src/main/resources/vm/java/controller.java.vm b/se-modules/se-gen/src/main/resources/vm/java/controller.java.vm deleted file mode 100644 index 86e7eaf..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/controller.java.vm +++ /dev/null @@ -1,115 +0,0 @@ -package ${packageName}.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.se.common.log.annotation.Log; -import com.se.common.log.enums.BusinessType; -import com.se.common.security.annotation.RequiresPermissions; -import ${packageName}.domain.${ClassName}; -import ${packageName}.service.I${ClassName}Service; -import com.se.common.core.web.controller.BaseController; -import com.se.common.core.web.domain.AjaxResult; -import com.se.common.core.utils.poi.ExcelUtil; -#if($table.crud || $table.sub) -import com.se.common.core.web.page.TableDataInfo; -#elseif($table.tree) -#end - -/** - * ${functionName}Controller - * - * @author ${author} - * @date ${datetime} - */ -@RestController -@RequestMapping("/${businessName}") -public class ${ClassName}Controller extends BaseController -{ - @Autowired - private I${ClassName}Service ${className}Service; - - /** - * 鏌ヨ${functionName}鍒楄〃 - */ - @RequiresPermissions("${permissionPrefix}:list") - @GetMapping("/list") -#if($table.crud || $table.sub) - public TableDataInfo list(${ClassName} ${className}) - { - startPage(); - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return getDataTable(list); - } -#elseif($table.tree) - public AjaxResult list(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return success(list); - } -#end - - /** - * 瀵煎嚭${functionName}鍒楄〃 - */ - @RequiresPermissions("${permissionPrefix}:export") - @Log(title = "${functionName}", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, ${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); - util.exportExcel(response, list, "${functionName}鏁版嵁"); - } - - /** - * 鑾峰彇${functionName}璇︾粏淇℃伅 - */ - @RequiresPermissions("${permissionPrefix}:query") - @GetMapping(value = "/{${pkColumn.javaField}}") - public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); - } - - /** - * 鏂板${functionName} - */ - @RequiresPermissions("${permissionPrefix}:add") - @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.insert${ClassName}(${className})); - } - - /** - * 淇敼${functionName} - */ - @RequiresPermissions("${permissionPrefix}:edit") - @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.update${ClassName}(${className})); - } - - /** - * 鍒犻櫎${functionName} - */ - @RequiresPermissions("${permissionPrefix}:remove") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/{${pkColumn.javaField}s}") - public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) - { - return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); - } -} diff --git a/se-modules/se-gen/src/main/resources/vm/java/domain.java.vm b/se-modules/se-gen/src/main/resources/vm/java/domain.java.vm deleted file mode 100644 index bb2fa06..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/domain.java.vm +++ /dev/null @@ -1,101 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $importList) -import ${import}; -#end -import com.se.common.core.annotation.Excel; -#if($table.crud || $table.sub) -#elseif($table.tree) -#end - -/** - * ${functionName}瀵硅薄 ${tableName} - * - * @author ${author} - * @date ${datetime} - */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="TreeEntity") -#end -public class ${ClassName} extends ${Entity} -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#if($table.sub) - /** $table.subTable.functionName淇℃伅 */ - private List<${subClassName}> ${subclassName}List; - -#end -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - -#if($table.sub) - public List<${subClassName}> get${subClassName}List() - { - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List) - { - this.${subclassName}List = ${subclassName}List; - } - -#end - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) -#end - .toString(); - } -} diff --git a/se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm b/se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm deleted file mode 100644 index 7e7d7c2..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm +++ /dev/null @@ -1,91 +0,0 @@ -package ${packageName}.mapper; - -import java.util.List; -import ${packageName}.domain.${ClassName}; -#if($table.sub) -import ${packageName}.domain.${subClassName}; -#end - -/** - * ${functionName}Mapper鎺ュ彛 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Mapper -{ - /** - * 鏌ヨ${functionName} - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return ${functionName} - */ - public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 鏌ヨ${functionName}鍒楄〃 - * - * @param ${className} ${functionName} - * @return ${functionName}闆嗗悎 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 鏂板${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ - public int insert${ClassName}(${ClassName} ${className}); - - /** - * 淇敼${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ - public int update${ClassName}(${ClassName} ${className}); - - /** - * 鍒犻櫎${functionName} - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return 缁撴灉 - */ - public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 鎵归噺鍒犻櫎${functionName} - * - * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 - * @return 缁撴灉 - */ - public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); -#if($table.sub) - - /** - * 鎵归噺鍒犻櫎${subTable.functionName} - * - * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 - * @return 缁撴灉 - */ - public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 鎵归噺鏂板${subTable.functionName} - * - * @param ${subclassName}List ${subTable.functionName}鍒楄〃 - * @return 缁撴灉 - */ - public int batch${subClassName}(List<${subClassName}> ${subclassName}List); - - - /** - * 閫氳繃${functionName}涓婚敭鍒犻櫎${subTable.functionName}淇℃伅 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 缁撴灉 - */ - public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); -#end -} diff --git a/se-modules/se-gen/src/main/resources/vm/java/service.java.vm b/se-modules/se-gen/src/main/resources/vm/java/service.java.vm deleted file mode 100644 index 264882b..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/service.java.vm +++ /dev/null @@ -1,61 +0,0 @@ -package ${packageName}.service; - -import java.util.List; -import ${packageName}.domain.${ClassName}; - -/** - * ${functionName}Service鎺ュ彛 - * - * @author ${author} - * @date ${datetime} - */ -public interface I${ClassName}Service -{ - /** - * 鏌ヨ${functionName} - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return ${functionName} - */ - public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 鏌ヨ${functionName}鍒楄〃 - * - * @param ${className} ${functionName} - * @return ${functionName}闆嗗悎 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 鏂板${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ - public int insert${ClassName}(${ClassName} ${className}); - - /** - * 淇敼${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ - public int update${ClassName}(${ClassName} ${className}); - - /** - * 鎵归噺鍒犻櫎${functionName} - * - * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑${functionName}涓婚敭闆嗗悎 - * @return 缁撴灉 - */ - public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 鍒犻櫎${functionName}淇℃伅 - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return 缁撴灉 - */ - public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); -} diff --git a/se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm b/se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm deleted file mode 100644 index 81d3764..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm +++ /dev/null @@ -1,169 +0,0 @@ -package ${packageName}.service.impl; - -import java.util.List; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') -import com.se.common.core.utils.DateUtils; -#break -#end -#end -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -#if($table.sub) -import java.util.ArrayList; -import com.se.common.core.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import ${packageName}.domain.${subClassName}; -#end -import ${packageName}.mapper.${ClassName}Mapper; -import ${packageName}.domain.${ClassName}; -import ${packageName}.service.I${ClassName}Service; - -/** - * ${functionName}Service涓氬姟灞傚鐞� - * - * @author ${author} - * @date ${datetime} - */ -@Service -public class ${ClassName}ServiceImpl implements I${ClassName}Service -{ - @Autowired - private ${ClassName}Mapper ${className}Mapper; - - /** - * 鏌ヨ${functionName} - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return ${functionName} - */ - @Override - public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) - { - return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); - } - - /** - * 鏌ヨ${functionName}鍒楄〃 - * - * @param ${className} ${functionName} - * @return ${functionName} - */ - @Override - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) - { - return ${className}Mapper.select${ClassName}List(${className}); - } - - /** - * 鏂板${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ -#if($table.sub) - @Transactional -#end - @Override - public int insert${ClassName}(${ClassName} ${className}) - { -#foreach ($column in $columns) -#if($column.javaField == 'createTime') - ${className}.setCreateTime(DateUtils.getNowDate()); -#end -#end -#if($table.sub) - int rows = ${className}Mapper.insert${ClassName}(${className}); - insert${subClassName}(${className}); - return rows; -#else - return ${className}Mapper.insert${ClassName}(${className}); -#end - } - - /** - * 淇敼${functionName} - * - * @param ${className} ${functionName} - * @return 缁撴灉 - */ -#if($table.sub) - @Transactional -#end - @Override - public int update${ClassName}(${ClassName} ${className}) - { -#foreach ($column in $columns) -#if($column.javaField == 'updateTime') - ${className}.setUpdateTime(DateUtils.getNowDate()); -#end -#end -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); - insert${subClassName}(${className}); -#end - return ${className}Mapper.update${ClassName}(${className}); - } - - /** - * 鎵归噺鍒犻櫎${functionName} - * - * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑${functionName}涓婚敭 - * @return 缁撴灉 - */ -#if($table.sub) - @Transactional -#end - @Override - public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); -#end - return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); - } - - /** - * 鍒犻櫎${functionName}淇℃伅 - * - * @param ${pkColumn.javaField} ${functionName}涓婚敭 - * @return 缁撴灉 - */ -#if($table.sub) - @Transactional -#end - @Override - public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); -#end - return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); - } -#if($table.sub) - - /** - * 鏂板${subTable.functionName}淇℃伅 - * - * @param ${className} ${functionName}瀵硅薄 - */ - public void insert${subClassName}(${ClassName} ${className}) - { - List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); - ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); - if (StringUtils.isNotNull(${subclassName}List)) - { - List<${subClassName}> list = new ArrayList<${subClassName}>(); - for (${subClassName} ${subclassName} : ${subclassName}List) - { - ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); - list.add(${subclassName}); - } - if (list.size() > 0) - { - ${className}Mapper.batch${subClassName}(list); - } - } - } -#end -} diff --git a/se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm b/se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm deleted file mode 100644 index a517964..0000000 --- a/se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm +++ /dev/null @@ -1,73 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $subImportList) -import ${import}; -#end -import com.se.common.core.annotation.Excel; - -/** - * ${subTable.functionName}瀵硅薄 ${subTableName} - * - * @author ${author} - * @date ${datetime} - */ -public class ${subClassName} extends BaseEntity -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $subTable.columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end - .toString(); - } -} diff --git a/se-modules/se-gen/src/main/resources/vm/js/api.js.vm b/se-modules/se-gen/src/main/resources/vm/js/api.js.vm deleted file mode 100644 index 9295524..0000000 --- a/se-modules/se-gen/src/main/resources/vm/js/api.js.vm +++ /dev/null @@ -1,44 +0,0 @@ -import request from '@/utils/request' - -// 鏌ヨ${functionName}鍒楄〃 -export function list${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/list', - method: 'get', - params: query - }) -} - -// 鏌ヨ${functionName}璇︾粏 -export function get${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'get' - }) -} - -// 鏂板${functionName} -export function add${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'post', - data: data - }) -} - -// 淇敼${functionName} -export function update${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'put', - data: data - }) -} - -// 鍒犻櫎${functionName} -export function del${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'delete' - }) -} diff --git a/se-modules/se-gen/src/main/resources/vm/sql/sql.vm b/se-modules/se-gen/src/main/resources/vm/sql/sql.vm deleted file mode 100644 index 0575583..0000000 --- a/se-modules/se-gen/src/main/resources/vm/sql/sql.vm +++ /dev/null @@ -1,22 +0,0 @@ --- 鑿滃崟 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}鑿滃崟'); - --- 鎸夐挳鐖惰彍鍗旾D -SELECT @parentId := LAST_INSERT_ID(); - --- 鎸夐挳 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}鏌ヨ', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}鏂板', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}淇敼', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}鍒犻櫎', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}瀵煎嚭', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm deleted file mode 100644 index a4c64a0..0000000 --- a/se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm +++ /dev/null @@ -1,505 +0,0 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="璇疯緭鍏�${comment}" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable - v-model="queryParams.${column.javaField}" - type="date" - value-format="yyyy-MM-dd" - placeholder="閫夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - <el-form-item label="${comment}"> - <el-date-picker - v-model="daterange${AttrName}" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="info" - plain - icon="el-icon-sort" - size="mini" - @click="toggleExpandAll" - >灞曞紑/鎶樺彔</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table - v-if="refreshTable" - v-loading="loading" - :data="${businessName}List" - row-key="${treeCode}" - :default-expand-all="isExpandAll" - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "imageUpload") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> - <template slot-scope="scope"> - <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}"> - <template slot-scope="scope"> -#if($column.htmlType == "checkbox") - <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> -#else - <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> -#end - </template> - </el-table-column> -#elseif($column.list && "" != $javaField) -#if(${foreach.index} == 1) - <el-table-column label="${comment}" prop="${javaField}" /> -#else - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end -#end - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" - @click="handleAdd(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if("" != $treeParentCode && $column.javaField == $treeParentCode) - <el-form-item label="${comment}" prop="${treeParentCode}"> - <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="璇烽�夋嫨${comment}" /> - </el-form-item> -#elseif($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> - </el-form-item> -#elseif($column.htmlType == "imageUpload") - <el-form-item label="${comment}" prop="${field}"> - <image-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "fileUpload") - <el-form-item label="${comment}" prop="${field}"> - <file-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "editor") - <el-form-item label="${comment}"> - <editor v-model="form.${field}" :min-height="192"/> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.label" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :value="parseInt(dict.value)" -#else - :value="dict.value" -#end - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "checkbox" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.value"> - {{dict.label}} - </el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "checkbox" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in dict.type.${dictType}" - :key="dict.value" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :label="parseInt(dict.value)" -#else - :label="dict.value" -#end - >{{dict.label}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable - v-model="form.${field}" - type="date" - value-format="yyyy-MM-dd" - placeholder="閫夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> -#end -#end -#end -#end - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; -import Treeselect from "@riophae/vue-treeselect"; -import "@riophae/vue-treeselect/dist/vue-treeselect.css"; - -export default { - name: "${BusinessName}", -#if(${dicts} != '') - dicts: [${dicts}], -#end - components: { - Treeselect - }, - data() { - return { - // 閬僵灞� - loading: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // ${functionName}琛ㄦ牸鏁版嵁 - ${businessName}List: [], - // ${functionName}鏍戦�夐」 - ${businessName}Options: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏄惁灞曞紑锛岄粯璁ゅ叏閮ㄥ睍寮� - isExpandAll: true, - // 閲嶆柊娓叉煋琛ㄦ牸鐘舵�� - refreshTable: true, -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - // $comment鏃堕棿鑼冨洿 - daterange${AttrName}: [], -#end -#end - // 鏌ヨ鍙傛暟 - queryParams: { -#foreach ($column in $columns) -#if($column.query) - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { -#foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } - ]#if($foreach.count != $columns.size()),#end -#end -#end - } - }; - }, - created() { - this.getList(); - }, - methods: { - /** 鏌ヨ${functionName}鍒楄〃 */ - getList() { - this.loading = true; -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - this.queryParams.params = {}; -#break -#end -#end -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { - this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; - this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; - } -#end -#end - list${BusinessName}(this.queryParams).then(response => { - this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - this.loading = false; - }); - }, - /** 杞崲${functionName}鏁版嵁缁撴瀯 */ - normalizer(node) { - if (node.children && !node.children.length) { - delete node.children; - } - return { - id: node.${treeCode}, - label: node.${treeName}, - children: node.children - }; - }, - /** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */ - getTreeselect() { - list${BusinessName}().then(response => { - this.${businessName}Options = []; - const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] }; - data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - this.${businessName}Options.push(data); - }); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - $column.javaField: []#if($foreach.count != $columns.size()),#end -#else - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - this.daterange${AttrName} = []; -#end -#end - this.resetForm("queryForm"); - this.handleQuery(); - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd(row) { - this.reset(); - this.getTreeselect(); - if (row != null && row.${treeCode}) { - this.form.${treeParentCode} = row.${treeCode}; - } else { - this.form.${treeParentCode} = 0; - } - this.open = true; - this.title = "娣诲姞${functionName}"; - }, - /** 灞曞紑/鎶樺彔鎿嶄綔 */ - toggleExpandAll() { - this.refreshTable = false; - this.isExpandAll = !this.isExpandAll; - this.$nextTick(() => { - this.refreshTable = true; - }); - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - this.getTreeselect(); - if (row != null) { - this.form.${treeParentCode} = row.${treeCode}; - } - get${BusinessName}(row.${pkColumn.javaField}).then(response => { - this.form = response.data; -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - this.form.$column.javaField = this.form.${column.javaField}.split(","); -#end -#end - this.open = true; - this.title = "淇敼${functionName}"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.#[[$]]#refs["form"].validate(valid => { - if (valid) { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - this.form.$column.javaField = this.form.${column.javaField}.join(","); -#end -#end - if (this.form.${pkColumn.javaField} != null) { - update${BusinessName}(this.form).then(response => { - this.#[[$modal]]#.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - add${BusinessName}(this.form).then(response => { - this.#[[$modal]]#.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - this.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�').then(function() { - return del${BusinessName}(row.${pkColumn.javaField}); - }).then(() => { - this.getList(); - this.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - } - } -}; -</script> diff --git a/se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm deleted file mode 100644 index 6296014..0000000 --- a/se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm +++ /dev/null @@ -1,602 +0,0 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="璇疯緭鍏�${comment}" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable - v-model="queryParams.${column.javaField}" - type="date" - value-format="yyyy-MM-dd" - placeholder="璇烽�夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - <el-form-item label="${comment}"> - <el-date-picker - v-model="daterange${AttrName}" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['${moduleName}:${businessName}:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "imageUpload") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> - <template slot-scope="scope"> - <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}"> - <template slot-scope="scope"> -#if($column.htmlType == "checkbox") - <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> -#else - <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> -#end - </template> - </el-table-column> -#elseif($column.list && "" != $javaField) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> - </el-form-item> -#elseif($column.htmlType == "imageUpload") - <el-form-item label="${comment}" prop="${field}"> - <image-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "fileUpload") - <el-form-item label="${comment}" prop="${field}"> - <file-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "editor") - <el-form-item label="${comment}"> - <editor v-model="form.${field}" :min-height="192"/> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.label" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :value="parseInt(dict.value)" -#else - :value="dict.value" -#end - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "checkbox" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox - v-for="dict in dict.type.${dictType}" - :key="dict.value" - :label="dict.value"> - {{dict.label}} - </el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "checkbox" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in dict.type.${dictType}" - :key="dict.value" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :label="parseInt(dict.value)" -#else - :label="dict.value" -#end - >{{dict.label}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable - v-model="form.${field}" - type="date" - value-format="yyyy-MM-dd" - placeholder="璇烽�夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> -#end -#end -#end -#end -#if($table.sub) - <el-divider content-position="center">${subTable.functionName}淇℃伅</el-divider> - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">娣诲姞</el-button> - </el-col> - <el-col :span="1.5"> - <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">鍒犻櫎</el-button> - </el-col> - </el-row> - <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> - <el-table-column type="selection" width="50" align="center" /> - <el-table-column label="搴忓彿" align="center" prop="index" width="50"/> -#foreach($column in $subTable.columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk || $javaField == ${subTableFkclassName}) -#elseif($column.list && $column.htmlType == "input") - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template slot-scope="scope"> - <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" /> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="$comment" prop="${javaField}" width="240"> - <template slot-scope="scope"> - <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨$comment" /> - </template> - </el-table-column> -#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template slot-scope="scope"> - <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> - <el-option - v-for="dict in dict.type.$column.dictType" - :key="dict.value" - :label="dict.label" - :value="dict.value" - ></el-option> - </el-select> - </template> - </el-table-column> -#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template slot-scope="scope"> - <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </template> - </el-table-column> -#end -#end - </el-table> -#end - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; - -export default { - name: "${BusinessName}", -#if(${dicts} != '') - dicts: [${dicts}], -#end - data() { - return { - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], -#if($table.sub) - // 瀛愯〃閫変腑鏁版嵁 - checked${subClassName}: [], -#end - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // ${functionName}琛ㄦ牸鏁版嵁 - ${businessName}List: [], -#if($table.sub) - // ${subTable.functionName}琛ㄦ牸鏁版嵁 - ${subclassName}List: [], -#end - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - // $comment鏃堕棿鑼冨洿 - daterange${AttrName}: [], -#end -#end - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, -#foreach ($column in $columns) -#if($column.query) - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { -#foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } - ]#if($foreach.count != $columns.size()),#end -#end -#end - } - }; - }, - created() { - this.getList(); - }, - methods: { - /** 鏌ヨ${functionName}鍒楄〃 */ - getList() { - this.loading = true; -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - this.queryParams.params = {}; -#break -#end -#end -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { - this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; - this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; - } -#end -#end - list${BusinessName}(this.queryParams).then(response => { - this.${businessName}List = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - $column.javaField: []#if($foreach.count != $columns.size()),#end -#else - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }; -#if($table.sub) - this.${subclassName}List = []; -#end - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - this.daterange${AttrName} = []; -#end -#end - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.${pkColumn.javaField}) - this.single = selection.length!==1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞${functionName}"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids - get${BusinessName}(${pkColumn.javaField}).then(response => { - this.form = response.data; -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - this.form.$column.javaField = this.form.${column.javaField}.split(","); -#end -#end -#if($table.sub) - this.${subclassName}List = response.data.${subclassName}List; -#end - this.open = true; - this.title = "淇敼${functionName}"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.#[[$]]#refs["form"].validate(valid => { - if (valid) { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - this.form.$column.javaField = this.form.${column.javaField}.join(","); -#end -#end -#if($table.sub) - this.form.${subclassName}List = this.${subclassName}List; -#end - if (this.form.${pkColumn.javaField} != null) { - update${BusinessName}(this.form).then(response => { - this.#[[$modal]]#.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - add${BusinessName}(this.form).then(response => { - this.#[[$modal]]#.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; - this.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + ${pkColumn.javaField}s + '"鐨勬暟鎹」锛�').then(function() { - return del${BusinessName}(${pkColumn.javaField}s); - }).then(() => { - this.getList(); - this.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, -#if($table.sub) - /** ${subTable.functionName}搴忓彿 */ - row${subClassName}Index({ row, rowIndex }) { - row.index = rowIndex + 1; - }, - /** ${subTable.functionName}娣诲姞鎸夐挳鎿嶄綔 */ - handleAdd${subClassName}() { - let obj = {}; -#foreach($column in $subTable.columns) -#if($column.pk || $column.javaField == ${subTableFkclassName}) -#elseif($column.list && "" != $javaField) - obj.$column.javaField = ""; -#end -#end - this.${subclassName}List.push(obj); - }, - /** ${subTable.functionName}鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete${subClassName}() { - if (this.checked${subClassName}.length == 0) { - this.#[[$modal]]#.msgError("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁"); - } else { - const ${subclassName}List = this.${subclassName}List; - const checked${subClassName} = this.checked${subClassName}; - this.${subclassName}List = ${subclassName}List.filter(function(item) { - return checked${subClassName}.indexOf(item.index) == -1 - }); - } - }, - /** 澶嶉�夋閫変腑鏁版嵁 */ - handle${subClassName}SelectionChange(selection) { - this.checked${subClassName} = selection.map(item => item.index) - }, -#end - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('${moduleName}/${businessName}/export', { - ...this.queryParams - }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) - } - } -}; -</script> diff --git a/se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm deleted file mode 100644 index 7bbd2fc..0000000 --- a/se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ /dev/null @@ -1,474 +0,0 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="璇疯緭鍏�${comment}" - clearable - @keyup.enter="handleQuery" - /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable - v-model="queryParams.${column.javaField}" - type="date" - value-format="YYYY-MM-DD" - placeholder="閫夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - <el-form-item label="${comment}" style="width: 308px"> - <el-date-picker - v-model="daterange${AttrName}" - value-format="YYYY-MM-DD" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> - <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="Plus" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="info" - plain - icon="Sort" - @click="toggleExpandAll" - >灞曞紑/鎶樺彔</el-button> - </el-col> - <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table - v-if="refreshTable" - v-loading="loading" - :data="${businessName}List" - row-key="${treeCode}" - :default-expand-all="isExpandAll" - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template #default="scope"> - <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "imageUpload") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> - <template #default="scope"> - <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}"> - <template #default="scope"> -#if($column.htmlType == "checkbox") - <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> -#else - <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/> -#end - </template> - </el-table-column> -#elseif($column.list && "" != $javaField) -#if(${foreach.index} == 1) - <el-table-column label="${comment}" prop="${javaField}" /> -#else - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end -#end - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template #default="scope"> - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">淇敼</el-button> - <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">鏂板</el-button> - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� --> - <el-dialog :title="title" v-model="open" width="500px" append-to-body> - <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if("" != $treeParentCode && $column.javaField == $treeParentCode) - <el-form-item label="${comment}" prop="${treeParentCode}"> - <el-tree-select - v-model="form.${treeParentCode}" - :data="${businessName}Options" - :props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }" - value-key="${treeCode}" - placeholder="璇烽�夋嫨${comment}" - check-strictly - /> - </el-form-item> -#elseif($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> - </el-form-item> -#elseif($column.htmlType == "imageUpload") - <el-form-item label="${comment}" prop="${field}"> - <image-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "fileUpload") - <el-form-item label="${comment}" prop="${field}"> - <file-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "editor") - <el-form-item label="${comment}"> - <editor v-model="form.${field}" :min-height="192"/> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.label" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :value="parseInt(dict.value)" -#else - :value="dict.value" -#end - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "checkbox" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.value"> - {{dict.label}} - </el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "checkbox" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in ${dictType}" - :key="dict.value" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :label="parseInt(dict.value)" -#else - :label="dict.value" -#end - >{{dict.label}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable - v-model="form.${field}" - type="date" - value-format="YYYY-MM-DD" - placeholder="閫夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> -#end -#end -#end -#end - </el-form> - <template #footer> - <div class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </template> - </el-dialog> - </div> -</template> - -<script setup name="${BusinessName}"> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; - -const { proxy } = getCurrentInstance(); -#if(${dicts} != '') -#set($dictsNoSymbol=$dicts.replace("'", "")) -const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); -#end - -const ${businessName}List = ref([]); -const ${businessName}Options = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const title = ref(""); -const isExpandAll = ref(true); -const refreshTable = ref(true); -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -const daterange${AttrName} = ref([]); -#end -#end - -const data = reactive({ - form: {}, - queryParams: { - #foreach ($column in $columns) -#if($column.query) - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }, - rules: { - #foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } - ]#if($foreach.count != $columns.size()),#end -#end -#end - } -}); - -const { queryParams, form, rules } = toRefs(data); - -/** 鏌ヨ${functionName}鍒楄〃 */ -function getList() { - loading.value = true; -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - queryParams.value.params = {}; -#break -#end -#end -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - if (null != daterange${AttrName} && '' != daterange${AttrName}) { - queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; - queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; - } -#end -#end - list${BusinessName}(queryParams.value).then(response => { - ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - loading.value = false; - }); -} - -/** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */ -function getTreeselect() { - list${BusinessName}().then(response => { - ${businessName}Options.value = []; - const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] }; - data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - ${businessName}Options.value.push(data); - }); -} - -// 鍙栨秷鎸夐挳 -function cancel() { - open.value = false; - reset(); -} - -// 琛ㄥ崟閲嶇疆 -function reset() { - form.value = { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - $column.javaField: []#if($foreach.count != $columns.size()),#end -#else - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }; - proxy.resetForm("${businessName}Ref"); -} - -/** 鎼滅储鎸夐挳鎿嶄綔 */ -function handleQuery() { - getList(); -} - -/** 閲嶇疆鎸夐挳鎿嶄綔 */ -function resetQuery() { -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - daterange${AttrName}.value = []; -#end -#end - proxy.resetForm("queryRef"); - handleQuery(); -} - -/** 鏂板鎸夐挳鎿嶄綔 */ -function handleAdd(row) { - reset(); - getTreeselect(); - if (row != null && row.${treeCode}) { - form.value.${treeParentCode} = row.${treeCode}; - } else { - form.value.${treeParentCode} = 0; - } - open.value = true; - title.value = "娣诲姞${functionName}"; -} - -/** 灞曞紑/鎶樺彔鎿嶄綔 */ -function toggleExpandAll() { - refreshTable.value = false; - isExpandAll.value = !isExpandAll.value; - nextTick(() => { - refreshTable.value = true; - }); -} - -/** 淇敼鎸夐挳鎿嶄綔 */ -async function handleUpdate(row) { - reset(); - await getTreeselect(); - if (row != null) { - form.value.${treeParentCode} = row.${treeCode}; - } - get${BusinessName}(row.${pkColumn.javaField}).then(response => { - form.value = response.data; -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - form.value.$column.javaField = form.value.${column.javaField}.split(","); -#end -#end - open.value = true; - title.value = "淇敼${functionName}"; - }); -} - -/** 鎻愪氦鎸夐挳 */ -function submitForm() { - proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { - if (valid) { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - form.value.$column.javaField = form.value.${column.javaField}.join(","); -#end -#end - if (form.value.${pkColumn.javaField} != null) { - update${BusinessName}(form.value).then(response => { - proxy.#[[$modal]]#.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); - } else { - add${BusinessName}(form.value).then(response => { - proxy.#[[$modal]]#.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); - } - } - }); -} - -/** 鍒犻櫎鎸夐挳鎿嶄綔 */ -function handleDelete(row) { - proxy.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�').then(function() { - return del${BusinessName}(row.${pkColumn.javaField}); - }).then(() => { - getList(); - proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); -} - -getList(); -</script> diff --git a/se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm deleted file mode 100644 index 8b25665..0000000 --- a/se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm +++ /dev/null @@ -1,590 +0,0 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="璇疯緭鍏�${comment}" - clearable - @keyup.enter="handleQuery" - /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable - v-model="queryParams.${column.javaField}" - type="date" - value-format="YYYY-MM-DD" - placeholder="璇烽�夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - <el-form-item label="${comment}" style="width: 308px"> - <el-date-picker - v-model="daterange${AttrName}" - value-format="YYYY-MM-DD" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> - <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="Plus" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="Edit" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="Delete" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="Download" - @click="handleExport" - v-hasPermi="['${moduleName}:${businessName}:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template #default="scope"> - <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "imageUpload") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> - <template #default="scope"> - <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}"> - <template #default="scope"> -#if($column.htmlType == "checkbox") - <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> -#else - <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/> -#end - </template> - </el-table-column> -#elseif($column.list && "" != $javaField) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template #default="scope"> - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">淇敼</el-button> - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - v-model:page="queryParams.pageNum" - v-model:limit="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� --> - <el-dialog :title="title" v-model="open" width="500px" append-to-body> - <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> - </el-form-item> -#elseif($column.htmlType == "imageUpload") - <el-form-item label="${comment}" prop="${field}"> - <image-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "fileUpload") - <el-form-item label="${comment}" prop="${field}"> - <file-upload v-model="form.${field}"/> - </el-form-item> -#elseif($column.htmlType == "editor") - <el-form-item label="${comment}"> - <editor v-model="form.${field}" :min-height="192"/> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.label" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :value="parseInt(dict.value)" -#else - :value="dict.value" -#end - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "checkbox" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox - v-for="dict in ${dictType}" - :key="dict.value" - :label="dict.value"> - {{dict.label}} - </el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "checkbox" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-checkbox-group v-model="form.${field}"> - <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox> - </el-checkbox-group> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in ${dictType}" - :key="dict.value" -#if($column.javaType == "Integer" || $column.javaType == "Long") - :label="parseInt(dict.value)" -#else - :label="dict.value" -#end - >{{dict.label}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}" prop="${field}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable - v-model="form.${field}" - type="date" - value-format="YYYY-MM-DD" - placeholder="璇烽�夋嫨${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> -#end -#end -#end -#end -#if($table.sub) - <el-divider content-position="center">${subTable.functionName}淇℃伅</el-divider> - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button type="primary" icon="Plus" @click="handleAdd${subClassName}">娣诲姞</el-button> - </el-col> - <el-col :span="1.5"> - <el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">鍒犻櫎</el-button> - </el-col> - </el-row> - <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> - <el-table-column type="selection" width="50" align="center" /> - <el-table-column label="搴忓彿" align="center" prop="index" width="50"/> -#foreach($column in $subTable.columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk || $javaField == ${subTableFkclassName}) -#elseif($column.list && $column.htmlType == "input") - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template #default="scope"> - <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" /> - </template> - </el-table-column> -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="$comment" prop="${javaField}" width="240"> - <template #default="scope"> - <el-date-picker clearable - v-model="scope.row.$javaField" - type="date" - value-format="YYYY-MM-DD" - placeholder="璇烽�夋嫨$comment"> - </el-date-picker> - </template> - </el-table-column> -#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template #default="scope"> - <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> - <el-option - v-for="dict in $column.dictType" - :key="dict.value" - :label="dict.label" - :value="dict.value" - ></el-option> - </el-select> - </template> - </el-table-column> -#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) - <el-table-column label="$comment" prop="${javaField}" width="150"> - <template #default="scope"> - <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> - <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> - </el-select> - </template> - </el-table-column> -#end -#end - </el-table> -#end - </el-form> - <template #footer> - <div class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </template> - </el-dialog> - </div> -</template> - -<script setup name="${BusinessName}"> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; - -const { proxy } = getCurrentInstance(); -#if(${dicts} != '') -#set($dictsNoSymbol=$dicts.replace("'", "")) -const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); -#end - -const ${businessName}List = ref([]); -#if($table.sub) -const ${subclassName}List = ref([]); -#end -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -#if($table.sub) -const checked${subClassName} = ref([]); -#end -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -const daterange${AttrName} = ref([]); -#end -#end - -const data = reactive({ - form: {}, - queryParams: { - pageNum: 1, - pageSize: 10, - #foreach ($column in $columns) -#if($column.query) - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }, - rules: { - #foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("锛�")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } - ]#if($foreach.count != $columns.size()),#end -#end -#end - } -}); - -const { queryParams, form, rules } = toRefs(data); - -/** 鏌ヨ${functionName}鍒楄〃 */ -function getList() { - loading.value = true; -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") - queryParams.value.params = {}; -#break -#end -#end -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - if (null != daterange${AttrName} && '' != daterange${AttrName}) { - queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; - queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; - } -#end -#end - list${BusinessName}(queryParams.value).then(response => { - ${businessName}List.value = response.rows; - total.value = response.total; - loading.value = false; - }); -} - -// 鍙栨秷鎸夐挳 -function cancel() { - open.value = false; - reset(); -} - -// 琛ㄥ崟閲嶇疆 -function reset() { - form.value = { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - $column.javaField: []#if($foreach.count != $columns.size()),#end -#else - $column.javaField: null#if($foreach.count != $columns.size()),#end -#end -#end - }; -#if($table.sub) - ${subclassName}List.value = []; -#end - proxy.resetForm("${businessName}Ref"); -} - -/** 鎼滅储鎸夐挳鎿嶄綔 */ -function handleQuery() { - queryParams.value.pageNum = 1; - getList(); -} - -/** 閲嶇疆鎸夐挳鎿嶄綔 */ -function resetQuery() { -#foreach ($column in $columns) -#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - daterange${AttrName}.value = []; -#end -#end - proxy.resetForm("queryRef"); - handleQuery(); -} - -// 澶氶�夋閫変腑鏁版嵁 -function handleSelectionChange(selection) { - ids.value = selection.map(item => item.${pkColumn.javaField}); - single.value = selection.length != 1; - multiple.value = !selection.length; -} - -/** 鏂板鎸夐挳鎿嶄綔 */ -function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞${functionName}"; -} - -/** 淇敼鎸夐挳鎿嶄綔 */ -function handleUpdate(row) { - reset(); - const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value - get${BusinessName}(_${pkColumn.javaField}).then(response => { - form.value = response.data; -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - form.value.$column.javaField = form.value.${column.javaField}.split(","); -#end -#end -#if($table.sub) - ${subclassName}List.value = response.data.${subclassName}List; -#end - open.value = true; - title.value = "淇敼${functionName}"; - }); -} - -/** 鎻愪氦鎸夐挳 */ -function submitForm() { - proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { - if (valid) { -#foreach ($column in $columns) -#if($column.htmlType == "checkbox") - form.value.$column.javaField = form.value.${column.javaField}.join(","); -#end -#end -#if($table.sub) - form.value.${subclassName}List = ${subclassName}List.value; -#end - if (form.value.${pkColumn.javaField} != null) { - update${BusinessName}(form.value).then(response => { - proxy.#[[$modal]]#.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); - } else { - add${BusinessName}(form.value).then(response => { - proxy.#[[$modal]]#.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); - } - } - }); -} - -/** 鍒犻櫎鎸夐挳鎿嶄綔 */ -function handleDelete(row) { - const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; - proxy.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + _${pkColumn.javaField}s + '"鐨勬暟鎹」锛�').then(function() { - return del${BusinessName}(_${pkColumn.javaField}s); - }).then(() => { - getList(); - proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); -} - -#if($table.sub) -/** ${subTable.functionName}搴忓彿 */ -function row${subClassName}Index({ row, rowIndex }) { - row.index = rowIndex + 1; -} - -/** ${subTable.functionName}娣诲姞鎸夐挳鎿嶄綔 */ -function handleAdd${subClassName}() { - let obj = {}; -#foreach($column in $subTable.columns) -#if($column.pk || $column.javaField == ${subTableFkclassName}) -#elseif($column.list && "" != $javaField) - obj.$column.javaField = ""; -#end -#end - ${subclassName}List.value.push(obj); -} - -/** ${subTable.functionName}鍒犻櫎鎸夐挳鎿嶄綔 */ -function handleDelete${subClassName}() { - if (checked${subClassName}.value.length == 0) { - proxy.#[[$modal]]#.msgError("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁"); - } else { - const ${subclassName}s = ${subclassName}List.value; - const checked${subClassName}s = checked${subClassName}.value; - ${subclassName}List.value = ${subclassName}s.filter(function(item) { - return checked${subClassName}s.indexOf(item.index) == -1 - }); - } -} - -/** 澶嶉�夋閫変腑鏁版嵁 */ -function handle${subClassName}SelectionChange(selection) { - checked${subClassName}.value = selection.map(item => item.index) -} - -#end -/** 瀵煎嚭鎸夐挳鎿嶄綔 */ -function handleExport() { - proxy.download('${moduleName}/${businessName}/export', { - ...queryParams.value - }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) -} - -getList(); -</script> diff --git a/se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm b/se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm deleted file mode 100644 index 456755b..0000000 --- a/se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="${packageName}.mapper.${ClassName}Mapper"> - - <resultMap type="${ClassName}" id="${ClassName}Result"> -#foreach ($column in $columns) - <result property="${column.javaField}" column="${column.columnName}" /> -#end - </resultMap> -#if($table.sub) - - <resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result"> - <collection property="${subclassName}List" ofType="${subClassName}" column="${pkColumn.columnName}" select="select${subClassName}List" /> - </resultMap> - - <resultMap type="${subClassName}" id="${subClassName}Result"> -#foreach ($column in $subTable.columns) - <result property="${column.javaField}" column="${column.columnName}" /> -#end - </resultMap> -#end - - <sql id="select${ClassName}Vo"> - select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} - </sql> - - <select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result"> - <include refid="select${ClassName}Vo"/> - <where> -#foreach($column in $columns) -#set($queryType=$column.queryType) -#set($javaField=$column.javaField) -#set($javaType=$column.javaType) -#set($columnName=$column.columnName) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#if($column.query) -#if($column.queryType == "EQ") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> -#elseif($queryType == "NE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> -#elseif($queryType == "GT") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> -#elseif($queryType == "GTE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> -#elseif($queryType == "LT") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> -#elseif($queryType == "LTE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> -#elseif($queryType == "LIKE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> -#elseif($queryType == "BETWEEN") - <if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> -#end -#end -#end - </where> - </select> - - <select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end"> -#if($table.crud || $table.tree) - <include refid="select${ClassName}Vo"/> - where ${pkColumn.columnName} = #{${pkColumn.javaField}} -#elseif($table.sub) - select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end - from ${tableName} - where ${pkColumn.columnName} = #{${pkColumn.javaField}} -#end - </select> -#if($table.sub) - - <select id="select${subClassName}List" resultMap="${subClassName}Result"> - select#foreach ($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end - from ${subTableName} - where ${subTableFkName} = #{${subTableFkName}} - </select> -#end - - <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> - insert into ${tableName} - <trim prefix="(" suffix=")" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if> -#end -#end - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if> -#end -#end - </trim> - </insert> - - <update id="update${ClassName}" parameterType="${ClassName}"> - update ${tableName} - <trim prefix="SET" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName) - <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> -#end -#end - </trim> - where ${pkColumn.columnName} = #{${pkColumn.javaField}} - </update> - - <delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}"> - delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} - </delete> - - <delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String"> - delete from ${tableName} where ${pkColumn.columnName} in - <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> - #{${pkColumn.javaField}} - </foreach> - </delete> -#if($table.sub) - - <delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String"> - delete from ${subTableName} where ${subTableFkName} in - <foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")"> - #{${subTableFkclassName}} - </foreach> - </delete> - - <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}"> - delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} - </delete> - - <insert id="batch${subClassName}"> - insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values - <foreach item="item" index="index" collection="list" separator=","> - (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) - </foreach> - </insert> -#end -</mapper> \ No newline at end of file diff --git a/se-modules/se-job/pom.xml b/se-modules/se-job/pom.xml deleted file mode 100644 index 64f6209..0000000 --- a/se-modules/se-job/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>com.se</groupId> - <artifactId>se-modules</artifactId> - <version>3.6.4</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>se-modules-job</artifactId> - - <description> - se-modules-job瀹氭椂浠诲姟 - </description> - - <dependencies> - - <!-- SpringCloud Alibaba Nacos --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Nacos Config --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Sentinel --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> - </dependency> - - <!-- SpringBoot Actuator --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - - <!-- Swagger UI --> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger-ui</artifactId> -<!-- <version>${swagger.fox.version}</version>--> - <version>3.0.0</version> - </dependency> - - <!-- Quartz --> - <dependency> - <groupId>org.quartz-scheduler</groupId> - <artifactId>quartz</artifactId> - <exclusions> - <exclusion> - <groupId>com.mchange</groupId> - <artifactId>c3p0</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- Mysql Connector --> - <dependency> - <groupId>com.mysql</groupId> - <artifactId>mysql-connector-j</artifactId> - </dependency> - - <!-- SE Common Log --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-log</artifactId> - </dependency> - - <!-- SE Common Swagger --> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-swagger</artifactId> - </dependency> - - </dependencies> - - <build> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file diff --git a/se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java b/se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java deleted file mode 100644 index f5e3d07..0000000 --- a/se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.se.job; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import com.se.common.security.annotation.EnableCustomConfig; -import com.se.common.security.annotation.EnableRyFeignClients; -import com.se.common.swagger.annotation.EnableCustomSwagger2; - -/** - * 瀹氭椂浠诲姟 - * - * @author admin - */ -@EnableCustomConfig -@EnableCustomSwagger2 -@EnableRyFeignClients -@SpringBootApplication -public class SeJobApplication -{ - public static void main(String[] args) - { - SpringApplication.run(SeJobApplication.class, args); - System.out.println(" 瀹氭椂浠诲姟妯″潡鍚姩鎴愬姛 "); - } -} diff --git a/se-modules/se-job/src/main/resources/banner.txt b/se-modules/se-job/src/main/resources/banner.txt deleted file mode 100644 index 286d7fe..0000000 --- a/se-modules/se-job/src/main/resources/banner.txt +++ /dev/null @@ -1,3 +0,0 @@ -Spring Boot Version: ${spring-boot.version} -Spring Application Name: ${spring.application.name} -SeJobApplication锛屽凡缁忓惎鍔� \ No newline at end of file diff --git a/se-modules/se-job/src/main/resources/bootstrap.yml b/se-modules/se-job/src/main/resources/bootstrap.yml deleted file mode 100644 index 94beb34..0000000 --- a/se-modules/se-job/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Tomcat -server: - port: 9203 - -# Spring -spring: - application: - # 搴旂敤鍚嶇О - name: se-job - profiles: - # 鐜閰嶇疆 - active: dev - cloud: - nacos: - username: nacos - password: nAcos_!9#_admIn - discovery: - # 鏈嶅姟娉ㄥ唽鍦板潃 - server-addr: 127.0.0.1:8848 - config: - # 閰嶇疆涓績鍦板潃 - server-addr: 127.0.0.1:8848 - # 閰嶇疆鏂囦欢鏍煎紡 - file-extension: yml - # 鍏变韩閰嶇疆 - shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/se-modules/se-job/src/main/resources/logback.xml b/se-modules/se-job/src/main/resources/logback.xml deleted file mode 100644 index 5eeb32b..0000000 --- a/se-modules/se-job/src/main/resources/logback.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration scan="true" scanPeriod="60 seconds" debug="false"> - <!-- 鏃ュ織瀛樻斁璺緞 --> - <property name="log.path" value="logs/se-job" /> - <!-- 鏃ュ織杈撳嚭鏍煎紡 --> - <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> - - <!-- 鎺у埗鍙拌緭鍑� --> - <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - </appender> - - <!-- 绯荤粺鏃ュ織杈撳嚭 --> - <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/info.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>INFO</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/error.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>ERROR</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 --> - <logger name="com.se" level="info" /> - <!-- Spring鏃ュ織绾у埆鎺у埗 --> - <logger name="org.springframework" level="warn" /> - - <root level="info"> - <appender-ref ref="console" /> - </root> - - <!--绯荤粺鎿嶄綔鏃ュ織--> - <root level="info"> - <appender-ref ref="file_info" /> - <appender-ref ref="file_error" /> - </root> -</configuration> \ No newline at end of file diff --git a/se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml b/se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml deleted file mode 100644 index 41a7d06..0000000 --- a/se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.se.job.mapper.SysJobLogMapper"> - - <resultMap type="SysJobLog" id="SysJobLogResult"> - <id property="jobLogId" column="job_log_id" /> - <result property="jobName" column="job_name" /> - <result property="jobGroup" column="job_group" /> - <result property="invokeTarget" column="invoke_target" /> - <result property="jobMessage" column="job_message" /> - <result property="status" column="status" /> - <result property="exceptionInfo" column="exception_info" /> - <result property="createTime" column="create_time" /> - </resultMap> - - <sql id="selectJobLogVo"> - select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time - from sys_job_log - </sql> - - <select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult"> - <include refid="selectJobLogVo"/> - <where> - <if test="jobName != null and jobName != ''"> - AND job_name like concat('%', #{jobName}, '%') - </if> - <if test="jobGroup != null and jobGroup != ''"> - AND job_group = #{jobGroup} - </if> - <if test="status != null and status != ''"> - AND status = #{status} - </if> - <if test="invokeTarget != null and invokeTarget != ''"> - AND invoke_target like concat('%', #{invokeTarget}, '%') - </if> - <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� --> - and date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d') - </if> - <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> - and date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') - </if> - </where> - order by create_time desc - </select> - - <select id="selectJobLogAll" resultMap="SysJobLogResult"> - <include refid="selectJobLogVo"/> - </select> - - <select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult"> - <include refid="selectJobLogVo"/> - where job_log_id = #{jobLogId} - </select> - - <delete id="deleteJobLogById" parameterType="Long"> - delete from sys_job_log where job_log_id = #{jobLogId} - </delete> - - <delete id="deleteJobLogByIds" parameterType="Long"> - delete from sys_job_log where job_log_id in - <foreach collection="array" item="jobLogId" open="(" separator="," close=")"> - #{jobLogId} - </foreach> - </delete> - - <update id="cleanJobLog"> - truncate table sys_job_log - </update> - - <insert id="insertJobLog" parameterType="SysJobLog"> - insert into sys_job_log( - <if test="jobLogId != null and jobLogId != 0">job_log_id,</if> - <if test="jobName != null and jobName != ''">job_name,</if> - <if test="jobGroup != null and jobGroup != ''">job_group,</if> - <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if> - <if test="jobMessage != null and jobMessage != ''">job_message,</if> - <if test="status != null and status != ''">status,</if> - <if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if> - create_time - )values( - <if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if> - <if test="jobName != null and jobName != ''">#{jobName},</if> - <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if> - <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if> - <if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if> - <if test="status != null and status != ''">#{status},</if> - <if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if> - sysdate() - ) - </insert> - -</mapper> \ No newline at end of file diff --git a/se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml b/se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml deleted file mode 100644 index 09f8fc6..0000000 --- a/se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.se.job.mapper.SysJobMapper"> - - <resultMap type="SysJob" id="SysJobResult"> - <id property="jobId" column="job_id" /> - <result property="jobName" column="job_name" /> - <result property="jobGroup" column="job_group" /> - <result property="invokeTarget" column="invoke_target" /> - <result property="cronExpression" column="cron_expression" /> - <result property="misfirePolicy" column="misfire_policy" /> - <result property="concurrent" column="concurrent" /> - <result property="status" column="status" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="remark" column="remark" /> - </resultMap> - - <sql id="selectJobVo"> - select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark - from sys_job - </sql> - - <select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult"> - <include refid="selectJobVo"/> - <where> - <if test="jobName != null and jobName != ''"> - AND job_name like concat('%', #{jobName}, '%') - </if> - <if test="jobGroup != null and jobGroup != ''"> - AND job_group = #{jobGroup} - </if> - <if test="status != null and status != ''"> - AND status = #{status} - </if> - <if test="invokeTarget != null and invokeTarget != ''"> - AND invoke_target like concat('%', #{invokeTarget}, '%') - </if> - </where> - </select> - - <select id="selectJobAll" resultMap="SysJobResult"> - <include refid="selectJobVo"/> - </select> - - <select id="selectJobById" parameterType="Long" resultMap="SysJobResult"> - <include refid="selectJobVo"/> - where job_id = #{jobId} - </select> - - <delete id="deleteJobById" parameterType="Long"> - delete from sys_job where job_id = #{jobId} - </delete> - - <delete id="deleteJobByIds" parameterType="Long"> - delete from sys_job where job_id in - <foreach collection="array" item="jobId" open="(" separator="," close=")"> - #{jobId} - </foreach> - </delete> - - <update id="updateJob" parameterType="SysJob"> - update sys_job - <set> - <if test="jobName != null and jobName != ''">job_name = #{jobName},</if> - <if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if> - <if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if> - <if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if> - <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if> - <if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if> - <if test="status !=null">status = #{status},</if> - <if test="remark != null and remark != ''">remark = #{remark},</if> - <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> - update_time = sysdate() - </set> - where job_id = #{jobId} - </update> - - <insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId"> - insert into sys_job( - <if test="jobId != null and jobId != 0">job_id,</if> - <if test="jobName != null and jobName != ''">job_name,</if> - <if test="jobGroup != null and jobGroup != ''">job_group,</if> - <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if> - <if test="cronExpression != null and cronExpression != ''">cron_expression,</if> - <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if> - <if test="concurrent != null and concurrent != ''">concurrent,</if> - <if test="status != null and status != ''">status,</if> - <if test="remark != null and remark != ''">remark,</if> - <if test="createBy != null and createBy != ''">create_by,</if> - create_time - )values( - <if test="jobId != null and jobId != 0">#{jobId},</if> - <if test="jobName != null and jobName != ''">#{jobName},</if> - <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if> - <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if> - <if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if> - <if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if> - <if test="concurrent != null and concurrent != ''">#{concurrent},</if> - <if test="status != null and status != ''">#{status},</if> - <if test="remark != null and remark != ''">#{remark},</if> - <if test="createBy != null and createBy != ''">#{createBy},</if> - sysdate() - ) - </insert> - -</mapper> \ No newline at end of file diff --git a/se-modules/se-system/pom.xml b/se-modules/se-system/pom.xml index e1402e3..5a727b5 100644 --- a/se-modules/se-system/pom.xml +++ b/se-modules/se-system/pom.xml @@ -40,14 +40,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> - - <!-- Swagger UI --> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger-ui</artifactId> - <version>${swagger.fox.version}</version> - </dependency> - + <!-- Mysql Connector --> <dependency> <groupId>com.mysql</groupId> @@ -71,7 +64,14 @@ <groupId>com.se</groupId> <artifactId>se-common-log</artifactId> </dependency> - + + <!-- Swagger UI --> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + <version>${swagger.fox.version}</version> + </dependency> + <!-- SE Common Swagger --> <dependency> <groupId>com.se</groupId> @@ -111,6 +111,18 @@ <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> </dependency> + + <!-- Quartz --> + <dependency> + <groupId>org.quartz-scheduler</groupId> + <artifactId>quartz</artifactId> + <exclusions> + <exclusion> + <groupId>com.mchange</groupId> + <artifactId>c3p0</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> <build> diff --git a/se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java b/se-modules/se-system/src/main/java/com/se/system/config/ScheduleConfig.java similarity index 97% rename from se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java rename to se-modules/se-system/src/main/java/com/se/system/config/ScheduleConfig.java index b92a30e..fbe1839 100644 --- a/se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java +++ b/se-modules/se-system/src/main/java/com/se/system/config/ScheduleConfig.java @@ -1,4 +1,4 @@ -//package com.se.job.config; +package com.se.system.config;//package com.se.job.config; // //import java.util.Properties; //import javax.sql.DataSource; diff --git a/se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysJobController.java similarity index 89% rename from se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysJobController.java index 0cddec9..1705a01 100644 --- a/se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java +++ b/se-modules/se-system/src/main/java/com/se/system/controller/SysJobController.java @@ -1,21 +1,5 @@ -package com.se.job.controller; +package com.se.system.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; - -import com.se.job.domain.SysJob; -import com.se.job.service.ISysJobService; -import com.se.job.util.ScheduleUtils; -import org.quartz.SchedulerException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.se.common.core.constant.Constants; import com.se.common.core.exception.job.TaskException; import com.se.common.core.utils.StringUtils; @@ -27,7 +11,16 @@ import com.se.common.log.enums.BusinessType; import com.se.common.security.annotation.RequiresPermissions; import com.se.common.security.utils.SecurityUtils; -import com.se.job.util.CronUtils; +import com.se.system.domain.SysJob; +import com.se.system.service.inte.ISysJobService; +import com.se.system.utils.CronUtils; +import com.se.system.utils.ScheduleUtils; +import org.quartz.SchedulerException; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 璋冨害浠诲姟淇℃伅鎿嶄綔澶勭悊 @@ -38,7 +31,7 @@ @RequestMapping("/job") public class SysJobController extends BaseController { - @Autowired + @Resource private ISysJobService jobService; /** diff --git a/se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysJobLogController.java similarity index 80% rename from se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysJobLogController.java index 3ba97de..73224ef 100644 --- a/se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java +++ b/se-modules/se-system/src/main/java/com/se/system/controller/SysJobLogController.java @@ -1,17 +1,5 @@ -package com.se.job.controller; +package com.se.system.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; - -import com.se.job.domain.SysJobLog; -import com.se.job.service.ISysJobLogService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.se.common.core.utils.poi.ExcelUtil; import com.se.common.core.web.controller.BaseController; import com.se.common.core.web.domain.AjaxResult; @@ -19,6 +7,13 @@ import com.se.common.log.annotation.Log; import com.se.common.log.enums.BusinessType; import com.se.common.security.annotation.RequiresPermissions; +import com.se.system.domain.SysJobLog; +import com.se.system.service.inte.ISysJobLogService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 璋冨害鏃ュ織鎿嶄綔澶勭悊 @@ -29,7 +24,7 @@ @RequestMapping("/job/log") public class SysJobLogController extends BaseController { - @Autowired + @Resource private ISysJobLogService jobLogService; /** diff --git a/se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysJob.java similarity index 98% rename from se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysJob.java index 9fe5163..ce10907 100644 --- a/se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java +++ b/se-modules/se-system/src/main/java/com/se/system/domain/SysJob.java @@ -1,17 +1,18 @@ -package com.se.job.domain; +package com.se.system.domain; -import java.util.Date; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.fasterxml.jackson.annotation.JsonFormat; import com.se.common.core.annotation.Excel; import com.se.common.core.annotation.Excel.ColumnType; import com.se.common.core.constant.ScheduleConstants; import com.se.common.core.utils.StringUtils; import com.se.common.core.web.domain.BaseEntity; -import com.se.job.util.CronUtils; +import com.se.system.utils.CronUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Date; /** * 瀹氭椂浠诲姟璋冨害琛� sys_job diff --git a/se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysJobLog.java similarity index 98% rename from se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysJobLog.java index b08cf99..531b469 100644 --- a/se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java +++ b/se-modules/se-system/src/main/java/com/se/system/domain/SysJobLog.java @@ -1,10 +1,11 @@ -package com.se.job.domain; +package com.se.system.domain; -import java.util.Date; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.se.common.core.annotation.Excel; import com.se.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; /** * 瀹氭椂浠诲姟璋冨害鏃ュ織琛� sys_job_log diff --git a/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysJobLogMapper.java similarity index 94% rename from se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysJobLogMapper.java index 82cb623..01b5c7e 100644 --- a/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java +++ b/se-modules/se-system/src/main/java/com/se/system/mapper/SysJobLogMapper.java @@ -1,7 +1,8 @@ -package com.se.job.mapper; +package com.se.system.mapper; + +import com.se.system.domain.SysJobLog; import java.util.List; -import com.se.job.domain.SysJobLog; /** * 璋冨害浠诲姟鏃ュ織淇℃伅 鏁版嵁灞� diff --git a/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysJobMapper.java similarity index 94% rename from se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysJobMapper.java index 0f99ed6..af20fb8 100644 --- a/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java +++ b/se-modules/se-system/src/main/java/com/se/system/mapper/SysJobMapper.java @@ -1,7 +1,8 @@ -package com.se.job.mapper; +package com.se.system.mapper; + +import com.se.system.domain.SysJob; import java.util.List; -import com.se.job.domain.SysJob; /** * 璋冨害浠诲姟淇℃伅 鏁版嵁灞� diff --git a/se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobLogServiceImpl.java similarity index 87% rename from se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobLogServiceImpl.java index 1dcbd38..d713e1f 100644 --- a/se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java +++ b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobLogServiceImpl.java @@ -1,10 +1,12 @@ -package com.se.job.service; +package com.se.system.service.impl; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; +import com.se.system.domain.SysJobLog; +import com.se.system.mapper.SysJobLogMapper; +import com.se.system.service.inte.ISysJobLogService; import org.springframework.stereotype.Service; -import com.se.job.domain.SysJobLog; -import com.se.job.mapper.SysJobLogMapper; + +import javax.annotation.Resource; +import java.util.List; /** * 瀹氭椂浠诲姟璋冨害鏃ュ織淇℃伅 鏈嶅姟灞� @@ -14,7 +16,7 @@ @Service public class SysJobLogServiceImpl implements ISysJobLogService { - @Autowired + @Resource private SysJobLogMapper jobLogMapper; /** diff --git a/se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobServiceImpl.java similarity index 95% rename from se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobServiceImpl.java index 0e303b4..d9ff60c 100644 --- a/se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java +++ b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysJobServiceImpl.java @@ -1,7 +1,12 @@ -package com.se.job.service; +package com.se.system.service.impl; -import java.util.List; -import javax.annotation.PostConstruct; +import com.se.common.core.constant.ScheduleConstants; +import com.se.common.core.exception.job.TaskException; +import com.se.system.domain.SysJob; +import com.se.system.mapper.SysJobMapper; +import com.se.system.service.inte.ISysJobService; +import com.se.system.utils.CronUtils; +import com.se.system.utils.ScheduleUtils; import org.quartz.JobDataMap; import org.quartz.JobKey; import org.quartz.Scheduler; @@ -9,12 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.se.common.core.constant.ScheduleConstants; -import com.se.common.core.exception.job.TaskException; -import com.se.job.domain.SysJob; -import com.se.job.mapper.SysJobMapper; -import com.se.job.util.CronUtils; -import com.se.job.util.ScheduleUtils; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.List; /** * 瀹氭椂浠诲姟璋冨害淇℃伅 鏈嶅姟灞� @@ -24,10 +27,10 @@ @Service public class SysJobServiceImpl implements ISysJobService { - @Autowired + @Resource private Scheduler scheduler; - @Autowired + @Resource private SysJobMapper jobMapper; /** diff --git a/se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java b/se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobLogService.java similarity index 93% rename from se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java rename to se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobLogService.java index 0cb8913..8543a91 100644 --- a/se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java +++ b/se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobLogService.java @@ -1,7 +1,8 @@ -package com.se.job.service; +package com.se.system.service.inte; + +import com.se.system.domain.SysJobLog; import java.util.List; -import com.se.job.domain.SysJobLog; /** * 瀹氭椂浠诲姟璋冨害鏃ュ織淇℃伅淇℃伅 鏈嶅姟灞� diff --git a/se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java b/se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobService.java similarity index 96% rename from se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java rename to se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobService.java index 1a5afa9..15447ce 100644 --- a/se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java +++ b/se-modules/se-system/src/main/java/com/se/system/service/inte/ISysJobService.java @@ -1,9 +1,10 @@ -package com.se.job.service; +package com.se.system.service.inte; + +import com.se.common.core.exception.job.TaskException; +import com.se.system.domain.SysJob; +import org.quartz.SchedulerException; import java.util.List; -import org.quartz.SchedulerException; -import com.se.common.core.exception.job.TaskException; -import com.se.job.domain.SysJob; /** * 瀹氭椂浠诲姟璋冨害淇℃伅淇℃伅 鏈嶅姟灞� diff --git a/se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java b/se-modules/se-system/src/main/java/com/se/system/utils/AbstractQuartzJob.java similarity index 94% rename from se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java rename to se-modules/se-system/src/main/java/com/se/system/utils/AbstractQuartzJob.java index 39be601..c009ab5 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/AbstractQuartzJob.java @@ -1,20 +1,20 @@ -package com.se.job.util; +package com.se.system.utils; -import java.util.Date; - -import com.se.job.domain.SysJob; -import com.se.job.domain.SysJobLog; -import com.se.job.service.ISysJobLogService; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.se.common.core.constant.ScheduleConstants; import com.se.common.core.utils.ExceptionUtil; import com.se.common.core.utils.SpringUtils; import com.se.common.core.utils.StringUtils; import com.se.common.core.utils.bean.BeanUtils; +import com.se.system.domain.SysJob; +import com.se.system.domain.SysJobLog; +import com.se.system.service.inte.ISysJobLogService; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Date; /** * 鎶借薄quartz璋冪敤 diff --git a/se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java b/se-modules/se-system/src/main/java/com/se/system/utils/CronUtils.java similarity index 97% rename from se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java rename to se-modules/se-system/src/main/java/com/se/system/utils/CronUtils.java index 4590e21..1e23cd6 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/CronUtils.java @@ -1,8 +1,9 @@ -package com.se.job.util; +package com.se.system.utils; + +import org.quartz.CronExpression; import java.text.ParseException; import java.util.Date; -import org.quartz.CronExpression; /** * cron琛ㄨ揪寮忓伐鍏风被 diff --git a/se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java b/se-modules/se-system/src/main/java/com/se/system/utils/JobInvokeUtil.java similarity index 98% rename from se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java rename to se-modules/se-system/src/main/java/com/se/system/utils/JobInvokeUtil.java index 6aaab12..1881cd2 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/JobInvokeUtil.java @@ -1,12 +1,13 @@ -package com.se.job.util; +package com.se.system.utils; + +import com.se.common.core.utils.SpringUtils; +import com.se.common.core.utils.StringUtils; +import com.se.system.domain.SysJob; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.LinkedList; import java.util.List; -import com.se.common.core.utils.SpringUtils; -import com.se.common.core.utils.StringUtils; -import com.se.job.domain.SysJob; /** * 浠诲姟鎵ц宸ュ叿 diff --git a/se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java b/se-modules/se-system/src/main/java/com/se/system/utils/QuartzDisallowConcurrentExecution.java similarity index 86% rename from se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java rename to se-modules/se-system/src/main/java/com/se/system/utils/QuartzDisallowConcurrentExecution.java index 8901480..eadbf93 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/QuartzDisallowConcurrentExecution.java @@ -1,6 +1,6 @@ -package com.se.job.util; +package com.se.system.utils; -import com.se.job.domain.SysJob; +import com.se.system.domain.SysJob; import org.quartz.DisallowConcurrentExecution; import org.quartz.JobExecutionContext; diff --git a/se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java b/se-modules/se-system/src/main/java/com/se/system/utils/QuartzJobExecution.java similarity index 83% rename from se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java rename to se-modules/se-system/src/main/java/com/se/system/utils/QuartzJobExecution.java index 7529ef2..eea20e0 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/QuartzJobExecution.java @@ -1,6 +1,6 @@ -package com.se.job.util; +package com.se.system.utils; -import com.se.job.domain.SysJob; +import com.se.system.domain.SysJob; import org.quartz.JobExecutionContext; /** diff --git a/se-modules/se-job/src/main/java/com/se/job/task/RyTask.java b/se-modules/se-system/src/main/java/com/se/system/utils/RyTask.java similarity index 95% rename from se-modules/se-job/src/main/java/com/se/job/task/RyTask.java rename to se-modules/se-system/src/main/java/com/se/system/utils/RyTask.java index 5293b57..8181c6e 100644 --- a/se-modules/se-job/src/main/java/com/se/job/task/RyTask.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/RyTask.java @@ -1,7 +1,7 @@ -package com.se.job.task; +package com.se.system.utils; -import org.springframework.stereotype.Component; import com.se.common.core.utils.StringUtils; +import org.springframework.stereotype.Component; /** * 瀹氭椂浠诲姟璋冨害娴嬭瘯 diff --git a/se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java b/se-modules/se-system/src/main/java/com/se/system/utils/ScheduleUtils.java similarity index 98% rename from se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java rename to se-modules/se-system/src/main/java/com/se/system/utils/ScheduleUtils.java index 6a50822..3429718 100644 --- a/se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java +++ b/se-modules/se-system/src/main/java/com/se/system/utils/ScheduleUtils.java @@ -1,6 +1,6 @@ -package com.se.job.util; +package com.se.system.utils; -import com.se.job.domain.SysJob; +import com.se.system.domain.SysJob; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.Job; -- Gitblit v1.9.3