fase()规范化
parent
a9aa680abe
commit
91ceda487b
|
@ -21,5 +21,5 @@ public class ServiceNameConstants {
|
|||
*/
|
||||
public static final String FILE_SERVICE = "muyu-file";
|
||||
|
||||
public static final String TEST_MUYU = "muyu-test";
|
||||
public static final String EDITION_MUYU = "muyu-edition";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
@EnableCustomSwagger2
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class MuYuFileApplication {
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuFileApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,40 +33,40 @@ public class MinioConfig {
|
|||
*/
|
||||
private String bucketName;
|
||||
|
||||
public String getUrl () {
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl (String url) {
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAccessKey () {
|
||||
public String getAccessKey() {
|
||||
return accessKey;
|
||||
}
|
||||
|
||||
public void setAccessKey (String accessKey) {
|
||||
public void setAccessKey(String accessKey) {
|
||||
this.accessKey = accessKey;
|
||||
}
|
||||
|
||||
public String getSecretKey () {
|
||||
public String getSecretKey() {
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
public void setSecretKey (String secretKey) {
|
||||
public void setSecretKey(String secretKey) {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public String getBucketName () {
|
||||
public String getBucketName() {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public void setBucketName (String bucketName) {
|
||||
public void setBucketName(String bucketName) {
|
||||
this.bucketName = bucketName;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MinioClient getMinioClient () {
|
||||
public MinioClient getMinioClient() {
|
||||
return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
|||
private String localFilePath;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers (ResourceHandlerRegistry registry) {
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
/** 本地文件上传路径 */
|
||||
registry.addResourceHandler(localFilePrefix + "/**")
|
||||
.addResourceLocations("file:" + localFilePath + File.separator);
|
||||
|
@ -37,7 +37,7 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
|||
* 开启跨域
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings (CorsRegistry registry) {
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
// 设置允许跨域的路由
|
||||
registry.addMapping(localFilePrefix + "/**")
|
||||
// 设置允许跨域请求的域名
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.muyu.file.controller;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.file.FileUtils;
|
||||
import com.muyu.file.service.ISysFileService;
|
||||
import com.muyu.common.system.domain.SysFile;
|
||||
import com.muyu.file.service.ISysFileService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -27,7 +27,7 @@ public class SysFileController {
|
|||
* 文件上传请求
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public Result<SysFile> upload (MultipartFile file) {
|
||||
public Result<SysFile> upload(MultipartFile file) {
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
String url = sysFileService.uploadFile(file);
|
||||
|
|
|
@ -31,13 +31,11 @@ public class FastDfsSysFileServiceImpl implements ISysFileService {
|
|||
* FastDfs文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @return 访问地址
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile (MultipartFile file) throws Exception {
|
||||
public String uploadFile(MultipartFile file) throws Exception {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
|
||||
FileTypeUtils.getExtension(file), null);
|
||||
|
|
|
@ -12,10 +12,8 @@ public interface ISysFileService {
|
|||
* 文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @return 访问地址
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile (MultipartFile file) throws Exception;
|
||||
public String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
|
|
@ -36,13 +36,11 @@ public class LocalSysFileServiceImpl implements ISysFileService {
|
|||
* 本地文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @return 访问地址
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile (MultipartFile file) throws Exception {
|
||||
public String uploadFile(MultipartFile file) throws Exception {
|
||||
String name = FileUploadUtils.upload(localFilePath, file);
|
||||
String url = domain + localFilePrefix + name;
|
||||
return url;
|
||||
|
|
|
@ -28,13 +28,11 @@ public class MinioSysFileServiceImpl implements ISysFileService {
|
|||
* Minio文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @return 访问地址
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile (MultipartFile file) throws Exception {
|
||||
public String uploadFile(MultipartFile file) throws Exception {
|
||||
String fileName = FileUploadUtils.extractFilename(file);
|
||||
InputStream inputStream = file.getInputStream();
|
||||
PutObjectArgs args = PutObjectArgs.builder()
|
||||
|
|
|
@ -38,12 +38,10 @@ public class FileUploadUtils {
|
|||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @return 文件名称
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final String upload (String baseDir, MultipartFile file) 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) {
|
||||
|
@ -59,15 +57,13 @@ public class FileUploadUtils {
|
|||
* @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)
|
||||
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
||||
InvalidExtensionException {
|
||||
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
|
||||
|
@ -87,12 +83,12 @@ public class FileUploadUtils {
|
|||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
public static final String extractFilename (MultipartFile file) {
|
||||
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 {
|
||||
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
|
||||
File desc = new File(uploadDir + File.separator + fileName);
|
||||
|
||||
if (!desc.exists()) {
|
||||
|
@ -103,7 +99,7 @@ public class FileUploadUtils {
|
|||
return desc.isAbsolute() ? desc : desc.getAbsoluteFile();
|
||||
}
|
||||
|
||||
private static final String getPathFileName (String fileName) throws IOException {
|
||||
private static final String getPathFileName(String fileName) throws IOException {
|
||||
String pathFileName = "/" + fileName;
|
||||
return pathFileName;
|
||||
}
|
||||
|
@ -112,11 +108,10 @@ public class FileUploadUtils {
|
|||
* 文件大小校验
|
||||
*
|
||||
* @param file 上传的文件
|
||||
*
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws InvalidExtensionException 文件校验异常
|
||||
*/
|
||||
public static final void assertAllowed (MultipartFile file, String[] allowedExtension)
|
||||
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, InvalidExtensionException {
|
||||
long size = file.getSize();
|
||||
if (size > DEFAULT_MAX_SIZE) {
|
||||
|
@ -149,10 +144,9 @@ public class FileUploadUtils {
|
|||
*
|
||||
* @param extension 上传文件类型
|
||||
* @param allowedExtension 允许上传文件类型
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
public static final boolean isAllowedExtension (String extension, String[] allowedExtension) {
|
||||
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
|
||||
for (String str : allowedExtension) {
|
||||
if (str.equalsIgnoreCase(extension)) {
|
||||
return true;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuGenApplication {
|
||||
public static void main (String[] args) {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuGenApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,35 +31,35 @@ public class GenConfig {
|
|||
*/
|
||||
public static String tablePrefix;
|
||||
|
||||
public static String getAuthor () {
|
||||
public static String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor (String author) {
|
||||
public void setAuthor(String author) {
|
||||
GenConfig.author = author;
|
||||
}
|
||||
|
||||
public static String getPackageName () {
|
||||
public static String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void setPackageName (String packageName) {
|
||||
public void setPackageName(String packageName) {
|
||||
GenConfig.packageName = packageName;
|
||||
}
|
||||
|
||||
public static boolean getAutoRemovePre () {
|
||||
public static boolean getAutoRemovePre() {
|
||||
return autoRemovePre;
|
||||
}
|
||||
|
||||
public void setAutoRemovePre (boolean autoRemovePre) {
|
||||
public void setAutoRemovePre(boolean autoRemovePre) {
|
||||
GenConfig.autoRemovePre = autoRemovePre;
|
||||
}
|
||||
|
||||
public static String getTablePrefix () {
|
||||
public static String getTablePrefix() {
|
||||
return tablePrefix;
|
||||
}
|
||||
|
||||
public void setTablePrefix (String tablePrefix) {
|
||||
public void setTablePrefix(String tablePrefix) {
|
||||
GenConfig.tablePrefix = tablePrefix;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.muyu.gen.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
|
@ -41,7 +41,7 @@ public class GenController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<GenTable>> genList (GenTable genTable) {
|
||||
public Result<TableDataInfo<GenTable>> genList(GenTable genTable) {
|
||||
startPage();
|
||||
List<GenTable> list = genTableService.selectGenTableList(genTable);
|
||||
return getDataTable(list);
|
||||
|
@ -52,7 +52,7 @@ public class GenController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:query")
|
||||
@GetMapping(value = "/{tableId}")
|
||||
public Result getInfo (@PathVariable Long tableId) {
|
||||
public Result getInfo(@PathVariable Long tableId) {
|
||||
GenTable table = genTableService.selectGenTableById(tableId);
|
||||
List<GenTable> tables = genTableService.selectGenTableAll();
|
||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||
|
@ -68,7 +68,7 @@ public class GenController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@GetMapping("/db/list")
|
||||
public Result<TableDataInfo<GenTable>> dataList (GenTable genTable) {
|
||||
public Result<TableDataInfo<GenTable>> dataList(GenTable genTable) {
|
||||
startPage();
|
||||
List<GenTable> list = genTableService.selectDbTableList(genTable);
|
||||
return getDataTable(list);
|
||||
|
@ -78,7 +78,7 @@ public class GenController extends BaseController {
|
|||
* 查询数据表字段列表
|
||||
*/
|
||||
@GetMapping(value = "/column/{tableId}")
|
||||
public Result<TableDataInfo<GenTableColumn>> columnList (Long tableId) {
|
||||
public Result<TableDataInfo<GenTableColumn>> columnList(Long tableId) {
|
||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||
return Result.success(
|
||||
TableDataInfo.<GenTableColumn>builder()
|
||||
|
@ -94,7 +94,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:import")
|
||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importTable")
|
||||
public Result importTableSave (String tables) {
|
||||
public Result importTableSave(String tables) {
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
// 查询表信息
|
||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
||||
|
@ -108,7 +108,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result editSave (@Validated @RequestBody GenTable genTable) {
|
||||
public Result editSave(@Validated @RequestBody GenTable genTable) {
|
||||
genTableService.validateEdit(genTable);
|
||||
genTableService.updateGenTable(genTable);
|
||||
return success();
|
||||
|
@ -120,7 +120,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:remove")
|
||||
@Log(title = "代码生成", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{tableIds}")
|
||||
public Result remove (@PathVariable Long[] tableIds) {
|
||||
public Result remove(@PathVariable Long[] tableIds) {
|
||||
genTableService.deleteGenTableByIds(tableIds);
|
||||
return success();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class GenController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("tool:gen:preview")
|
||||
@GetMapping("/preview/{tableId}")
|
||||
public Result preview (@PathVariable("tableId") Long tableId) throws IOException {
|
||||
public Result preview(@PathVariable("tableId") Long tableId) throws IOException {
|
||||
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
||||
return success(dataMap);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/download/{tableName}")
|
||||
public void download (HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||
byte[] data = genTableService.downloadCode(tableName);
|
||||
genCode(response, data);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/genCode/{tableName}")
|
||||
public Result genCode (@PathVariable("tableName") String tableName) {
|
||||
public Result genCode(@PathVariable("tableName") String tableName) {
|
||||
genTableService.generatorCode(tableName);
|
||||
return success();
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/synchDb/{tableName}")
|
||||
public Result synchDb (@PathVariable("tableName") String tableName) {
|
||||
public Result synchDb(@PathVariable("tableName") String tableName) {
|
||||
genTableService.synchDb(tableName);
|
||||
return success();
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class GenController extends BaseController {
|
|||
@RequiresPermissions("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/batchGenCode")
|
||||
public void batchGenCode (HttpServletResponse response, String tables) throws IOException {
|
||||
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
byte[] data = genTableService.downloadCode(tableNames);
|
||||
genCode(response, data);
|
||||
|
@ -183,7 +183,7 @@ public class GenController extends BaseController {
|
|||
/**
|
||||
* 生成zip文件
|
||||
*/
|
||||
private void genCode (HttpServletResponse response, byte[] data) throws IOException {
|
||||
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"muyu.zip\"");
|
||||
response.addHeader("Content-Length", String.valueOf(data.length));
|
||||
|
|
|
@ -15,8 +15,6 @@ import javax.validation.constraints.NotBlank;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 业务表 gen_table
|
||||
*
|
||||
|
@ -154,19 +152,19 @@ public class GenTable extends BaseEntity {
|
|||
*/
|
||||
private String parentMenuName;
|
||||
|
||||
public static boolean isSub (String tplCategory) {
|
||||
public static boolean isSub(String tplCategory) {
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
|
||||
}
|
||||
|
||||
public static boolean isTree (String tplCategory) {
|
||||
public static boolean isTree(String tplCategory) {
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
|
||||
}
|
||||
|
||||
public static boolean isCrud (String tplCategory) {
|
||||
public static boolean isCrud(String tplCategory) {
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
|
||||
}
|
||||
|
||||
public static boolean isSuperColumn (String tplCategory, String javaField) {
|
||||
public static boolean isSuperColumn(String tplCategory, String javaField) {
|
||||
if (isTree(tplCategory)) {
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField,
|
||||
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
|
||||
|
@ -174,203 +172,203 @@ public class GenTable extends BaseEntity {
|
|||
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
|
||||
}
|
||||
|
||||
public Long getTableId () {
|
||||
public Long getTableId() {
|
||||
return tableId;
|
||||
}
|
||||
|
||||
public void setTableId (Long tableId) {
|
||||
public void setTableId(Long tableId) {
|
||||
this.tableId = tableId;
|
||||
}
|
||||
|
||||
public String getTableName () {
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName (String tableName) {
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public String getTableComment () {
|
||||
public String getTableComment() {
|
||||
return tableComment;
|
||||
}
|
||||
|
||||
public void setTableComment (String tableComment) {
|
||||
public void setTableComment(String tableComment) {
|
||||
this.tableComment = tableComment;
|
||||
}
|
||||
|
||||
public String getSubTableName () {
|
||||
public String getSubTableName() {
|
||||
return subTableName;
|
||||
}
|
||||
|
||||
public void setSubTableName (String subTableName) {
|
||||
public void setSubTableName(String subTableName) {
|
||||
this.subTableName = subTableName;
|
||||
}
|
||||
|
||||
public String getSubTableFkName () {
|
||||
public String getSubTableFkName() {
|
||||
return subTableFkName;
|
||||
}
|
||||
|
||||
public void setSubTableFkName (String subTableFkName) {
|
||||
public void setSubTableFkName(String subTableFkName) {
|
||||
this.subTableFkName = subTableFkName;
|
||||
}
|
||||
|
||||
public String getClassName () {
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName (String className) {
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getTplCategory () {
|
||||
public String getTplCategory() {
|
||||
return tplCategory;
|
||||
}
|
||||
|
||||
public void setTplCategory (String tplCategory) {
|
||||
public void setTplCategory(String tplCategory) {
|
||||
this.tplCategory = tplCategory;
|
||||
}
|
||||
|
||||
public String getPackageName () {
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void setPackageName (String packageName) {
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public String getModuleName () {
|
||||
public String getModuleName() {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
public void setModuleName (String moduleName) {
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public String getBusinessName () {
|
||||
public String getBusinessName() {
|
||||
return businessName;
|
||||
}
|
||||
|
||||
public void setBusinessName (String businessName) {
|
||||
public void setBusinessName(String businessName) {
|
||||
this.businessName = businessName;
|
||||
}
|
||||
|
||||
public String getFunctionName () {
|
||||
public String getFunctionName() {
|
||||
return functionName;
|
||||
}
|
||||
|
||||
public void setFunctionName (String functionName) {
|
||||
public void setFunctionName(String functionName) {
|
||||
this.functionName = functionName;
|
||||
}
|
||||
|
||||
public String getFunctionAuthor () {
|
||||
public String getFunctionAuthor() {
|
||||
return functionAuthor;
|
||||
}
|
||||
|
||||
public void setFunctionAuthor (String functionAuthor) {
|
||||
public void setFunctionAuthor(String functionAuthor) {
|
||||
this.functionAuthor = functionAuthor;
|
||||
}
|
||||
|
||||
public String getGenType () {
|
||||
public String getGenType() {
|
||||
return genType;
|
||||
}
|
||||
|
||||
public void setGenType (String genType) {
|
||||
public void setGenType(String genType) {
|
||||
this.genType = genType;
|
||||
}
|
||||
|
||||
public String getGenPath () {
|
||||
public String getGenPath() {
|
||||
return genPath;
|
||||
}
|
||||
|
||||
public void setGenPath (String genPath) {
|
||||
public void setGenPath(String genPath) {
|
||||
this.genPath = genPath;
|
||||
}
|
||||
|
||||
public GenTableColumn getPkColumn () {
|
||||
public GenTableColumn getPkColumn() {
|
||||
return pkColumn;
|
||||
}
|
||||
|
||||
public void setPkColumn (GenTableColumn pkColumn) {
|
||||
public void setPkColumn(GenTableColumn pkColumn) {
|
||||
this.pkColumn = pkColumn;
|
||||
}
|
||||
|
||||
public GenTable getSubTable () {
|
||||
public GenTable getSubTable() {
|
||||
return subTable;
|
||||
}
|
||||
|
||||
public void setSubTable (GenTable subTable) {
|
||||
public void setSubTable(GenTable subTable) {
|
||||
this.subTable = subTable;
|
||||
}
|
||||
|
||||
public List<GenTableColumn> getColumns () {
|
||||
public List<GenTableColumn> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void setColumns (List<GenTableColumn> columns) {
|
||||
public void setColumns(List<GenTableColumn> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public String getOptions () {
|
||||
public String getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions (String options) {
|
||||
public void setOptions(String options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public String getTreeCode () {
|
||||
public String getTreeCode() {
|
||||
return treeCode;
|
||||
}
|
||||
|
||||
public void setTreeCode (String treeCode) {
|
||||
public void setTreeCode(String treeCode) {
|
||||
this.treeCode = treeCode;
|
||||
}
|
||||
|
||||
public String getTreeParentCode () {
|
||||
public String getTreeParentCode() {
|
||||
return treeParentCode;
|
||||
}
|
||||
|
||||
public void setTreeParentCode (String treeParentCode) {
|
||||
public void setTreeParentCode(String treeParentCode) {
|
||||
this.treeParentCode = treeParentCode;
|
||||
}
|
||||
|
||||
public String getTreeName () {
|
||||
public String getTreeName() {
|
||||
return treeName;
|
||||
}
|
||||
|
||||
public void setTreeName (String treeName) {
|
||||
public void setTreeName(String treeName) {
|
||||
this.treeName = treeName;
|
||||
}
|
||||
|
||||
public String getParentMenuId () {
|
||||
public String getParentMenuId() {
|
||||
return parentMenuId;
|
||||
}
|
||||
|
||||
public void setParentMenuId (String parentMenuId) {
|
||||
public void setParentMenuId(String parentMenuId) {
|
||||
this.parentMenuId = parentMenuId;
|
||||
}
|
||||
|
||||
public String getParentMenuName () {
|
||||
public String getParentMenuName() {
|
||||
return parentMenuName;
|
||||
}
|
||||
|
||||
public void setParentMenuName (String parentMenuName) {
|
||||
public void setParentMenuName(String parentMenuName) {
|
||||
this.parentMenuName = parentMenuName;
|
||||
}
|
||||
|
||||
public boolean isSub () {
|
||||
public boolean isSub() {
|
||||
return isSub(this.tplCategory);
|
||||
}
|
||||
|
||||
public boolean isTree () {
|
||||
public boolean isTree() {
|
||||
return isTree(this.tplCategory);
|
||||
}
|
||||
|
||||
public boolean isCrud () {
|
||||
public boolean isCrud() {
|
||||
return isCrud(this.tplCategory);
|
||||
}
|
||||
|
||||
public boolean isSuperColumn (String javaField) {
|
||||
public boolean isSuperColumn(String javaField) {
|
||||
return isSuperColumn(this.tplCategory, javaField);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class GenTableColumn extends BaseEntity {
|
|||
*/
|
||||
private Integer sort;
|
||||
|
||||
public static boolean isSuperColumn (String javaField) {
|
||||
public static boolean isSuperColumn(String javaField) {
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField,
|
||||
// BaseEntity
|
||||
"createBy", "createTime", "updateBy", "updateTime", "remark",
|
||||
|
@ -122,224 +122,224 @@ public class GenTableColumn extends BaseEntity {
|
|||
"parentName", "parentId", "orderNum", "ancestors");
|
||||
}
|
||||
|
||||
public static boolean isUsableColumn (String javaField) {
|
||||
public static boolean isUsableColumn(String javaField) {
|
||||
// isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
|
||||
}
|
||||
|
||||
public Long getColumnId () {
|
||||
public Long getColumnId() {
|
||||
return columnId;
|
||||
}
|
||||
|
||||
public void setColumnId (Long columnId) {
|
||||
public void setColumnId(Long columnId) {
|
||||
this.columnId = columnId;
|
||||
}
|
||||
|
||||
public Long getTableId () {
|
||||
public Long getTableId() {
|
||||
return tableId;
|
||||
}
|
||||
|
||||
public void setTableId (Long tableId) {
|
||||
public void setTableId(Long tableId) {
|
||||
this.tableId = tableId;
|
||||
}
|
||||
|
||||
public String getColumnName () {
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
}
|
||||
|
||||
public void setColumnName (String columnName) {
|
||||
public void setColumnName(String columnName) {
|
||||
this.columnName = columnName;
|
||||
}
|
||||
|
||||
public String getColumnComment () {
|
||||
public String getColumnComment() {
|
||||
return columnComment;
|
||||
}
|
||||
|
||||
public void setColumnComment (String columnComment) {
|
||||
public void setColumnComment(String columnComment) {
|
||||
this.columnComment = columnComment;
|
||||
}
|
||||
|
||||
public String getColumnType () {
|
||||
public String getColumnType() {
|
||||
return columnType;
|
||||
}
|
||||
|
||||
public void setColumnType (String columnType) {
|
||||
public void setColumnType(String columnType) {
|
||||
this.columnType = columnType;
|
||||
}
|
||||
|
||||
public String getJavaType () {
|
||||
public String getJavaType() {
|
||||
return javaType;
|
||||
}
|
||||
|
||||
public void setJavaType (String javaType) {
|
||||
public void setJavaType(String javaType) {
|
||||
this.javaType = javaType;
|
||||
}
|
||||
|
||||
public String getJavaField () {
|
||||
public String getJavaField() {
|
||||
return javaField;
|
||||
}
|
||||
|
||||
public void setJavaField (String javaField) {
|
||||
public void setJavaField(String javaField) {
|
||||
this.javaField = javaField;
|
||||
}
|
||||
|
||||
public String getCapJavaField () {
|
||||
public String getCapJavaField() {
|
||||
return StringUtils.capitalize(javaField);
|
||||
}
|
||||
|
||||
public String getIsPk () {
|
||||
public String getIsPk() {
|
||||
return isPk;
|
||||
}
|
||||
|
||||
public void setIsPk (String isPk) {
|
||||
public void setIsPk(String isPk) {
|
||||
this.isPk = isPk;
|
||||
}
|
||||
|
||||
public boolean isPk () {
|
||||
public boolean isPk() {
|
||||
return isPk(this.isPk);
|
||||
}
|
||||
|
||||
public boolean isPk (String isPk) {
|
||||
public boolean isPk(String isPk) {
|
||||
return isPk != null && StringUtils.equals("1", isPk);
|
||||
}
|
||||
|
||||
public String getIsIncrement () {
|
||||
public String getIsIncrement() {
|
||||
return isIncrement;
|
||||
}
|
||||
|
||||
public void setIsIncrement (String isIncrement) {
|
||||
public void setIsIncrement(String isIncrement) {
|
||||
this.isIncrement = isIncrement;
|
||||
}
|
||||
|
||||
public boolean isIncrement () {
|
||||
public boolean isIncrement() {
|
||||
return isIncrement(this.isIncrement);
|
||||
}
|
||||
|
||||
public boolean isIncrement (String isIncrement) {
|
||||
public boolean isIncrement(String isIncrement) {
|
||||
return isIncrement != null && StringUtils.equals("1", isIncrement);
|
||||
}
|
||||
|
||||
public String getIsRequired () {
|
||||
public String getIsRequired() {
|
||||
return isRequired;
|
||||
}
|
||||
|
||||
public void setIsRequired (String isRequired) {
|
||||
public void setIsRequired(String isRequired) {
|
||||
this.isRequired = isRequired;
|
||||
}
|
||||
|
||||
public boolean isRequired () {
|
||||
public boolean isRequired() {
|
||||
return isRequired(this.isRequired);
|
||||
}
|
||||
|
||||
public boolean isRequired (String isRequired) {
|
||||
public boolean isRequired(String isRequired) {
|
||||
return isRequired != null && StringUtils.equals("1", isRequired);
|
||||
}
|
||||
|
||||
public String getIsInsert () {
|
||||
public String getIsInsert() {
|
||||
return isInsert;
|
||||
}
|
||||
|
||||
public void setIsInsert (String isInsert) {
|
||||
public void setIsInsert(String isInsert) {
|
||||
this.isInsert = isInsert;
|
||||
}
|
||||
|
||||
public boolean isInsert () {
|
||||
public boolean isInsert() {
|
||||
return isInsert(this.isInsert);
|
||||
}
|
||||
|
||||
public boolean isInsert (String isInsert) {
|
||||
public boolean isInsert(String isInsert) {
|
||||
return isInsert != null && StringUtils.equals("1", isInsert);
|
||||
}
|
||||
|
||||
public String getIsEdit () {
|
||||
public String getIsEdit() {
|
||||
return isEdit;
|
||||
}
|
||||
|
||||
public void setIsEdit (String isEdit) {
|
||||
public void setIsEdit(String isEdit) {
|
||||
this.isEdit = isEdit;
|
||||
}
|
||||
|
||||
public boolean isEdit () {
|
||||
public boolean isEdit() {
|
||||
return isInsert(this.isEdit);
|
||||
}
|
||||
|
||||
public boolean isEdit (String isEdit) {
|
||||
public boolean isEdit(String isEdit) {
|
||||
return isEdit != null && StringUtils.equals("1", isEdit);
|
||||
}
|
||||
|
||||
public String getIsList () {
|
||||
public String getIsList() {
|
||||
return isList;
|
||||
}
|
||||
|
||||
public void setIsList (String isList) {
|
||||
public void setIsList(String isList) {
|
||||
this.isList = isList;
|
||||
}
|
||||
|
||||
public boolean isList () {
|
||||
public boolean isList() {
|
||||
return isList(this.isList);
|
||||
}
|
||||
|
||||
public boolean isList (String isList) {
|
||||
public boolean isList(String isList) {
|
||||
return isList != null && StringUtils.equals("1", isList);
|
||||
}
|
||||
|
||||
public String getIsQuery () {
|
||||
public String getIsQuery() {
|
||||
return isQuery;
|
||||
}
|
||||
|
||||
public void setIsQuery (String isQuery) {
|
||||
public void setIsQuery(String isQuery) {
|
||||
this.isQuery = isQuery;
|
||||
}
|
||||
|
||||
public boolean isQuery () {
|
||||
public boolean isQuery() {
|
||||
return isQuery(this.isQuery);
|
||||
}
|
||||
|
||||
public boolean isQuery (String isQuery) {
|
||||
public boolean isQuery(String isQuery) {
|
||||
return isQuery != null && StringUtils.equals("1", isQuery);
|
||||
}
|
||||
|
||||
public String getQueryType () {
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
|
||||
public void setQueryType (String queryType) {
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
|
||||
public String getHtmlType () {
|
||||
public String getHtmlType() {
|
||||
return htmlType;
|
||||
}
|
||||
|
||||
public void setHtmlType (String htmlType) {
|
||||
public void setHtmlType(String htmlType) {
|
||||
this.htmlType = htmlType;
|
||||
}
|
||||
|
||||
public String getDictType () {
|
||||
public String getDictType() {
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType (String dictType) {
|
||||
public void setDictType(String dictType) {
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
public Integer getSort () {
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort (Integer sort) {
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public boolean isSuperColumn () {
|
||||
public boolean isSuperColumn() {
|
||||
return isSuperColumn(this.javaField);
|
||||
}
|
||||
|
||||
public boolean isUsableColumn () {
|
||||
public boolean isUsableColumn() {
|
||||
return isUsableColumn(javaField);
|
||||
}
|
||||
|
||||
public String readConverterExp () {
|
||||
public String readConverterExp() {
|
||||
String remarks = StringUtils.substringBetween(this.columnComment, "(", ")");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (StringUtils.isNotEmpty(remarks)) {
|
||||
|
|
|
@ -15,53 +15,47 @@ public interface GenTableColumnMapper extends BaseMapper<GenTableColumn> {
|
|||
* 根据表名称查询列信息
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 列信息
|
||||
*/
|
||||
List<GenTableColumn> selectDbTableColumnsByName (String tableName);
|
||||
List<GenTableColumn> selectDbTableColumnsByName(String tableName);
|
||||
|
||||
/**
|
||||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId);
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
|
||||
|
||||
/**
|
||||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTableColumn (GenTableColumn genTableColumn);
|
||||
int insertGenTableColumn(GenTableColumn genTableColumn);
|
||||
|
||||
/**
|
||||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTableColumn (GenTableColumn genTableColumn);
|
||||
int updateGenTableColumn(GenTableColumn genTableColumn);
|
||||
|
||||
/**
|
||||
* 删除业务字段
|
||||
*
|
||||
* @param genTableColumns 列数据
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumns (List<GenTableColumn> genTableColumns);
|
||||
int deleteGenTableColumns(List<GenTableColumn> genTableColumns);
|
||||
|
||||
/**
|
||||
* 批量删除业务字段
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumnByIds (Long[] ids);
|
||||
int deleteGenTableColumnByIds(Long[] ids);
|
||||
}
|
||||
|
|
|
@ -15,78 +15,70 @@ public interface GenTableMapper extends BaseMapper<GenTable> {
|
|||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
List<GenTable> selectGenTableList (GenTable genTable);
|
||||
List<GenTable> selectGenTableList(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableList (GenTable genTable);
|
||||
List<GenTable> selectDbTableList(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableListByNames (String[] tableNames);
|
||||
List<GenTable> selectDbTableListByNames(String[] tableNames);
|
||||
|
||||
/**
|
||||
* 查询所有表信息
|
||||
*
|
||||
* @return 表信息集合
|
||||
*/
|
||||
List<GenTable> selectGenTableAll ();
|
||||
List<GenTable> selectGenTableAll();
|
||||
|
||||
/**
|
||||
* 查询表ID业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableById (Long id);
|
||||
GenTable selectGenTableById(Long id);
|
||||
|
||||
/**
|
||||
* 查询表名称业务信息
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableByName (String tableName);
|
||||
GenTable selectGenTableByName(String tableName);
|
||||
|
||||
/**
|
||||
* 新增业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTable (GenTable genTable);
|
||||
int insertGenTable(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTable (GenTable genTable);
|
||||
int updateGenTable(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 批量删除业务
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableByIds (Long[] ids);
|
||||
int deleteGenTableByIds(Long[] ids);
|
||||
}
|
||||
|
|
|
@ -22,11 +22,10 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
|
|||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId) {
|
||||
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) {
|
||||
return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
|
||||
}
|
||||
|
||||
|
@ -34,11 +33,10 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
|
|||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGenTableColumn (GenTableColumn genTableColumn) {
|
||||
public int insertGenTableColumn(GenTableColumn genTableColumn) {
|
||||
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
|
||||
}
|
||||
|
||||
|
@ -46,11 +44,10 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
|
|||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGenTableColumn (GenTableColumn genTableColumn) {
|
||||
public int updateGenTableColumn(GenTableColumn genTableColumn) {
|
||||
return genTableColumnMapper.updateGenTableColumn(genTableColumn);
|
||||
}
|
||||
|
||||
|
@ -58,11 +55,10 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
|
|||
* 删除业务字段对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGenTableColumnByIds (String ids) {
|
||||
public int deleteGenTableColumnByIds(String ids) {
|
||||
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,10 +58,9 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*
|
||||
* @param table 业务表信息
|
||||
* @param template 模板文件路径
|
||||
*
|
||||
* @return 生成地址
|
||||
*/
|
||||
public static String getGenPath (GenTable table, String template) {
|
||||
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);
|
||||
|
@ -73,11 +72,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 查询业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
@Override
|
||||
public GenTable selectGenTableById (Long id) {
|
||||
public GenTable selectGenTableById(Long id) {
|
||||
GenTable genTable = genTableMapper.selectGenTableById(id);
|
||||
setTableFromOptions(genTable);
|
||||
return genTable;
|
||||
|
@ -87,11 +85,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectGenTableList (GenTable genTable) {
|
||||
public List<GenTable> selectGenTableList(GenTable genTable) {
|
||||
return genTableMapper.selectGenTableList(genTable);
|
||||
}
|
||||
|
||||
|
@ -99,11 +96,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectDbTableList (GenTable genTable) {
|
||||
public List<GenTable> selectDbTableList(GenTable genTable) {
|
||||
return genTableMapper.selectDbTableList(genTable);
|
||||
}
|
||||
|
||||
|
@ -111,11 +107,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectDbTableListByNames (String[] tableNames) {
|
||||
public List<GenTable> selectDbTableListByNames(String[] tableNames) {
|
||||
return genTableMapper.selectDbTableListByNames(tableNames);
|
||||
}
|
||||
|
||||
|
@ -125,7 +120,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* @return 表信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<GenTable> selectGenTableAll () {
|
||||
public List<GenTable> selectGenTableAll() {
|
||||
return genTableMapper.selectGenTableAll();
|
||||
}
|
||||
|
||||
|
@ -133,12 +128,11 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGenTable (GenTable genTable) {
|
||||
public void updateGenTable(GenTable genTable) {
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
genTable.setOptions(options);
|
||||
int row = genTableMapper.updateGenTable(genTable);
|
||||
|
@ -153,12 +147,11 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 删除业务对象
|
||||
*
|
||||
* @param tableIds 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteGenTableByIds (Long[] tableIds) {
|
||||
public void deleteGenTableByIds(Long[] tableIds) {
|
||||
genTableMapper.deleteGenTableByIds(tableIds);
|
||||
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
|
||||
}
|
||||
|
@ -170,7 +163,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importGenTable (List<GenTable> tableList) {
|
||||
public void importGenTable(List<GenTable> tableList) {
|
||||
String operName = SecurityUtils.getUsername();
|
||||
try {
|
||||
for (GenTable table : tableList) {
|
||||
|
@ -195,11 +188,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 预览代码
|
||||
*
|
||||
* @param tableId 表编号
|
||||
*
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> previewCode (Long tableId) {
|
||||
public Map<String, String> previewCode(Long tableId) {
|
||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableById(tableId);
|
||||
|
@ -227,11 +219,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 生成代码(下载方式)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadCode (String tableName) {
|
||||
public byte[] downloadCode(String tableName) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
generatorCode(tableName, zip);
|
||||
|
@ -245,7 +236,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* @param tableName 表名称
|
||||
*/
|
||||
@Override
|
||||
public void generatorCode (String tableName) {
|
||||
public void generatorCode(String tableName) {
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
// 设置主子表信息
|
||||
|
@ -282,7 +273,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void synchDb (String tableName) {
|
||||
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()));
|
||||
|
@ -326,11 +317,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* 批量生成代码(下载方式)
|
||||
*
|
||||
* @param tableNames 表数组
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadCode (String[] tableNames) {
|
||||
public byte[] downloadCode(String[] tableNames) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
for (String tableName : tableNames) {
|
||||
|
@ -343,7 +333,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
/**
|
||||
* 查询表信息并生成代码
|
||||
*/
|
||||
private void generatorCode (String tableName, ZipOutputStream zip) {
|
||||
private void generatorCode(String tableName, ZipOutputStream zip) {
|
||||
// 查询表信息
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
// 设置主子表信息
|
||||
|
@ -381,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
* @param genTable 业务信息
|
||||
*/
|
||||
@Override
|
||||
public void validateEdit (GenTable genTable) {
|
||||
public void validateEdit(GenTable genTable) {
|
||||
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
JSONObject paramsObj = JSON.parseObject(options);
|
||||
|
@ -406,7 +396,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
public void setPkColumn (GenTable table) {
|
||||
public void setPkColumn(GenTable table) {
|
||||
for (GenTableColumn column : table.getColumns()) {
|
||||
if (column.isPk()) {
|
||||
table.setPkColumn(column);
|
||||
|
@ -434,7 +424,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
public void setSubTable (GenTable table) {
|
||||
public void setSubTable(GenTable table) {
|
||||
String subTableName = table.getSubTableName();
|
||||
if (StringUtils.isNotEmpty(subTableName)) {
|
||||
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
|
||||
|
@ -446,7 +436,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*
|
||||
* @param genTable 设置后的生成对象
|
||||
*/
|
||||
public void setTableFromOptions (GenTable genTable) {
|
||||
public void setTableFromOptions(GenTable genTable) {
|
||||
JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
|
||||
if (StringUtils.isNotNull(paramsObj)) {
|
||||
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
|
||||
|
|
|
@ -14,35 +14,31 @@ public interface IGenTableColumnService {
|
|||
* 查询业务字段列表
|
||||
*
|
||||
* @param tableId 业务字段编号
|
||||
*
|
||||
* @return 业务字段集合
|
||||
*/
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId (Long tableId);
|
||||
List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
|
||||
|
||||
/**
|
||||
* 新增业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int insertGenTableColumn (GenTableColumn genTableColumn);
|
||||
int insertGenTableColumn(GenTableColumn genTableColumn);
|
||||
|
||||
/**
|
||||
* 修改业务字段
|
||||
*
|
||||
* @param genTableColumn 业务字段信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGenTableColumn (GenTableColumn genTableColumn);
|
||||
int updateGenTableColumn(GenTableColumn genTableColumn);
|
||||
|
||||
/**
|
||||
* 删除业务字段信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumnByIds (String ids);
|
||||
int deleteGenTableColumnByIds(String ids);
|
||||
}
|
||||
|
|
|
@ -15,117 +15,107 @@ public interface IGenTableService {
|
|||
* 查询业务列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 业务集合
|
||||
*/
|
||||
List<GenTable> selectGenTableList (GenTable genTable);
|
||||
List<GenTable> selectGenTableList(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableList (GenTable genTable);
|
||||
List<GenTable> selectDbTableList(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
*
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
List<GenTable> selectDbTableListByNames (String[] tableNames);
|
||||
List<GenTable> selectDbTableListByNames(String[] tableNames);
|
||||
|
||||
/**
|
||||
* 查询所有表信息
|
||||
*
|
||||
* @return 表信息集合
|
||||
*/
|
||||
List<GenTable> selectGenTableAll ();
|
||||
List<GenTable> selectGenTableAll();
|
||||
|
||||
/**
|
||||
* 查询业务信息
|
||||
*
|
||||
* @param id 业务ID
|
||||
*
|
||||
* @return 业务信息
|
||||
*/
|
||||
GenTable selectGenTableById (Long id);
|
||||
GenTable selectGenTableById(Long id);
|
||||
|
||||
/**
|
||||
* 修改业务
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
void updateGenTable (GenTable genTable);
|
||||
void updateGenTable(GenTable genTable);
|
||||
|
||||
/**
|
||||
* 删除业务信息
|
||||
*
|
||||
* @param tableIds 需要删除的表数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteGenTableByIds (Long[] tableIds);
|
||||
void deleteGenTableByIds(Long[] tableIds);
|
||||
|
||||
/**
|
||||
* 导入表结构
|
||||
*
|
||||
* @param tableList 导入表列表
|
||||
*/
|
||||
void importGenTable (List<GenTable> tableList);
|
||||
void importGenTable(List<GenTable> tableList);
|
||||
|
||||
/**
|
||||
* 预览代码
|
||||
*
|
||||
* @param tableId 表编号
|
||||
*
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
Map<String, String> previewCode (Long tableId);
|
||||
Map<String, String> previewCode(Long tableId);
|
||||
|
||||
/**
|
||||
* 生成代码(下载方式)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
byte[] downloadCode (String tableName);
|
||||
byte[] downloadCode(String tableName);
|
||||
|
||||
/**
|
||||
* 生成代码(自定义路径)
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
void generatorCode (String tableName);
|
||||
void generatorCode(String tableName);
|
||||
|
||||
/**
|
||||
* 同步数据库
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*/
|
||||
void synchDb (String tableName);
|
||||
void synchDb(String tableName);
|
||||
|
||||
/**
|
||||
* 批量生成代码(下载方式)
|
||||
*
|
||||
* @param tableNames 表数组
|
||||
*
|
||||
* @return 数据
|
||||
*/
|
||||
byte[] downloadCode (String[] tableNames);
|
||||
byte[] downloadCode(String[] tableNames);
|
||||
|
||||
/**
|
||||
* 修改保存参数校验
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*/
|
||||
void validateEdit (GenTable genTable);
|
||||
void validateEdit(GenTable genTable);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class GenUtils {
|
|||
/**
|
||||
* 初始化表信息
|
||||
*/
|
||||
public static void initTable (GenTable genTable, String operName) {
|
||||
public static void initTable(GenTable genTable, String operName) {
|
||||
genTable.setClassName(convertClassName(genTable.getTableName()));
|
||||
genTable.setPackageName(GenConfig.getPackageName());
|
||||
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
|
||||
|
@ -31,7 +31,7 @@ public class GenUtils {
|
|||
/**
|
||||
* 初始化列属性字段
|
||||
*/
|
||||
public static void initColumnField (GenTableColumn column, GenTable table) {
|
||||
public static void initColumnField(GenTableColumn column, GenTable table) {
|
||||
String dataType = getDbType(column.getColumnType());
|
||||
String columnName = column.getColumnName();
|
||||
column.setTableId(table.getTableId());
|
||||
|
@ -116,10 +116,9 @@ public class GenUtils {
|
|||
*
|
||||
* @param arr 数组
|
||||
* @param targetValue 值
|
||||
*
|
||||
* @return 是否包含
|
||||
*/
|
||||
public static boolean arraysContains (String[] arr, String targetValue) {
|
||||
public static boolean arraysContains(String[] arr, String targetValue) {
|
||||
return Arrays.asList(arr).contains(targetValue);
|
||||
}
|
||||
|
||||
|
@ -127,10 +126,9 @@ public class GenUtils {
|
|||
* 获取模块名
|
||||
*
|
||||
* @param packageName 包名
|
||||
*
|
||||
* @return 模块名
|
||||
*/
|
||||
public static String getModuleName (String packageName) {
|
||||
public static String getModuleName(String packageName) {
|
||||
int lastIndex = packageName.lastIndexOf(".");
|
||||
int nameLength = packageName.length();
|
||||
return StringUtils.substring(packageName, lastIndex + 1, nameLength);
|
||||
|
@ -140,10 +138,9 @@ public class GenUtils {
|
|||
* 获取业务名
|
||||
*
|
||||
* @param tableName 表名
|
||||
*
|
||||
* @return 业务名
|
||||
*/
|
||||
public static String getBusinessName (String tableName) {
|
||||
public static String getBusinessName(String tableName) {
|
||||
int lastIndex = tableName.lastIndexOf("_");
|
||||
int nameLength = tableName.length();
|
||||
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
|
||||
|
@ -153,10 +150,9 @@ public class GenUtils {
|
|||
* 表名转换成Java类名
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*
|
||||
* @return 类名
|
||||
*/
|
||||
public static String convertClassName (String tableName) {
|
||||
public static String convertClassName(String tableName) {
|
||||
boolean autoRemovePre = GenConfig.getAutoRemovePre();
|
||||
String tablePrefix = GenConfig.getTablePrefix();
|
||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
|
||||
|
@ -171,10 +167,9 @@ public class GenUtils {
|
|||
*
|
||||
* @param replacementm 替换值
|
||||
* @param searchList 替换列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String replaceFirst (String replacementm, String[] searchList) {
|
||||
public static String replaceFirst(String replacementm, String[] searchList) {
|
||||
String text = replacementm;
|
||||
for (String searchString : searchList) {
|
||||
if (replacementm.startsWith(searchString)) {
|
||||
|
@ -189,10 +184,9 @@ public class GenUtils {
|
|||
* 关键字替换
|
||||
*
|
||||
* @param text 需要被替换的名字
|
||||
*
|
||||
* @return 替换后的名字
|
||||
*/
|
||||
public static String replaceText (String text) {
|
||||
public static String replaceText(String text) {
|
||||
return RegExUtils.replaceAll(text, "(?:表|若依)", "");
|
||||
}
|
||||
|
||||
|
@ -200,10 +194,9 @@ public class GenUtils {
|
|||
* 获取数据库类型字段
|
||||
*
|
||||
* @param columnType 列类型
|
||||
*
|
||||
* @return 截取后的列类型
|
||||
*/
|
||||
public static String getDbType (String columnType) {
|
||||
public static String getDbType(String columnType) {
|
||||
if (StringUtils.indexOf(columnType, "(") > 0) {
|
||||
return StringUtils.substringBefore(columnType, "(");
|
||||
} else {
|
||||
|
@ -215,10 +208,9 @@ public class GenUtils {
|
|||
* 获取字段长度
|
||||
*
|
||||
* @param columnType 列类型
|
||||
*
|
||||
* @return 截取后的列类型
|
||||
*/
|
||||
public static Integer getColumnLength (String columnType) {
|
||||
public static Integer getColumnLength(String columnType) {
|
||||
if (StringUtils.indexOf(columnType, "(") > 0) {
|
||||
String length = StringUtils.substringBetween(columnType, "(", ")");
|
||||
return Integer.valueOf(length);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class VelocityInitializer {
|
|||
/**
|
||||
* 初始化vm方法
|
||||
*/
|
||||
public static void initVelocity () {
|
||||
public static void initVelocity() {
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
// 加载classpath目录下的vm文件
|
||||
|
|
|
@ -40,7 +40,7 @@ public class VelocityUtils {
|
|||
*
|
||||
* @return 模板列表
|
||||
*/
|
||||
public static VelocityContext prepareContext (GenTable genTable) {
|
||||
public static VelocityContext prepareContext(GenTable genTable) {
|
||||
String moduleName = genTable.getModuleName();
|
||||
String businessName = genTable.getBusinessName();
|
||||
String packageName = genTable.getPackageName();
|
||||
|
@ -76,14 +76,14 @@ public class VelocityUtils {
|
|||
return velocityContext;
|
||||
}
|
||||
|
||||
public static void setMenuVelocityContext (VelocityContext context, GenTable genTable) {
|
||||
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) {
|
||||
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) {
|
||||
String options = genTable.getOptions();
|
||||
JSONObject paramsObj = JSON.parseObject(options);
|
||||
String treeCode = getTreecode(paramsObj);
|
||||
|
@ -102,7 +102,7 @@ public class VelocityUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setSubVelocityContext (VelocityContext context, GenTable genTable) {
|
||||
public static void setSubVelocityContext(VelocityContext context, GenTable genTable) {
|
||||
GenTable subTable = genTable.getSubTable();
|
||||
String subTableName = genTable.getSubTableName();
|
||||
String subTableFkName = genTable.getSubTableFkName();
|
||||
|
@ -124,7 +124,7 @@ public class VelocityUtils {
|
|||
*
|
||||
* @return 模板列表
|
||||
*/
|
||||
public static List<String> getTemplateList (String tplCategory) {
|
||||
public static List<String> getTemplateList(String tplCategory) {
|
||||
List<String> templates = new ArrayList<String>();
|
||||
templates.add("vm/java/domain.java.vm");
|
||||
templates.add("vm/java/mapper.java.vm");
|
||||
|
@ -148,7 +148,7 @@ public class VelocityUtils {
|
|||
/**
|
||||
* 获取文件名
|
||||
*/
|
||||
public static String getFileName (String template, GenTable genTable) {
|
||||
public static String getFileName(String template, GenTable genTable) {
|
||||
// 文件名称
|
||||
String fileName = "";
|
||||
// 包路径
|
||||
|
@ -195,10 +195,9 @@ public class VelocityUtils {
|
|||
* 获取包前缀
|
||||
*
|
||||
* @param packageName 包名称
|
||||
*
|
||||
* @return 包前缀名称
|
||||
*/
|
||||
public static String getPackagePrefix (String packageName) {
|
||||
public static String getPackagePrefix(String packageName) {
|
||||
int lastIndex = packageName.lastIndexOf(".");
|
||||
return StringUtils.substring(packageName, 0, lastIndex);
|
||||
}
|
||||
|
@ -207,10 +206,9 @@ public class VelocityUtils {
|
|||
* 根据列类型获取导入包
|
||||
*
|
||||
* @param genTable 业务表对象
|
||||
*
|
||||
* @return 返回需要导入的包列表
|
||||
*/
|
||||
public static HashSet<String> getImportList (GenTable genTable) {
|
||||
public static HashSet<String> getImportList(GenTable genTable) {
|
||||
List<GenTableColumn> columns = genTable.getColumns();
|
||||
GenTable subGenTable = genTable.getSubTable();
|
||||
HashSet<String> importList = new HashSet<String>();
|
||||
|
@ -232,10 +230,9 @@ public class VelocityUtils {
|
|||
* 根据列类型获取字典组
|
||||
*
|
||||
* @param genTable 业务表对象
|
||||
*
|
||||
* @return 返回字典组
|
||||
*/
|
||||
public static String getDicts (GenTable genTable) {
|
||||
public static String getDicts(GenTable genTable) {
|
||||
List<GenTableColumn> columns = genTable.getColumns();
|
||||
Set<String> dicts = new HashSet<String>();
|
||||
addDicts(dicts, columns);
|
||||
|
@ -252,7 +249,7 @@ public class VelocityUtils {
|
|||
* @param dicts 字典列表
|
||||
* @param columns 列集合
|
||||
*/
|
||||
public static void addDicts (Set<String> dicts, List<GenTableColumn> 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(),
|
||||
|
@ -267,10 +264,9 @@ public class VelocityUtils {
|
|||
*
|
||||
* @param moduleName 模块名称
|
||||
* @param businessName 业务名称
|
||||
*
|
||||
* @return 返回权限前缀
|
||||
*/
|
||||
public static String getPermissionPrefix (String moduleName, String businessName) {
|
||||
public static String getPermissionPrefix(String moduleName, String businessName) {
|
||||
return StringUtils.format("{}:{}", moduleName, businessName);
|
||||
}
|
||||
|
||||
|
@ -278,10 +274,9 @@ public class VelocityUtils {
|
|||
* 获取上级菜单ID字段
|
||||
*
|
||||
* @param paramsObj 生成其他选项
|
||||
*
|
||||
* @return 上级菜单ID字段
|
||||
*/
|
||||
public static String getParentMenuId (JSONObject paramsObj) {
|
||||
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);
|
||||
|
@ -293,10 +288,9 @@ public class VelocityUtils {
|
|||
* 获取树编码
|
||||
*
|
||||
* @param paramsObj 生成其他选项
|
||||
*
|
||||
* @return 树编码
|
||||
*/
|
||||
public static String getTreecode (JSONObject paramsObj) {
|
||||
public static String getTreecode(JSONObject paramsObj) {
|
||||
if (paramsObj.containsKey(GenConstants.TREE_CODE)) {
|
||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
|
||||
}
|
||||
|
@ -307,10 +301,9 @@ public class VelocityUtils {
|
|||
* 获取树父编码
|
||||
*
|
||||
* @param paramsObj 生成其他选项
|
||||
*
|
||||
* @return 树父编码
|
||||
*/
|
||||
public static String getTreeParentCode (JSONObject paramsObj) {
|
||||
public static String getTreeParentCode(JSONObject paramsObj) {
|
||||
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) {
|
||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
|
||||
}
|
||||
|
@ -321,10 +314,9 @@ public class VelocityUtils {
|
|||
* 获取树名称
|
||||
*
|
||||
* @param paramsObj 生成其他选项
|
||||
*
|
||||
* @return 树名称
|
||||
*/
|
||||
public static String getTreeName (JSONObject paramsObj) {
|
||||
public static String getTreeName(JSONObject paramsObj) {
|
||||
if (paramsObj.containsKey(GenConstants.TREE_NAME)) {
|
||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
|
||||
}
|
||||
|
@ -335,10 +327,9 @@ public class VelocityUtils {
|
|||
* 获取需要在哪一列上面显示展开按钮
|
||||
*
|
||||
* @param genTable 业务表对象
|
||||
*
|
||||
* @return 展开按钮列序号
|
||||
*/
|
||||
public static int getExpandColumn (GenTable genTable) {
|
||||
public static int getExpandColumn(GenTable genTable) {
|
||||
String options = genTable.getOptions();
|
||||
JSONObject paramsObj = JSON.parseObject(options);
|
||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-gen" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
<property name="log.path" value="logs/muyu-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="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>
|
||||
<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">
|
||||
<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">
|
||||
<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>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
|
@ -33,16 +33,16 @@
|
|||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<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>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
|
@ -50,25 +50,25 @@
|
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
<logger name="com.muyu" 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" />
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
from gen_table_column
|
||||
</sql>
|
||||
|
||||
<select id="selectGenTableColumnListByTableId" parameterType="com.muyu.gen.domain.GenTableColumn" resultMap="GenTableColumnResult">
|
||||
<select id="selectGenTableColumnListByTableId" parameterType="com.muyu.gen.domain.GenTableColumn"
|
||||
resultMap="GenTableColumnResult">
|
||||
<include refid="selectGenTableColumnVo"/>
|
||||
where table_id = #{tableId}
|
||||
order by sort
|
||||
|
@ -64,10 +65,10 @@
|
|||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
||||
select column_name,
|
||||
(case when (is_nullable = 'stream' <![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,
|
||||
(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,
|
||||
(case when extra = 'auto_increment' then '1' else '0' end) as is_increment,
|
||||
column_type
|
||||
from information_schema.columns
|
||||
where table_schema = (select database())
|
||||
|
@ -75,7 +76,8 @@
|
|||
order by ordinal_position
|
||||
</select>
|
||||
|
||||
<insert id="insertGenTableColumn" parameterType="com.muyu.gen.domain.GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
|
||||
<insert id="insertGenTableColumn" parameterType="com.muyu.gen.domain.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>
|
||||
|
|
|
@ -249,7 +249,8 @@
|
|||
order by c.sort
|
||||
</select>
|
||||
|
||||
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.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>
|
||||
|
|
|
@ -3,6 +3,7 @@ package ${packageName}.controller;
|
|||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
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;
|
||||
|
@ -33,30 +34,27 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${businessName}")
|
||||
public class ${ClassName}Controller extends BaseController
|
||||
{
|
||||
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 Result<TableDataInfo> list(${ClassName} ${className})
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:list")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
public Result<TableDataInfo> list(${ClassName} ${className}) {
|
||||
startPage();
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return getDataTable(list);
|
||||
}
|
||||
#elseif($table.tree)
|
||||
public Result list(${ClassName} ${className})
|
||||
{
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return success(list);
|
||||
}
|
||||
#end
|
||||
#elseif($table.tree)
|
||||
public Result list(${ClassName} ${className}) {
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return success(list);
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* 导出${functionName}列表
|
||||
|
@ -64,10 +62,9 @@ public class ${ClassName}Controller extends BaseController
|
|||
@RequiresPermissions("${permissionPrefix}:export")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className})
|
||||
{
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className}) {
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class);
|
||||
util.exportExcel(response, list, "${functionName}数据");
|
||||
}
|
||||
|
||||
|
@ -76,8 +73,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:query")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
||||
}
|
||||
|
||||
|
@ -87,8 +83,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
@RequiresPermissions("${permissionPrefix}:add")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody ${ClassName} ${className})
|
||||
{
|
||||
public Result add(@RequestBody ${ClassName} ${className}) {
|
||||
return toAjax(${className}Service.insert${ClassName}(${className}));
|
||||
}
|
||||
|
||||
|
@ -98,8 +93,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
@RequiresPermissions("${permissionPrefix}:edit")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody ${ClassName} ${className})
|
||||
{
|
||||
public Result edit(@RequestBody ${ClassName} ${className}) {
|
||||
return toAjax(${className}Service.update${ClassName}(${className}));
|
||||
}
|
||||
|
||||
|
@ -108,9 +102,8 @@ public class ${ClassName}Controller extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:remove")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public Result remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public Result remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
||||
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,87 +19,87 @@ import com.muyu.common.core.web.domain.TreeEntity;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
#if($table.crud || $table.sub)
|
||||
#set($Entity="BaseEntity")
|
||||
#set($Entity="BaseEntity")
|
||||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#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
|
||||
#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
|
||||
#end
|
||||
#if($table.sub)
|
||||
/** $table.subTable.functionName信息 */
|
||||
private List<${subClassName}> ${subclassName}List;
|
||||
/** $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
|
||||
#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;
|
||||
}
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
#if($table.sub)
|
||||
public List<${subClassName}> get${subClassName}List()
|
||||
{
|
||||
public List<${subClassName}> get${subClassName}List()
|
||||
{
|
||||
return ${subclassName}List;
|
||||
}
|
||||
}
|
||||
|
||||
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
||||
{
|
||||
this.${subclassName}List = ${subclassName}List;
|
||||
}
|
||||
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
||||
{
|
||||
this.${subclassName}List= ${subclassName}List;
|
||||
}
|
||||
|
||||
#end
|
||||
@Override
|
||||
public String toString() {
|
||||
@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();
|
||||
}
|
||||
}
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ${packageName}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${packageName}.domain.${ClassName};
|
||||
#if($table.sub)
|
||||
import ${packageName}.domain.${subClassName};
|
||||
|
@ -8,15 +9,14 @@ import ${packageName}.domain.${subClassName};
|
|||
|
||||
/**
|
||||
* ${functionName}Mapper接口
|
||||
*
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper
|
||||
{
|
||||
public interface ${ClassName}Mapper {
|
||||
/**
|
||||
* 查询${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ public interface ${ClassName}Mapper
|
|||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ public interface ${ClassName}Mapper
|
|||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -40,7 +40,7 @@ public interface ${ClassName}Mapper
|
|||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ public interface ${ClassName}Mapper
|
|||
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -56,36 +56,36 @@ public interface ${ClassName}Mapper
|
|||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
#if($table.sub)
|
||||
#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);
|
||||
|
||||
/**
|
||||
* 批量删除${subTable.functionName}
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 通过${functionName}主键删除${subTable.functionName}信息
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
#end
|
||||
/**
|
||||
* 批量新增${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
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package ${packageName}.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${packageName}.domain.${ClassName};
|
||||
|
||||
/**
|
||||
* ${functionName}Service接口
|
||||
*
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
{
|
||||
public interface I${ClassName}Service {
|
||||
/**
|
||||
* 查询${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ public interface I${ClassName}Service
|
|||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ public interface I${ClassName}Service
|
|||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ public interface I${ClassName}Service
|
|||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ public interface I${ClassName}Service
|
|||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public interface I${ClassName}Service
|
|||
|
||||
/**
|
||||
* 删除${functionName}信息
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package ${packageName}.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||
import com.muyu.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.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ${packageName}.domain.${subClassName};
|
||||
#end
|
||||
#if($table.sub)
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.muyu.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;
|
||||
|
@ -26,8 +27,7 @@ import ${packageName}.service.I${ClassName}Service;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
{
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
||||
|
@ -38,8 +38,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @return ${functionName}
|
||||
*/
|
||||
@Override
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||
}
|
||||
|
||||
|
@ -50,8 +49,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @return ${functionName}
|
||||
*/
|
||||
@Override
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
|
||||
{
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) {
|
||||
return ${className}Mapper.select${ClassName}List(${className});
|
||||
}
|
||||
|
||||
|
@ -61,24 +59,23 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
#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
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,21 +84,21 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
#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
|
||||
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});
|
||||
}
|
||||
|
||||
|
@ -111,15 +108,14 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
#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
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -129,41 +125,37 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
#end
|
||||
#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
|
||||
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)
|
||||
#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);
|
||||
/**
|
||||
* 新增${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
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package ${packageName}.domain;
|
||||
|
||||
#foreach ($import in $subImportList)
|
||||
import ${import};
|
||||
#end
|
||||
#foreach ($import in $subImportList)
|
||||
import ${import};
|
||||
#end
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
|
@ -20,62 +20,62 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ${subClassName} extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
#foreach ($column in $subTable.columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
#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;
|
||||
}
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@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();
|
||||
}
|
||||
}
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,43 +2,43 @@ import request from '@/utils/request'
|
|||
|
||||
// 查询${functionName}列表
|
||||
export function list${BusinessName}(query) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/list',
|
||||
method: 'get',
|
||||
params: 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'
|
||||
})
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增${functionName}
|
||||
export function add${BusinessName}(data) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}',
|
||||
method: 'post',
|
||||
data: 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
|
||||
})
|
||||
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'
|
||||
})
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,65 +1,65 @@
|
|||
<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
|
||||
#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>
|
||||
|
@ -69,76 +69,85 @@
|
|||
<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>
|
||||
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>
|
||||
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'}"
|
||||
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
|
||||
#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>
|
||||
<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>
|
||||
|
@ -146,119 +155,120 @@
|
|||
<!-- 添加或修改${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
|
||||
#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">
|
||||
|
@ -271,204 +281,262 @@
|
|||
</template>
|
||||
|
||||
<script setup name="${BusinessName}">
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||
import {get${BusinessName}, list${BusinessName}} from "@/api/";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
#if(${dicts} != '')
|
||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts});
|
||||
#end
|
||||
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 ${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();
|
||||
});
|
||||
}
|
||||
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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||
return del${BusinessName}(row.${pkColumn.javaField});
|
||||
}).then(() => {
|
||||
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();
|
||||
proxy.#[[$modal]]#.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,135 +1,168 @@
|
|||
<?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">
|
||||
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
|
||||
#foreach ($column in $columns)
|
||||
<result property="${column.javaField}" column="${column.columnName}"/>
|
||||
#end
|
||||
</resultMap>
|
||||
#if($table.sub)
|
||||
#if($table.sub)
|
||||
|
||||
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
|
||||
<collection property="${subclassName}List" notNullColumn="sub_${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" />
|
||||
</resultMap>
|
||||
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
|
||||
<collection property="${subclassName}List" notNullColumn="sub_${subTable.pkColumn.columnName}"
|
||||
javaType="java.util.List" resultMap="${subClassName}Result"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="${subClassName}" id="${subClassName}Result">
|
||||
#foreach ($column in $subTable.columns)
|
||||
<result property="${column.javaField}" column="sub_${column.columnName}" />
|
||||
#end
|
||||
</resultMap>
|
||||
#end
|
||||
<resultMap type="${subClassName}" id="${subClassName}Result">
|
||||
#foreach ($column in $subTable.columns)
|
||||
<result property="${column.javaField}" column="sub_${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}
|
||||
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>
|
||||
#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) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
|
||||
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
|
||||
|
||||
from ${tableName} a
|
||||
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
||||
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||
#end
|
||||
<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) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
|
||||
#foreach($column in $subTable.columns) b.$column.columnName as
|
||||
sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
|
||||
|
||||
from ${tableName} a
|
||||
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
||||
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||
#end
|
||||
</select>
|
||||
|
||||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#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>
|
||||
#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>
|
||||
#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
|
||||
#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
|
||||
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
|
||||
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>
|
||||
#if($table.sub)
|
||||
|
||||
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
|
||||
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
|
||||
</delete>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
@ -17,4 +17,18 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-edition-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-edition-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.edition.test.clinet.cllent.config;
|
||||
package com.muyu.efition.clinet.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.efition.clinet.config;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.edition.domain.RuleEngine;
|
||||
import com.muyu.goods.edition.remote.RemoteDataManagerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
@Log4j2
|
||||
public class AccessConfigRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private RemoteDataManagerService remoteDataManagerService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
Result<TableDataInfo<RuleEngine>> list = remoteDataManagerService.list(null);
|
||||
|
||||
log.info("远程调用成功,效果为:{}", list);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.efition.clinet.config.AccessConfig
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-visual-monitor"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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.muyu" 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>
|
|
@ -2,6 +2,7 @@ package com.muyu.edition.constant;
|
|||
|
||||
/**
|
||||
* 配置编码常量
|
||||
*
|
||||
* @ClassName ConfigCodeConstants
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/4 15:28
|
||||
|
@ -11,14 +12,14 @@ public class ConfigCodeConstants {
|
|||
* 文件基础路径
|
||||
*/
|
||||
// public final static String BASE_FILE_PATH="D:/workspace/gtl-ruoyi-server/ruoyi-modules/ruoyi-rule_engine/ruoyi-rule_engine-server/src/main/java/com/ruoyi/ruleEngine/scope/";
|
||||
public final static String BASE_FILE_PATH="D:\\woster\\gs1\\gf\\assets-ser\\muyu-modules\\muyu-goods-edition\\muyu-goods-edition-server\\src\\main\\java\\com\\muyu\\edition\\scope\\";
|
||||
public final static String BASE_FILE_PATH = "D:\\woster\\gs1\\gf\\assets-ser\\muyu-modules\\muyu-goods-edition\\muyu-goods-edition-server\\src\\main\\java\\com\\muyu\\edition\\scope\\";
|
||||
/**
|
||||
* 配置文件名数组
|
||||
*/
|
||||
public final static String[] CONFIG_FILE_NAME_ARRAY=new String[]{"TestClass.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||
public final static String[] CONFIG_FILE_NAME_CODE=new String[]{"ToCode.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||
public final static String[] CONFIG_FILE_NAME_ARRAY = new String[]{"TestClass.txt", "TaskContextHolder.java", "DataSetContextHolder.java", "RecordContextHolder.java", "DataModelContextHolder.java"};
|
||||
public final static String[] CONFIG_FILE_NAME_CODE = new String[]{"ToCode.txt", "TaskContextHolder.java", "DataSetContextHolder.java", "RecordContextHolder.java", "DataModelContextHolder.java"};
|
||||
/**
|
||||
* 配置文件类型数组
|
||||
*/
|
||||
public final static String[] CONFIG_FILE_TYPE_ARRAY=new String[]{"测试模版","任务","数据集","资产记录","资产模型"};
|
||||
public final static String[] CONFIG_FILE_TYPE_ARRAY = new String[]{"测试模版", "任务", "数据集", "资产记录", "资产模型"};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.edition.constant;
|
|||
|
||||
/**
|
||||
* 规则运行常量
|
||||
*
|
||||
* @ClassName RuleOperationConstants
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/4 16:12
|
||||
|
@ -10,13 +11,13 @@ public class RuleOperationConstants {
|
|||
/**
|
||||
* 运行类型
|
||||
*/
|
||||
public final static String CLASS_NAME="TestClass";
|
||||
public final static String CLASS_NAME = "TestClass";
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
public final static String FILE_SUFFIX=".java";
|
||||
public final static String FILE_SUFFIX = ".java";
|
||||
/**
|
||||
* 运行方法
|
||||
*/
|
||||
public final static String METHOD_NAME="ruleTest";
|
||||
public final static String METHOD_NAME = "ruleTest";
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ import lombok.experimental.SuperBuilder;
|
|||
public class Anduser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
*主键
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
/**
|
||||
|
@ -51,17 +51,18 @@ public class Anduser extends BaseEntity {
|
|||
/**
|
||||
* 查询
|
||||
*/
|
||||
public static Anduser query(AnduserQueryResp anduserQueryResp){
|
||||
return Anduser.builder()
|
||||
public static Anduser query(AnduserQueryResp anduserQueryResp) {
|
||||
return Anduser.builder()
|
||||
.name(anduserQueryResp.getName())
|
||||
.sex(anduserQueryResp.getSex())
|
||||
.age(anduserQueryResp.getAge())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public static Anduser index(AnduserIndexResp anduserIndexResp){
|
||||
public static Anduser index(AnduserIndexResp anduserIndexResp) {
|
||||
return Anduser.builder()
|
||||
.name(anduserIndexResp.getName())
|
||||
.sex(anduserIndexResp.getSex())
|
||||
|
|
|
@ -11,55 +11,60 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public class Config extends BaseEntity
|
||||
{
|
||||
public class Config extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 版本编码 */
|
||||
/**
|
||||
* 版本编码
|
||||
*/
|
||||
@Excel(name = "版本编码")
|
||||
private String versionCode;
|
||||
|
||||
/** 规则内容 */
|
||||
/**
|
||||
* 规则内容
|
||||
*/
|
||||
@Excel(name = "规则内容")
|
||||
private String ruleContent;
|
||||
|
||||
/** 注释 */
|
||||
/**
|
||||
* 注释
|
||||
*/
|
||||
@Excel(name = "注释")
|
||||
private String remark;
|
||||
|
||||
/** 维护编号 */
|
||||
/**
|
||||
* 维护编号
|
||||
*/
|
||||
@Excel(name = "维护编号")
|
||||
private Long ruleId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
public String getVersionCode() {
|
||||
return versionCode;
|
||||
}
|
||||
public void setVersionCode(String versionCode)
|
||||
{
|
||||
|
||||
public void setVersionCode(String versionCode) {
|
||||
this.versionCode = versionCode;
|
||||
}
|
||||
|
||||
public String getVersionCode()
|
||||
{
|
||||
return versionCode;
|
||||
}
|
||||
public void setRuleContent(String ruleContent)
|
||||
{
|
||||
this.ruleContent = ruleContent;
|
||||
public String getRuleContent() {
|
||||
return ruleContent;
|
||||
}
|
||||
|
||||
public String getRuleContent()
|
||||
{
|
||||
return ruleContent;
|
||||
public void setRuleContent(String ruleContent) {
|
||||
this.ruleContent = ruleContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,24 +77,22 @@ public class Config extends BaseEntity
|
|||
this.remark = remark;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("ruleContent", getRuleContent())
|
||||
.append("remark", getRemark())
|
||||
.append("ruleId", getRuleId())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("ruleContent", getRuleContent())
|
||||
.append("remark", getRemark())
|
||||
.append("ruleId", getRuleId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ public class Cope extends BaseEntity {
|
|||
*/
|
||||
private String type;
|
||||
/**
|
||||
*命名
|
||||
* 命名
|
||||
*/
|
||||
private String val;
|
||||
/**
|
||||
*内容
|
||||
* 内容
|
||||
*/
|
||||
private String code;
|
||||
|
||||
|
|
|
@ -11,41 +11,56 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public class Edition extends BaseEntity
|
||||
{
|
||||
public class Edition extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 规则序号 */
|
||||
/**
|
||||
* 规则序号
|
||||
*/
|
||||
@Excel(name = "规则序号")
|
||||
private Long ruleId;
|
||||
|
||||
/** 版本类 */
|
||||
/**
|
||||
* 版本类
|
||||
*/
|
||||
@Excel(name = "版本类")
|
||||
private String versionClass;
|
||||
|
||||
/** 版本名称 */
|
||||
/**
|
||||
* 版本名称
|
||||
*/
|
||||
@Excel(name = "版本名称")
|
||||
private String name;
|
||||
|
||||
/** 版本编码 */
|
||||
/**
|
||||
* 版本编码
|
||||
*/
|
||||
@Excel(name = "版本编码")
|
||||
private String versionCode;
|
||||
|
||||
/** 版本状态 */
|
||||
/**
|
||||
* 版本状态
|
||||
*/
|
||||
@Excel(name = "是否发布")
|
||||
private Integer editionStatus;
|
||||
|
||||
/** 引擎状态 */
|
||||
/**
|
||||
* 引擎状态
|
||||
*/
|
||||
@Excel(name = "是否激活")
|
||||
private String ruleStatus;
|
||||
|
||||
@Excel(name = "是否测试")
|
||||
private Integer ruleIsTest;
|
||||
|
||||
/** 内容 */
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Excel(name = "内容描述")
|
||||
private String editionContent;
|
||||
|
||||
|
@ -134,17 +149,17 @@ public class Edition extends BaseEntity
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("ruleId", getRuleId())
|
||||
.append("versionClass", getVersionClass())
|
||||
.append("name", getName())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("editionStatus", getEditionStatus())
|
||||
.append("ruleStatus", getRuleStatus())
|
||||
.append("ruleIsTest",getRuleIsTest())
|
||||
.append("ruleContent",getRuleContent())
|
||||
.append("editionContent", getEditionContent())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("ruleId", getRuleId())
|
||||
.append("versionClass", getVersionClass())
|
||||
.append("name", getName())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("editionStatus", getEditionStatus())
|
||||
.append("ruleStatus", getRuleStatus())
|
||||
.append("ruleIsTest", getRuleIsTest())
|
||||
.append("ruleContent", getRuleContent())
|
||||
.append("editionContent", getEditionContent())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,117 +11,123 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
* @author goods
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public class RuleEngine extends BaseEntity
|
||||
{
|
||||
public class RuleEngine extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long ruleId;
|
||||
|
||||
/** 规则名称 */
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@Excel(name = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/** 引擎编码 */
|
||||
/**
|
||||
* 引擎编码
|
||||
*/
|
||||
@Excel(name = "引擎编码")
|
||||
private String ruleCode;
|
||||
|
||||
/** 规则级别 */
|
||||
/**
|
||||
* 规则级别
|
||||
*/
|
||||
@Excel(name = "规则级别")
|
||||
private Integer ruleLevel;
|
||||
|
||||
/** 规则类型 */
|
||||
/**
|
||||
* 规则类型
|
||||
*/
|
||||
@Excel(name = "规则类型")
|
||||
private Integer ruleType;
|
||||
|
||||
/** 是否激活 */
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
@Excel(name = "是否激活")
|
||||
private String ruleIsActivate;
|
||||
|
||||
/** 规则状态 */
|
||||
/**
|
||||
* 规则状态
|
||||
*/
|
||||
@Excel(name = "规则状态")
|
||||
private String ruleStatus;
|
||||
|
||||
/** 规则描述 */
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
@Excel(name = "规则描述")
|
||||
private String description;
|
||||
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
public String getRuleName() {
|
||||
return ruleName;
|
||||
}
|
||||
public void setRuleName(String ruleName)
|
||||
{
|
||||
|
||||
public void setRuleName(String ruleName) {
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
public String getRuleName()
|
||||
{
|
||||
return ruleName;
|
||||
public String getRuleCode() {
|
||||
return ruleCode;
|
||||
}
|
||||
public void setRuleCode(String ruleCode)
|
||||
{
|
||||
|
||||
public void setRuleCode(String ruleCode) {
|
||||
this.ruleCode = ruleCode;
|
||||
}
|
||||
|
||||
public String getRuleCode()
|
||||
{
|
||||
return ruleCode;
|
||||
public Integer getRuleLevel() {
|
||||
return ruleLevel;
|
||||
}
|
||||
public void setRuleLevel(Integer ruleLevel)
|
||||
{
|
||||
|
||||
public void setRuleLevel(Integer ruleLevel) {
|
||||
this.ruleLevel = ruleLevel;
|
||||
}
|
||||
|
||||
public Integer getRuleLevel()
|
||||
{
|
||||
return ruleLevel;
|
||||
public Integer getRuleType() {
|
||||
return ruleType;
|
||||
}
|
||||
public void setRuleType(Integer ruleType)
|
||||
{
|
||||
|
||||
public void setRuleType(Integer ruleType) {
|
||||
this.ruleType = ruleType;
|
||||
}
|
||||
|
||||
public Integer getRuleType()
|
||||
{
|
||||
return ruleType;
|
||||
public String getRuleIsActivate() {
|
||||
return ruleIsActivate;
|
||||
}
|
||||
public void setRuleIsActivate(String ruleIsActivate)
|
||||
{
|
||||
|
||||
public void setRuleIsActivate(String ruleIsActivate) {
|
||||
this.ruleIsActivate = ruleIsActivate;
|
||||
}
|
||||
|
||||
public String getRuleIsActivate()
|
||||
{
|
||||
return ruleIsActivate;
|
||||
public String getRuleStatus() {
|
||||
return ruleStatus;
|
||||
}
|
||||
public void setRuleStatus(String ruleStatus)
|
||||
{
|
||||
|
||||
public void setRuleStatus(String ruleStatus) {
|
||||
this.ruleStatus = ruleStatus;
|
||||
}
|
||||
|
||||
public String getRuleStatus()
|
||||
{
|
||||
return ruleStatus;
|
||||
}
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("ruleId", getRuleId())
|
||||
.append("ruleName", getRuleName())
|
||||
.append("ruleCode", getRuleCode())
|
||||
|
|
|
@ -8,12 +8,18 @@ import lombok.experimental.SuperBuilder;
|
|||
public class EngineConfigResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 类型 */
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/** 名称 */
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/** 代码 */
|
||||
/**
|
||||
* 代码
|
||||
*/
|
||||
private String code;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-visual-monitor"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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.muyu" 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>
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.goods.edition.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.edition.domain.RuleEngine;
|
||||
import com.muyu.goods.edition.remote.factory.DataMangFacrory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@FeignClient(
|
||||
contextId = "RemoteSys",
|
||||
value = ServiceNameConstants.EDITION_MUYU,
|
||||
fallbackFactory = DataMangFacrory.class,
|
||||
path = "/engine"
|
||||
)
|
||||
public interface RemoteDataManagerService {
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine);
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.goods.edition.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.edition.domain.RuleEngine;
|
||||
import com.muyu.goods.edition.remote.RemoteDataManagerService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
//熔断
|
||||
|
||||
public class DataMangFacrory implements FallbackFactory<RemoteDataManagerService> {
|
||||
@Override
|
||||
public RemoteDataManagerService create(Throwable cause) {
|
||||
return new RemoteDataManagerService() {
|
||||
@Override
|
||||
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.goods.edition.remote.factory.DataMangFacrory
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-visual-monitor"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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.muyu" 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>
|
|
@ -12,6 +12,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@SpringBootApplication
|
||||
public class MuYuGoodsEditionApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuGoodsEditionApplication.class,args);
|
||||
SpringApplication.run(MuYuGoodsEditionApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class ConfigController extends BaseController
|
||||
{
|
||||
public class ConfigController extends BaseController {
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
|
@ -35,8 +34,7 @@ public class ConfigController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:config:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Config>> list(Config config)
|
||||
{
|
||||
public Result<TableDataInfo<Config>> list(Config config) {
|
||||
startPage();
|
||||
List<Config> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
|
@ -44,11 +42,12 @@ public class ConfigController extends BaseController
|
|||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listConfigEs/{ruleId}")
|
||||
public Result<List<Config>> listConfigEs(@PathVariable Long ruleId){
|
||||
public Result<List<Config>> listConfigEs(@PathVariable Long ruleId) {
|
||||
List<Config> list = configService.listConfigEs(ruleId);
|
||||
return success(list);
|
||||
}
|
||||
|
@ -59,8 +58,7 @@ public class ConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:export")
|
||||
@Log(title = "引擎", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Config config)
|
||||
{
|
||||
public void export(HttpServletResponse response, Config config) {
|
||||
List<Config> list = configService.selectConfigList(config);
|
||||
ExcelUtil<Config> util = new ExcelUtil<Config>(Config.class);
|
||||
util.exportExcel(response, list, "引擎数据");
|
||||
|
@ -71,8 +69,7 @@ public class ConfigController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:config:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public Result getInfo(@PathVariable("id") Long id) {
|
||||
return success(configService.selectConfigById(id));
|
||||
}
|
||||
|
||||
|
@ -82,8 +79,7 @@ public class ConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "引擎", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Config config)
|
||||
{
|
||||
public Result add(@RequestBody Config config) {
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
|
@ -93,8 +89,7 @@ public class ConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "引擎", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Config config)
|
||||
{
|
||||
public Result edit(@RequestBody Config config) {
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
|
@ -103,24 +98,25 @@ public class ConfigController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "引擎", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids) {
|
||||
return toAjax(configService.deleteConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 引擎测试
|
||||
*
|
||||
* @param textData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/testData")
|
||||
public Result<Object> ruleText(@RequestBody TextData textData){
|
||||
public Result<Object> ruleText(@RequestBody TextData textData) {
|
||||
return success(configService.testData(textData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
@ -130,7 +126,7 @@ public class ConfigController extends BaseController
|
|||
}
|
||||
|
||||
@PostMapping("queryConfigInfo/{ruleId}")
|
||||
public Result<List<Config>> queryConfigInfo(@PathVariable Long ruleId){
|
||||
public Result<List<Config>> queryConfigInfo(@PathVariable Long ruleId) {
|
||||
return success(configService.queryConfigInfo(ruleId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ public class CopeController extends BaseController {
|
|||
}
|
||||
|
||||
@PostMapping("selType/{name}")
|
||||
public Result<List<Cope>> selType(@PathVariable String name){
|
||||
public Result<List<Cope>> selType(@PathVariable String name) {
|
||||
return success(service.selType(name));
|
||||
}
|
||||
|
||||
@PostMapping("selObject")
|
||||
public Result<List<Cope>> selObject(@RequestBody Cope cope){
|
||||
public Result<List<Cope>> selObject(@RequestBody Cope cope) {
|
||||
return success(service.selObject(cope));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/edition")
|
||||
public class EditionController extends BaseController
|
||||
{
|
||||
public class EditionController extends BaseController {
|
||||
@Autowired
|
||||
private IEditionService editionService;
|
||||
|
||||
|
@ -33,8 +32,7 @@ public class EditionController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:edition:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Edition>> list()
|
||||
{
|
||||
public Result<TableDataInfo<Edition>> list() {
|
||||
startPage();
|
||||
List<Edition> list = editionService.selectEditionList();
|
||||
return getDataTable(list);
|
||||
|
@ -42,11 +40,12 @@ public class EditionController extends BaseController
|
|||
|
||||
/**
|
||||
* 获取相应的规则引擎版本
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectListRuleId/{ruleId}")
|
||||
public Result<List<Edition>> selectListRuleId(@PathVariable Long ruleId){
|
||||
public Result<List<Edition>> selectListRuleId(@PathVariable Long ruleId) {
|
||||
return success(editionService.selectListRuleId(ruleId));
|
||||
}
|
||||
|
||||
|
@ -56,8 +55,7 @@ public class EditionController extends BaseController
|
|||
@RequiresPermissions("goods:edition:export")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Edition edition)
|
||||
{
|
||||
public void export(HttpServletResponse response, Edition edition) {
|
||||
List<Edition> list = editionService.selectEditionList();
|
||||
ExcelUtil<Edition> util = new ExcelUtil<Edition>(Edition.class);
|
||||
util.exportExcel(response, list, "规则引擎版本数据");
|
||||
|
@ -68,8 +66,7 @@ public class EditionController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:edition:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public Result getInfo(@PathVariable("id") Long id) {
|
||||
return success(editionService.selectEditionById(id));
|
||||
}
|
||||
|
||||
|
@ -79,8 +76,7 @@ public class EditionController extends BaseController
|
|||
@RequiresPermissions("goods:edition:add")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Edition edition)
|
||||
{
|
||||
public Result add(@RequestBody Edition edition) {
|
||||
return toAjax(editionService.insertEdition(edition));
|
||||
}
|
||||
|
||||
|
@ -90,8 +86,7 @@ public class EditionController extends BaseController
|
|||
@RequiresPermissions("goods:edition:edit")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Edition edition)
|
||||
{
|
||||
public Result edit(@RequestBody Edition edition) {
|
||||
return toAjax(editionService.updateEdition(edition));
|
||||
}
|
||||
|
||||
|
@ -100,9 +95,8 @@ public class EditionController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:edition:remove")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids) {
|
||||
return toAjax(editionService.deleteEditionByIds(ids));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/engine")
|
||||
public class RuleEngineController extends BaseController
|
||||
{
|
||||
public class RuleEngineController extends BaseController {
|
||||
@Autowired
|
||||
private IRuleEngineService ruleEngineService;
|
||||
|
||||
|
@ -33,8 +32,7 @@ public class RuleEngineController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:engine:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine)
|
||||
{
|
||||
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine) {
|
||||
startPage();
|
||||
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||
return getDataTable(list);
|
||||
|
@ -46,8 +44,7 @@ public class RuleEngineController extends BaseController
|
|||
@RequiresPermissions("goods:engine:export")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RuleEngine ruleEngine)
|
||||
{
|
||||
public void export(HttpServletResponse response, RuleEngine ruleEngine) {
|
||||
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||
ExcelUtil<RuleEngine> util = new ExcelUtil<RuleEngine>(RuleEngine.class);
|
||||
util.exportExcel(response, list, "规则引擎数据");
|
||||
|
@ -58,13 +55,12 @@ public class RuleEngineController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:engine:query")
|
||||
@GetMapping(value = "/{ruleId}")
|
||||
public Result getInfo(@PathVariable("ruleId") Long ruleId)
|
||||
{
|
||||
public Result getInfo(@PathVariable("ruleId") Long ruleId) {
|
||||
return success(ruleEngineService.selectRuleEngineByRuleId(ruleId));
|
||||
}
|
||||
|
||||
@PostMapping("selectRuleEngineOne/{ruleId}")
|
||||
public Result selectRuleEngineOne(@PathVariable Long ruleId){
|
||||
public Result selectRuleEngineOne(@PathVariable Long ruleId) {
|
||||
return success(ruleEngineService.selectRuleEngineOne(ruleId));
|
||||
}
|
||||
|
||||
|
@ -74,8 +70,7 @@ public class RuleEngineController extends BaseController
|
|||
@RequiresPermissions("goods:engine:add")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody RuleEngine ruleEngine)
|
||||
{
|
||||
public Result add(@RequestBody RuleEngine ruleEngine) {
|
||||
return toAjax(ruleEngineService.insertRuleEngine(ruleEngine));
|
||||
}
|
||||
|
||||
|
@ -85,8 +80,7 @@ public class RuleEngineController extends BaseController
|
|||
@RequiresPermissions("goods:engine:edit")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody RuleEngine ruleEngine)
|
||||
{
|
||||
public Result edit(@RequestBody RuleEngine ruleEngine) {
|
||||
return toAjax(ruleEngineService.updateRuleEngine(ruleEngine));
|
||||
}
|
||||
|
||||
|
@ -95,36 +89,37 @@ public class RuleEngineController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("goods:engine:remove")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ruleIds}")
|
||||
public Result remove(@PathVariable Long[] ruleIds)
|
||||
{
|
||||
@DeleteMapping("/{ruleIds}")
|
||||
public Result remove(@PathVariable Long[] ruleIds) {
|
||||
return toAjax(ruleEngineService.deleteRuleEngineByRuleIds(ruleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/description/{ruleId}")
|
||||
public Result<String> description(@PathVariable Integer ruleId){
|
||||
public Result<String> description(@PathVariable Integer ruleId) {
|
||||
return success(ruleEngineService.description(ruleId));
|
||||
}
|
||||
|
||||
@PutMapping("/updateRuleIsActivate")
|
||||
public Result updateRuleIsActivate(@RequestBody RuleEngine ruleEngine){
|
||||
public Result updateRuleIsActivate(@RequestBody RuleEngine ruleEngine) {
|
||||
ruleEngineService.updateRuleIsActivate(ruleEngine);
|
||||
return success("改变激活状态");
|
||||
}
|
||||
|
||||
@PutMapping("/updateRuleStatus")
|
||||
public Result updateRuleStatus(@RequestBody RuleEngine ruleEngine){
|
||||
public Result updateRuleStatus(@RequestBody RuleEngine ruleEngine) {
|
||||
ruleEngineService.updateRuleStatus(ruleEngine);
|
||||
return success("改变规则状态");
|
||||
}
|
||||
|
||||
@PostMapping("/spliceNameToCode")
|
||||
public Result spliceNameToCode(@RequestParam String name, @RequestParam String code,@RequestParam Integer level){
|
||||
return ruleEngineService.spliceNameToCode(name,code,level);
|
||||
public Result spliceNameToCode(@RequestParam String name, @RequestParam String code, @RequestParam Integer level) {
|
||||
return ruleEngineService.spliceNameToCode(name, code, level);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public class DynamicLoader {
|
|||
* URLClassLoader的具体作用就是将class文件加载到jvm虚拟机中去
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public static class MemoryClassLoader extends URLClassLoader {
|
||||
Map<String, byte[]> classBytes = new HashMap<String, byte[]>();
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 将编译好的.class文件保存到内存当中,这里的内存也就是map映射当中
|
||||
*
|
||||
* @ClassName MemoryJavaFileManager
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/1 20:38
|
||||
|
@ -25,6 +26,30 @@ public final class MemoryJavaFileManager extends ForwardingJavaFileManager {
|
|||
classBytes = new HashMap<String, byte[]>();
|
||||
}
|
||||
|
||||
static JavaFileObject makeStringSource(String name, String code) {
|
||||
return new StringInputBuffer(name, code);
|
||||
}
|
||||
|
||||
static URI toURI(String name) {
|
||||
File file = new File(name);
|
||||
if (file.exists()) {// 如果文件存在,返回他的URI
|
||||
return file.toURI();
|
||||
} else {
|
||||
try {
|
||||
final StringBuilder newUri = new StringBuilder();
|
||||
newUri.append("mfm:///");
|
||||
newUri.append(name.replace('.', '/'));
|
||||
if (name.endsWith(EXT)) {
|
||||
newUri.replace(newUri.length() - EXT.length(),
|
||||
newUri.length(), EXT);
|
||||
}
|
||||
return URI.create(newUri.toString());
|
||||
} catch (Exception exp) {
|
||||
return URI.create("mfm:///com/sun/script/java/java_source");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, byte[]> getClassBytes() {
|
||||
return classBytes;
|
||||
}
|
||||
|
@ -38,6 +63,18 @@ public final class MemoryJavaFileManager extends ForwardingJavaFileManager {
|
|||
public void flush() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getJavaFileForOutput(
|
||||
Location location, String className,
|
||||
JavaFileObject.Kind kind, FileObject sibling) throws IOException {
|
||||
if (kind == JavaFileObject.Kind.CLASS) {
|
||||
return new ClassOutputBuffer(className);
|
||||
} else {
|
||||
return super.getJavaFileForOutput(location, className, kind,
|
||||
sibling);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一个文件对象,用来表示从string中获取到的source,一下类容是按照jkd给出的例子写的
|
||||
*/
|
||||
|
@ -95,40 +132,4 @@ public final class MemoryJavaFileManager extends ForwardingJavaFileManager {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getJavaFileForOutput(
|
||||
Location location, String className,
|
||||
JavaFileObject.Kind kind, FileObject sibling) throws IOException {
|
||||
if (kind == JavaFileObject.Kind.CLASS) {
|
||||
return new ClassOutputBuffer(className);
|
||||
} else {
|
||||
return super.getJavaFileForOutput(location, className, kind,
|
||||
sibling);
|
||||
}
|
||||
}
|
||||
|
||||
static JavaFileObject makeStringSource(String name, String code) {
|
||||
return new StringInputBuffer(name, code);
|
||||
}
|
||||
|
||||
static URI toURI(String name) {
|
||||
File file = new File(name);
|
||||
if (file.exists()) {// 如果文件存在,返回他的URI
|
||||
return file.toURI();
|
||||
} else {
|
||||
try {
|
||||
final StringBuilder newUri = new StringBuilder();
|
||||
newUri.append("mfm:///");
|
||||
newUri.append(name.replace('.', '/'));
|
||||
if (name.endsWith(EXT)) {
|
||||
newUri.replace(newUri.length() - EXT.length(),
|
||||
newUri.length(), EXT);
|
||||
}
|
||||
return URI.create(newUri.toString());
|
||||
} catch (Exception exp) {
|
||||
return URI.create("mfm:///com/sun/script/java/java_source");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public interface ConfigMapper
|
||||
{
|
||||
public interface ConfigMapper {
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface EditionMapper
|
||||
{
|
||||
public interface EditionMapper {
|
||||
/**
|
||||
* 查询规则引擎版本
|
||||
*
|
||||
|
|
|
@ -11,8 +11,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public interface RuleEngineMapper
|
||||
{
|
||||
public interface RuleEngineMapper {
|
||||
/**
|
||||
* 查询规则引擎
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 数据模型上下文
|
||||
*
|
||||
* @ClassName DataModelContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
|
@ -13,7 +14,7 @@ public class DataModelContextHolder {
|
|||
|
||||
private final RecordContextHolder recordContextHolder;
|
||||
|
||||
public static DataModelContextHolder build(RecordContextHolder recordContextHolder){
|
||||
public static DataModelContextHolder build(RecordContextHolder recordContextHolder) {
|
||||
return new DataModelContextHolder(recordContextHolder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 数据集上下文
|
||||
*
|
||||
* @ClassName DataSetContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
|
@ -13,7 +14,7 @@ public class DataSetContextHolder {
|
|||
|
||||
private final TaskContextHolder taskContextHolder;
|
||||
|
||||
public static DataSetContextHolder build(TaskContextHolder taskContextHolder){
|
||||
public static DataSetContextHolder build(TaskContextHolder taskContextHolder) {
|
||||
return new DataSetContextHolder(taskContextHolder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 记录上下文
|
||||
*
|
||||
* @ClassName RecordContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
|
@ -13,7 +14,7 @@ public class RecordContextHolder {
|
|||
|
||||
private final DataSetContextHolder dataSetContextHolder;
|
||||
|
||||
public static RecordContextHolder build(DataSetContextHolder dataSetContextHolder){
|
||||
public static RecordContextHolder build(DataSetContextHolder dataSetContextHolder) {
|
||||
return new RecordContextHolder(dataSetContextHolder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,14 @@ package com.muyu.edition.scope;
|
|||
|
||||
/**
|
||||
* 任务上下文
|
||||
*
|
||||
* @ClassName TaskContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TaskContextHolder {
|
||||
|
||||
public static TaskContextHolder build(){
|
||||
public static TaskContextHolder build() {
|
||||
return new TaskContextHolder();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public interface IConfigService
|
||||
{
|
||||
public interface IConfigService {
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
|
@ -32,6 +31,7 @@ public interface IConfigService
|
|||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
|
@ -73,6 +73,7 @@ public interface IConfigService
|
|||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface IEditionService
|
||||
{
|
||||
public interface IEditionService {
|
||||
/**
|
||||
* 查询规则引擎版本
|
||||
*
|
||||
|
@ -27,6 +26,7 @@ public interface IEditionService
|
|||
* @return
|
||||
*/
|
||||
List<Edition> selectListRuleId(Long ruleId);
|
||||
|
||||
/**
|
||||
* 查询规则引擎版本列表
|
||||
*
|
||||
|
|
|
@ -11,8 +11,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public interface IRuleEngineService
|
||||
{
|
||||
public interface IRuleEngineService {
|
||||
/**
|
||||
* 查询规则引擎
|
||||
*
|
||||
|
@ -23,10 +22,12 @@ public interface IRuleEngineService
|
|||
|
||||
/**
|
||||
* 规则详情
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
RuleEngine selectRuleEngineOne(Long ruleId);
|
||||
|
||||
/**
|
||||
* 查询规则引擎列表
|
||||
*
|
||||
|
|
|
@ -27,8 +27,7 @@ import java.util.stream.Collectors;
|
|||
* @date 2024-05-04
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceImpl implements IConfigService
|
||||
{
|
||||
public class ConfigServiceImpl implements IConfigService {
|
||||
@Autowired
|
||||
private ConfigMapper configMapper;
|
||||
|
||||
|
@ -39,8 +38,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 引擎
|
||||
*/
|
||||
@Override
|
||||
public Config selectConfigById(Long id)
|
||||
{
|
||||
public Config selectConfigById(Long id) {
|
||||
return configMapper.selectConfigById(id);
|
||||
}
|
||||
|
||||
|
@ -51,13 +49,13 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 引擎
|
||||
*/
|
||||
@Override
|
||||
public List<Config> selectConfigList(Config config)
|
||||
{
|
||||
public List<Config> selectConfigList(Config config) {
|
||||
return configMapper.selectConfigList(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* y引擎列表
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
|
@ -73,8 +71,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertConfig(Config config)
|
||||
{
|
||||
public int insertConfig(Config config) {
|
||||
return configMapper.insertConfig(config);
|
||||
}
|
||||
|
||||
|
@ -85,8 +82,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateConfig(Config config)
|
||||
{
|
||||
public int updateConfig(Config config) {
|
||||
return configMapper.updateConfig(config);
|
||||
}
|
||||
|
||||
|
@ -97,8 +93,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConfigByIds(Long[] ids)
|
||||
{
|
||||
public int deleteConfigByIds(Long[] ids) {
|
||||
return configMapper.deleteConfigByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -109,8 +104,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConfigById(Long id)
|
||||
{
|
||||
public int deleteConfigById(Long id) {
|
||||
return configMapper.deleteConfigById(id);
|
||||
}
|
||||
|
||||
|
@ -121,7 +115,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
Config config = configMapper.selectConfigById(textData.getId());
|
||||
String content = config.getRuleContent().replaceAll("\r\n", "");
|
||||
// 对source进行编译生成class文件存放在Map中这里用bytecode接收,
|
||||
Map<String, byte[]> bytecode = DynamicLoader.compile(RuleOperationConstants.CLASS_NAME + RuleOperationConstants.FILE_SUFFIX,content );
|
||||
Map<String, byte[]> bytecode = DynamicLoader.compile(RuleOperationConstants.CLASS_NAME + RuleOperationConstants.FILE_SUFFIX, content);
|
||||
|
||||
// 加载class文件到虚拟机中,然后通过反射执行
|
||||
@SuppressWarnings("resource")
|
||||
|
@ -141,6 +135,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
@ -148,7 +143,7 @@ public class ConfigServiceImpl implements IConfigService
|
|||
public EngineConfigResp getScopeInfo(Integer id) {
|
||||
String scope = ConfigCodeConstants.CONFIG_FILE_NAME_ARRAY[id];
|
||||
String type = ConfigCodeConstants.CONFIG_FILE_TYPE_ARRAY[id];
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH+scope;
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH + scope;
|
||||
String code = null;
|
||||
try {
|
||||
code = Files.readString(Paths.get(path));
|
||||
|
|
|
@ -37,20 +37,20 @@ public class CopeServiceImpl implements CopeService {
|
|||
System.out.println(cope);
|
||||
List<Cope> collect = new ArrayList<>();
|
||||
List<Cope> collect1 = new ArrayList<>();
|
||||
if (cope.getType()!=null && cope.getType()!=""){
|
||||
if (cope.getType() != null && cope.getType() != "") {
|
||||
collect = list().stream().filter(c -> c.getType().equals(cope.getType())).collect(Collectors.toList());
|
||||
}else {
|
||||
} else {
|
||||
collect = list();
|
||||
}
|
||||
if (cope.getVal()!=null && cope.getVal()!=""){
|
||||
if (cope.getVal() != null && cope.getVal() != "") {
|
||||
collect1 = list().stream().filter(c -> c.getVal().contains(cope.getVal())).collect(Collectors.toList());
|
||||
}else {
|
||||
} else {
|
||||
collect1 = list();
|
||||
}
|
||||
List<Cope> copes = new ArrayList<>();
|
||||
for (Cope cope1 : collect) {
|
||||
for (Cope cope2 : collect1) {
|
||||
if (cope1.equals(cope2)){
|
||||
if (cope1.equals(cope2)) {
|
||||
copes.add(cope1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@ import java.util.stream.Collectors;
|
|||
* @date 2024-05-06
|
||||
*/
|
||||
@Service
|
||||
public class EditionServiceImpl implements IEditionService
|
||||
{
|
||||
public class EditionServiceImpl implements IEditionService {
|
||||
@Autowired
|
||||
private EditionMapper editionMapper;
|
||||
|
||||
|
@ -28,8 +27,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 规则引擎版本
|
||||
*/
|
||||
@Override
|
||||
public Edition selectEditionById(Long id)
|
||||
{
|
||||
public Edition selectEditionById(Long id) {
|
||||
return editionMapper.selectEditionById(id);
|
||||
}
|
||||
|
||||
|
@ -50,8 +48,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 规则引擎版本
|
||||
*/
|
||||
@Override
|
||||
public List<Edition> selectEditionList()
|
||||
{
|
||||
public List<Edition> selectEditionList() {
|
||||
return editionMapper.selectEditionList();
|
||||
}
|
||||
|
||||
|
@ -62,8 +59,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEdition(Edition edition)
|
||||
{
|
||||
public int insertEdition(Edition edition) {
|
||||
return editionMapper.insertEdition(edition);
|
||||
}
|
||||
|
||||
|
@ -74,8 +70,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEdition(Edition edition)
|
||||
{
|
||||
public int updateEdition(Edition edition) {
|
||||
return editionMapper.updateEdition(edition);
|
||||
}
|
||||
|
||||
|
@ -86,8 +81,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEditionByIds(Long[] ids)
|
||||
{
|
||||
public int deleteEditionByIds(Long[] ids) {
|
||||
return editionMapper.deleteEditionByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -98,8 +92,7 @@ public class EditionServiceImpl implements IEditionService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEditionById(Long id)
|
||||
{
|
||||
public int deleteEditionById(Long id) {
|
||||
return editionMapper.deleteEditionById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ import java.util.stream.Collectors;
|
|||
* @date 2024-05-02
|
||||
*/
|
||||
@Service
|
||||
public class RuleEngineServiceImpl implements IRuleEngineService
|
||||
{
|
||||
public class RuleEngineServiceImpl implements IRuleEngineService {
|
||||
@Autowired
|
||||
private RuleEngineMapper ruleEngineMapper;
|
||||
|
||||
|
@ -35,13 +34,13 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 规则引擎
|
||||
*/
|
||||
@Override
|
||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId)
|
||||
{
|
||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId) {
|
||||
return ruleEngineMapper.selectRuleEngineByRuleId(ruleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则引擎详情
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
|
@ -59,8 +58,7 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 规则引擎
|
||||
*/
|
||||
@Override
|
||||
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine)
|
||||
{
|
||||
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine) {
|
||||
return ruleEngineMapper.selectRuleEngineList(ruleEngine);
|
||||
}
|
||||
|
||||
|
@ -71,8 +69,7 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRuleEngine(RuleEngine ruleEngine)
|
||||
{
|
||||
public int insertRuleEngine(RuleEngine ruleEngine) {
|
||||
return ruleEngineMapper.insertRuleEngine(ruleEngine);
|
||||
}
|
||||
|
||||
|
@ -83,8 +80,7 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRuleEngine(RuleEngine ruleEngine)
|
||||
{
|
||||
public int updateRuleEngine(RuleEngine ruleEngine) {
|
||||
return ruleEngineMapper.updateRuleEngine(ruleEngine);
|
||||
}
|
||||
|
||||
|
@ -95,8 +91,7 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds)
|
||||
{
|
||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds) {
|
||||
return ruleEngineMapper.deleteRuleEngineByRuleIds(ruleIds);
|
||||
}
|
||||
|
||||
|
@ -107,8 +102,7 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineByRuleId(Long ruleId)
|
||||
{
|
||||
public int deleteRuleEngineByRuleId(Long ruleId) {
|
||||
return ruleEngineMapper.deleteRuleEngineByRuleId(ruleId);
|
||||
}
|
||||
|
||||
|
@ -119,22 +113,22 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
|
||||
@Override
|
||||
public void updateRuleIsActivate(RuleEngine ruleEngine) {
|
||||
if (ruleEngine.getRuleIsActivate().equals("Y")){
|
||||
if (ruleEngine.getRuleIsActivate().equals("Y")) {
|
||||
ruleEngine.setRuleIsActivate("N");
|
||||
}else{
|
||||
} else {
|
||||
ruleEngine.setRuleIsActivate("Y");
|
||||
}
|
||||
ruleEngineMapper.updateRuleIsActivate(ruleEngine.getRuleId(),ruleEngine.getRuleIsActivate());
|
||||
ruleEngineMapper.updateRuleIsActivate(ruleEngine.getRuleId(), ruleEngine.getRuleIsActivate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRuleStatus(RuleEngine ruleEngine) {
|
||||
if (ruleEngine.getRuleStatus().equals("Y")){
|
||||
if (ruleEngine.getRuleStatus().equals("Y")) {
|
||||
ruleEngine.setRuleStatus("N");
|
||||
}else{
|
||||
} else {
|
||||
ruleEngine.setRuleStatus("Y");
|
||||
}
|
||||
ruleEngineMapper.updateRuleStatus(ruleEngine.getRuleId(),ruleEngine.getRuleStatus());
|
||||
ruleEngineMapper.updateRuleStatus(ruleEngine.getRuleId(), ruleEngine.getRuleStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,13 +137,13 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
|||
RuleEditionReq ruleEditionReq = new RuleEditionReq();
|
||||
String val = name + "_" + code;
|
||||
String scope = ConfigCodeConstants.CONFIG_FILE_NAME_CODE[0];
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH+scope;
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH + scope;
|
||||
String cod = null;
|
||||
try {
|
||||
cod = Files.readString(Paths.get(path));
|
||||
String s1 = Pattern.compile("this.form.name").matcher(cod).replaceAll(name);
|
||||
String s2 = Pattern.compile("this.form.versionCode").matcher(s1).replaceAll(code);
|
||||
String s3 = Pattern.compile("parentClass").matcher(s2).replaceAll(stringList.get(level-1));
|
||||
String s3 = Pattern.compile("parentClass").matcher(s2).replaceAll(stringList.get(level - 1));
|
||||
ruleEditionReq.setVal(val);
|
||||
ruleEditionReq.setCode(s3);
|
||||
System.out.println(cod);
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-visual-monitor"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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.muyu" 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>
|
|
@ -0,0 +1,74 @@
|
|||
<?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.muyu.edition.mapper.ConfigMapper">
|
||||
|
||||
<resultMap type="com.muyu.edition.domain.Config" id="ConfigResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="versionCode" column="version_code"/>
|
||||
<result property="ruleContent" column="rule_content"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="ruleId" column="rule_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConfigVo">
|
||||
select id, version_code, rule_content, remark, rule_id
|
||||
from config
|
||||
</sql>
|
||||
|
||||
<select id="selectConfigList" parameterType="com.muyu.edition.domain.Config" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
<if test="versionCode != null and versionCode != ''">and version_code = #{versionCode}</if>
|
||||
<if test="ruleContent != null and ruleContent != ''">and rule_content = #{ruleContent}</if>
|
||||
<if test="ruleId != null ">and rule_id = #{ruleId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectConfigById" parameterType="Long" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="listConfigEs" resultType="com.muyu.edition.domain.Config">
|
||||
<include refid="selectConfigVo"/>
|
||||
where rule_id = #{ruleId}
|
||||
</select>
|
||||
|
||||
<insert id="insertConfig" parameterType="com.muyu.edition.domain.Config" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="ruleContent != null">rule_content,</if>
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="ruleContent != null">#{ruleContent},</if>
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateConfig" parameterType="com.muyu.edition.domain.Config">
|
||||
update config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="versionCode != null">version_code = #{versionCode},</if>
|
||||
<if test="ruleContent != null">rule_content = #{ruleContent},</if>
|
||||
<if test="ruleId != null">rule_id = #{ruleId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteConfigById" parameterType="Long">
|
||||
delete
|
||||
from config
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteConfigByIds" parameterType="String">
|
||||
delete from config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,11 @@
|
|||
<?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.muyu.edition.mapper.CopeMapper">
|
||||
|
||||
<select id="list" resultType="com.muyu.edition.domain.Cope">
|
||||
select *
|
||||
from cope
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,85 @@
|
|||
<?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.muyu.edition.mapper.EditionMapper">
|
||||
|
||||
<resultMap type="com.muyu.edition.domain.Edition" id="EditionResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="ruleId" column="rule_id"/>
|
||||
<result property="versionClass" column="version_class"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="versionCode" column="version_code"/>
|
||||
<result property="editionStatus" column="edition_status"/>
|
||||
<result property="ruleStatus" column="rule_status"/>
|
||||
<result property="ruleIsTest" column="rule_is_test"/>
|
||||
<result property="editionContent" column="edition_content"/>
|
||||
<result property="ruleContent" column="rule_content"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEditionVo">
|
||||
select id,
|
||||
rule_id,
|
||||
version_class,
|
||||
name,
|
||||
version_code,
|
||||
edition_status,
|
||||
rule_status,
|
||||
rule_is_test,
|
||||
edition_content,
|
||||
rule_content
|
||||
from edition
|
||||
</sql>
|
||||
|
||||
<select id="selectEditionList" parameterType="com.muyu.edition.domain.Edition" resultMap="EditionResult">
|
||||
<include refid="selectEditionVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectEditionById" parameterType="Long" resultMap="EditionResult">
|
||||
<include refid="selectEditionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEdition" parameterType="com.muyu.edition.domain.Edition" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into edition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
<if test="versionClass != null">version_class,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="editionContent != null">edition_content,</if>
|
||||
<if test="ruleContent != null">rule_content,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
<if test="versionClass != null">#{versionClass},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="editionContent != null">#{editionContent},</if>
|
||||
<if test="ruleContent != null">#{ruleContent},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEdition" parameterType="com.muyu.edition.domain.Edition">
|
||||
update edition
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="editionContent != null">edition_content = #{editionContent},</if>
|
||||
<if test="ruleContent != null">rule_content = #{ruleContent},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEditionById" parameterType="Long">
|
||||
delete
|
||||
from edition
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEditionByIds" parameterType="String">
|
||||
delete from edition where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,115 @@
|
|||
<?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.muyu.edition.mapper.RuleEngineMapper">
|
||||
|
||||
<resultMap type="com.muyu.edition.domain.RuleEngine" id="RuleEngineResult">
|
||||
<result property="ruleId" column="rule_id"/>
|
||||
<result property="ruleName" column="rule_name"/>
|
||||
<result property="ruleCode" column="rule_code"/>
|
||||
<result property="ruleLevel" column="rule_level"/>
|
||||
<result property="ruleType" column="rule_type"/>
|
||||
<result property="ruleIsActivate" column="rule_is_activate"/>
|
||||
<result property="ruleStatus" column="rule_status"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRuleEngineVo">
|
||||
select rule_id,
|
||||
rule_name,
|
||||
rule_code,
|
||||
rule_level,
|
||||
rule_type,
|
||||
rule_is_activate,
|
||||
rule_status,
|
||||
description,
|
||||
remark
|
||||
from rule_engine
|
||||
</sql>
|
||||
|
||||
<select id="selectRuleEngineList" parameterType="com.muyu.edition.domain.RuleEngine" resultMap="RuleEngineResult">
|
||||
<include refid="selectRuleEngineVo"/>
|
||||
<where>
|
||||
<if test="ruleName != null and ruleName != ''">and rule_name like concat('%', #{ruleName}, '%')</if>
|
||||
<if test="ruleLevel != null and ruleLevel != ''">and rule_level = #{ruleLevel}</if>
|
||||
<if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</if>
|
||||
<if test="ruleIsActivate != null and ruleIsActivate != ''">and rule_is_activate = #{ruleIsActivate}</if>
|
||||
<if test="ruleStatus != null and ruleStatus != ''">and rule_status = #{ruleStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRuleEngineByRuleId" parameterType="Long" resultMap="RuleEngineResult">
|
||||
<include refid="selectRuleEngineVo"/>
|
||||
where rule_id = #{ruleId}
|
||||
</select>
|
||||
<select id="description" resultType="java.lang.String">
|
||||
select description
|
||||
from rule_engine
|
||||
where rule_id = #{ruleId};
|
||||
</select>
|
||||
|
||||
<insert id="insertRuleEngine" parameterType="com.muyu.edition.domain.RuleEngine" useGeneratedKeys="true"
|
||||
keyProperty="ruleId">
|
||||
insert into rule_engine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleName != null">rule_name,</if>
|
||||
<if test="ruleCode != null">rule_code,</if>
|
||||
<if test="ruleLevel != null">rule_level,</if>
|
||||
<if test="ruleType != null">rule_type,</if>
|
||||
<if test="ruleIsActivate != null">rule_is_activate,</if>
|
||||
<if test="ruleStatus != null">rule_status,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleName != null">#{ruleName},</if>
|
||||
<if test="ruleCode != null">#{ruleCode},</if>
|
||||
<if test="ruleLevel != null">#{ruleLevel},</if>
|
||||
<if test="ruleType != null">#{ruleType},</if>
|
||||
<if test="ruleIsActivate != null">#{ruleIsActivate},</if>
|
||||
<if test="ruleStatus != null">#{ruleStatus},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRuleEngine" parameterType="com.muyu.edition.domain.RuleEngine">
|
||||
update rule_engine
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ruleName != null">rule_name = #{ruleName},</if>
|
||||
<if test="ruleCode != null">rule_code = #{ruleCode},</if>
|
||||
<if test="ruleLevel != null">rule_level = #{ruleLevel},</if>
|
||||
<if test="ruleType != null">rule_type = #{ruleType},</if>
|
||||
<if test="ruleIsActivate != null">rule_is_activate = #{ruleIsActivate},</if>
|
||||
<if test="ruleStatus != null">rule_status = #{ruleStatus},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where rule_id = #{ruleId}
|
||||
</update>
|
||||
<update id="updateRuleIsActivate">
|
||||
update rule_engine
|
||||
set rule_is_activate = #{ruleIsActivate}
|
||||
where rule_id = #{ruleId};
|
||||
</update>
|
||||
<update id="updateRuleStatus">
|
||||
update rule_engine
|
||||
set rule_status = #{ruleStatus}
|
||||
where rule_id = #{ruleId};
|
||||
</update>
|
||||
|
||||
<delete id="deleteRuleEngineByRuleId" parameterType="Long">
|
||||
delete
|
||||
from rule_engine
|
||||
where rule_id = #{ruleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRuleEngineByRuleIds" parameterType="String">
|
||||
delete from rule_engine where rule_id in
|
||||
<foreach item="ruleId" collection="array" open="(" separator="," close=")">
|
||||
#{ruleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-tests</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-test-clinet</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-test-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,15 +0,0 @@
|
|||
package com.muyu.edition.test.clinet.cllent.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
import java.rmi.server.RemoteServer;
|
||||
|
||||
public class AccessConfigRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private RemoteServer remoteServer;
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-tests</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-test-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-tests</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-test-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,4 +0,0 @@
|
|||
package com.muyu.data.test.remote;
|
||||
|
||||
public interface RemoteDataManagerService {
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.muyu.data.test.remote.factory;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
import java.rmi.Remote;
|
||||
|
||||
//熔断
|
||||
@FeignClient(
|
||||
contextId = "RemoteSys",
|
||||
value = ServiceNameConstants.TEST_MUYU,
|
||||
fallbackFactory = DataMangFacrory.class,
|
||||
path = "/system"
|
||||
)
|
||||
public class DataMangFacrory {
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-goods-tests</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-test-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>30.0-jre</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,24 +0,0 @@
|
|||
package com.muyu.test.config;
|
||||
|
||||
import com.google.common.hash.BloomFilter;
|
||||
import com.google.common.hash.Funnels;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@Configuration
|
||||
public class BloomFilterConfig {
|
||||
|
||||
@Value("${bloom-filter-exrcted-insertions}")
|
||||
private int expectedInsertions;
|
||||
|
||||
@Value("${bloom-filter.fpp}")
|
||||
private double falsePositiveProbability;
|
||||
|
||||
@Bean
|
||||
public BloomFilter<String> bloomFilter() {
|
||||
return BloomFilter.create(Funnels.stringFunnel(Charset.defaultCharset()),expectedInsertions);
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-tests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-goods-test-clinet</module>
|
||||
<module>muyu-goods-test-common</module>
|
||||
<module>muyu-goods-test-remote</module>
|
||||
<module>muyu-goods-test-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import com.muyu.edition.domain.Cope;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -8,7 +6,7 @@ import java.util.stream.Stream;
|
|||
public class stream {
|
||||
public static void main(String[] args) throws IOException {
|
||||
// stream 获取list
|
||||
List<Integer> list = Arrays.asList(1,2,3);
|
||||
List<Integer> list = Arrays.asList(1, 2, 3);
|
||||
System.out.println(list);
|
||||
Stream<Integer> integerStream = list.stream();
|
||||
List<Integer> collect1 = integerStream.collect(Collectors.toList());
|
||||
|
@ -38,7 +36,7 @@ public class stream {
|
|||
stringList.stream().distinct().forEach(System.out::println);
|
||||
// sorted 对元素进行排序
|
||||
System.out.println("排序");
|
||||
stringList.stream().sorted((a,b) -> a.length() - b.length()).forEach(System.out::println);
|
||||
stringList.stream().sorted((a, b) -> a.length() - b.length()).forEach(System.out::println);
|
||||
// peek 对每个元素进行特定操作
|
||||
System.out.println("对每个元素进行特定操作");
|
||||
stringList.stream().peek(c -> System.out.println(c.length())).map(p -> p.length() % 2 == 0).forEach(System.out::println);
|
||||
|
@ -74,23 +72,6 @@ public class stream {
|
|||
System.out.println(first.stream().collect(Collectors.toSet()));
|
||||
//findAny 返回流的任意一个元素
|
||||
|
||||
// peek 修改元素
|
||||
List<Cope> copes = new ArrayList<>();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Cope cope = new Cope();
|
||||
cope.setCode("code"+i);
|
||||
cope.setType("type"+i);
|
||||
cope.setVal("val"+i);
|
||||
copes.add(cope);
|
||||
}
|
||||
System.out.println(copes);
|
||||
Stream<Cope> peek = copes.stream().peek(c -> {
|
||||
if (c.getVal().contains("1")){
|
||||
c.setVal("123");
|
||||
}
|
||||
});
|
||||
List<Cope> collect3 = peek.collect(Collectors.toList());
|
||||
System.out.println(collect3);
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class yes {
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.goods.mapper.ConfigMapper">
|
||||
|
||||
<resultMap type="com.muyu.edition.domain.Config" id="ConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="versionCode" column="version_code" />
|
||||
<result property="ruleContent" column="rule_content" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="versionCode" column="version_code"/>
|
||||
<result property="ruleContent" column="rule_content"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="ruleId" column="rule_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConfigVo">
|
||||
select id, version_code, rule_content, remark, rule_id from config
|
||||
select id, version_code, rule_content, remark, rule_id
|
||||
from config
|
||||
</sql>
|
||||
|
||||
<select id="selectConfigList" parameterType="com.muyu.edition.domain.Config" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
<if test="versionCode != null and versionCode != ''"> and version_code = #{versionCode}</if>
|
||||
<if test="ruleContent != null and ruleContent != ''"> and rule_content = #{ruleContent}</if>
|
||||
<if test="ruleId != null "> and rule_id = #{ruleId}</if>
|
||||
<if test="versionCode != null and versionCode != ''">and version_code = #{versionCode}</if>
|
||||
<if test="ruleContent != null and ruleContent != ''">and rule_content = #{ruleContent}</if>
|
||||
<if test="ruleId != null ">and rule_id = #{ruleId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -40,12 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="ruleContent != null">rule_content,</if>
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="ruleContent != null">#{ruleContent},</if>
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateConfig" parameterType="com.muyu.edition.domain.Config">
|
||||
|
@ -59,7 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteConfigById" parameterType="Long">
|
||||
delete from config where id = #{id}
|
||||
delete
|
||||
from config
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteConfigByIds" parameterType="String">
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue