From c966d9bada8e189f0beb4867fce81ae73f3fcebd Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期日, 02 八月 2020 18:31:47 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue --- ruoyi-ui/src/views/tool/gen/genInfoForm.vue | 50 ++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java | 83 +++ ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java | 6 ruoyi-ui/src/views/system/user/index.vue | 14 ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java | 26 + ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java | 105 +++- ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java | 24 ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java | 7 ruoyi-ui/src/views/system/dict/index.vue | 16 ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java | 5 ruoyi-ui/package.json | 32 ruoyi-ui/src/main.js | 3 ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java | 5 ruoyi-ui/src/views/system/post/index.vue | 18 ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue | 2 sql/ry_20200724.sql | 4 ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java | 6 ruoyi-ui/src/utils/ruoyi.js | 43 + ruoyi-ui/src/views/system/notice/index.vue | 16 ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 60 ++ ruoyi-ui/vue.config.js | 12 ruoyi-ui/src/views/system/dept/index.vue | 58 + ruoyi-admin/src/main/resources/application.yml | 2 ruoyi-ui/src/views/monitor/job/index.vue | 14 ruoyi-ui/src/views/system/config/index.vue | 16 ruoyi-ui/src/api/tool/gen.js | 10 ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java | 16 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java | 18 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java | 30 ruoyi-ui/src/views/monitor/online/index.vue | 2 ruoyi-ui/src/views/monitor/job/log.vue | 14 ruoyi-ui/src/views/tool/gen/index.vue | 24 ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java | 5 ruoyi-ui/src/views/system/role/index.vue | 16 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java | 2 ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 6 ruoyi-ui/src/views/system/menu/index.vue | 37 + pom.xml | 10 ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java | 70 ++ ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 2 ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 98 ++- ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java | 40 ruoyi-ui/babel.config.js | 12 ruoyi-ui/src/views/monitor/logininfor/index.vue | 14 ruoyi-ui/src/views/system/dict/data.vue | 16 ruoyi-framework/pom.xml | 12 ruoyi-ui/src/components/HeaderSearch/index.vue | 2 ruoyi-ui/src/assets/styles/ruoyi.scss | 27 + ruoyi-ui/src/views/monitor/operlog/index.vue | 14 ruoyi-ui/src/views/login.vue | 5 ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm | 77 ++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java | 75 +++ ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml | 14 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java | 64 + ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 8 56 files changed, 1,058 insertions(+), 311 deletions(-) diff --git a/pom.xml b/pom.xml index 15d90be..3d45bc3 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ <druid.version>1.1.14</druid.version> <bitwalker.version>1.19</bitwalker.version> <swagger.version>2.9.2</swagger.version> + <kaptcha.version>2.3.2</kaptcha.version> <pagehelper.boot.version>1.2.5</pagehelper.boot.version> <fastjson.version>1.2.70</fastjson.version> <oshi.version>3.9.1</oshi.version> @@ -146,6 +147,13 @@ <version>${jwt.version}</version> </dependency> + <!--楠岃瘉鐮� --> + <dependency> + <groupId>com.github.penggle</groupId> + <artifactId>kaptcha</artifactId> + <version>${kaptcha.version}</version> + </dependency> + <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> @@ -161,7 +169,7 @@ <artifactId>hutool-all</artifactId> <version>${hutool.version}</version> </dependency> - + <!-- 瀹氭椂浠诲姟--> <dependency> <groupId>com.ruoyi</groupId> diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index c096344..8cafcef 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -1,16 +1,20 @@ package com.ruoyi.web.controller.common; -import java.io.ByteArrayOutputStream; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.FastByteArrayOutputStream; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import com.google.code.kaptcha.Producer; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.utils.VerifyCodeUtils; import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.utils.uuid.IdUtils; @@ -22,8 +26,18 @@ @RestController public class CaptchaController { + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + @Autowired private RedisCache redisCache; + + // 楠岃瘉鐮佺被鍨� + @Value("${ruoyi.captchaType}") + private String captchaType; /** * 鐢熸垚楠岃瘉鐮� @@ -31,32 +45,42 @@ @GetMapping("/captchaImage") public AjaxResult getCode(HttpServletResponse response) throws IOException { - // 鐢熸垚闅忔満瀛椾覆 - String verifyCode = VerifyCodeUtils.generateVerifyCode(4); - // 鍞竴鏍囪瘑 + // 淇濆瓨楠岃瘉鐮佷俊鎭� String uuid = IdUtils.simpleUUID(); String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; - redisCache.setCacheObject(verifyKey, verifyCode, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); - // 鐢熸垚鍥剧墖 - int w = 111, h = 36; - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - VerifyCodeUtils.outputImage(w, h, stream, verifyCode); + String capStr = null, code = null; + BufferedImage image = null; + + // 鐢熸垚楠岃瘉鐮� + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 杞崲娴佷俊鎭啓鍑� + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); try { - AjaxResult ajax = AjaxResult.success(); - ajax.put("uuid", uuid); - ajax.put("img", Base64.encode(stream.toByteArray())); - return ajax; + ImageIO.write(image, "jpg", os); } - catch (Exception e) + catch (IOException e) { - e.printStackTrace(); return AjaxResult.error(e.getMessage()); } - finally - { - stream.close(); - } + + AjaxResult ajax = AjaxResult.success(); + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index ed57412..3da9573 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -12,6 +12,8 @@ profile: D:/ruoyi/uploadPath # 鑾峰彇ip鍦板潃寮�鍏� addressEnabled: false + # 楠岃瘉鐮佺被鍨� math 鏁扮粍璁$畻 char 瀛楃楠岃瘉 + captchaType: math # 寮�鍙戠幆澧冮厤缃� server: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java index 9ce5aca..eed41a2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java @@ -40,6 +40,11 @@ public String readConverterExp() default ""; /** + * 鍒嗛殧绗︼紝璇诲彇瀛楃涓茬粍鍐呭 + */ + public String separator() default ","; + + /** * 瀵煎嚭绫诲瀷锛�0鏁板瓧 1瀛楃涓诧級 */ public ColumnType cellType() default ColumnType.STRING; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index a00cce6..ed91f2e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -13,7 +13,7 @@ /** * spring redis 宸ュ叿绫� - * + * * @author ruoyi **/ @SuppressWarnings(value = { "unchecked", "rawtypes" }) @@ -109,7 +109,7 @@ * 缂撳瓨List鏁版嵁 * * @param key 缂撳瓨鐨勯敭鍊� - * @param values 寰呯紦瀛樼殑List鏁版嵁 + * @param dataList 寰呯紦瀛樼殑List鏁版嵁 * @return 缂撳瓨鐨勫璞� */ public <T> long setCacheList(final String key, final List<T> dataList) @@ -216,7 +216,7 @@ /** * 鑾峰緱缂撳瓨鐨勫熀鏈璞″垪琛� - * + * * @param pattern 瀛楃涓插墠缂� * @return 瀵硅薄鍒楄〃 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java index cdc6f6f..0d3a23d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java @@ -15,6 +15,11 @@ public class DictUtils { /** + * 鍒嗛殧绗� + */ + public static final String SEPARATOR = ","; + + /** * 璁剧疆瀛楀吀缂撳瓨 * * @param key 鍙傛暟閿� @@ -36,8 +41,8 @@ Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); if (StringUtils.isNotNull(cacheObj)) { - List<SysDictData> DictDatas = StringUtils.cast(cacheObj); - return DictDatas; + List<SysDictData> dictDatas = StringUtils.cast(cacheObj); + return dictDatas; } return null; } @@ -51,21 +56,7 @@ */ public static String getDictLabel(String dictType, String dictValue) { - if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotEmpty(dictValue)) - { - List<SysDictData> datas = getDictCache(dictType); - if (StringUtils.isNotEmpty(datas)) - { - for (SysDictData dict : datas) - { - if (dictValue.equals(dict.getDictValue())) - { - return dict.getDictLabel(); - } - } - } - } - return dictValue; + return getDictLabel(dictType, dictValue, SEPARATOR); } /** @@ -77,21 +68,87 @@ */ public static String getDictValue(String dictType, String dictLabel) { - if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotEmpty(dictLabel)) + return getDictValue(dictType, dictLabel, SEPARATOR); + } + + /** + * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏稿�艰幏鍙栧瓧鍏告爣绛� + * + * @param dictType 瀛楀吀绫诲瀷 + * @param dictValue 瀛楀吀鍊� + * @param separator 鍒嗛殧绗� + * @return 瀛楀吀鏍囩 + */ + public static String getDictLabel(String dictType, String dictValue, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List<SysDictData> datas = getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas)) { - List<SysDictData> datas = getDictCache(dictType); - if (StringUtils.isNotEmpty(datas)) + for (SysDictData dict : datas) { - for (SysDictData dict : datas) + for (String value : dictValue.split(separator)) { - if (dictLabel.equals(dict.getDictLabel())) + if (value.equals(dict.getDictValue())) { - return dict.getDictValue(); + propertyString.append(dict.getDictLabel() + separator); + break; } } } } - return dictLabel; + else + { + for (SysDictData dict : datas) + { + if (dictValue.equals(dict.getDictValue())) + { + return dict.getDictLabel(); + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏告爣绛捐幏鍙栧瓧鍏稿�� + * + * @param dictType 瀛楀吀绫诲瀷 + * @param dictLabel 瀛楀吀鏍囩 + * @param separator 鍒嗛殧绗� + * @return 瀛楀吀鍊� + */ + public static String getDictValue(String dictType, String dictLabel, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List<SysDictData> datas = getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) + { + for (SysDictData dict : datas) + { + for (String label : dictLabel.split(separator)) + { + if (label.equals(dict.getDictLabel())) + { + propertyString.append(dict.getDictValue() + separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictLabel.equals(dict.getDictLabel())) + { + return dict.getDictValue(); + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 9552d0d..86141df 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -15,7 +15,7 @@ /** * 鏂囦欢涓婁紶宸ュ叿绫� - * + * * @author ruoyi */ public class FileUploadUtils @@ -89,7 +89,7 @@ * * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍 * @param file 涓婁紶鐨勬枃浠� - * @param extension 涓婁紶鏂囦欢绫诲瀷 + * @param allowedExtension 涓婁紶鏂囦欢绫诲瀷 * @return 杩斿洖涓婁紶鎴愬姛鐨勬枃浠跺悕 * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏� * @throws FileNameLengthLimitExceededException 鏂囦欢鍚嶅お闀� @@ -216,7 +216,7 @@ /** * 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑 - * + * * @param file 琛ㄥ崟鏂囦欢 * @return 鍚庣紑鍚� */ @@ -229,4 +229,4 @@ } return extension; } -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index 04d4703..d144072 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -14,7 +14,7 @@ * * @author ruoyi */ -public class FileUtils +public class FileUtils extends org.apache.commons.io.FileUtils { public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java index 970d664..bf9980a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java @@ -144,7 +144,10 @@ public static void main(String[] args) { - String html = "alert('11111');"; + String html = "<script>alert(1);</script>"; + // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; + // String html = "<123"; + // String html = "123>"; System.out.println(EscapeUtil.clean(html)); System.out.println(EscapeUtil.escape(html)); System.out.println(EscapeUtil.unescape(html)); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java index 4173956..3de26bb 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java @@ -131,7 +131,7 @@ vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; stripComment = true; encodeQuotes = true; - alwaysMakeTags = true; + alwaysMakeTags = false; } /** @@ -208,7 +208,7 @@ s = processRemoveBlanks(s); - s = validateEntities(s); + // s = validateEntities(s); return s; } @@ -245,6 +245,7 @@ // try and form html // s = regexReplace(P_END_ARROW, "", s); + // 涓嶈拷鍔犵粨鏉熸爣绛� s = regexReplace(P_BODY_TO_END, "<$1>", s); s = regexReplace(P_XML_CONTENT, "$1<$2", s); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index affb08f..494fb4b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -8,7 +8,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; -import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -200,7 +199,10 @@ // 璁剧疆绫荤殑绉佹湁瀛楁灞炴�у彲璁块棶. field.setAccessible(true); Integer column = cellMap.get(attr.name()); - fieldsMap.put(column, field); + if (column != null) + { + fieldsMap.put(column, field); + } } } for (int i = 1; i < rows; i++) @@ -271,11 +273,11 @@ } else if (StringUtils.isNotEmpty(attr.readConverterExp())) { - val = reverseByExp(Convert.toStr(val), attr.readConverterExp()); + val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); } else if (StringUtils.isNotEmpty(attr.dictType())) { - val = reverseDictByExp(attr.dictType(), Convert.toStr(val)); + val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator()); } ReflectUtils.invokeSetter(entity, propertyName, val); } @@ -534,6 +536,7 @@ Object value = getTargetValue(vo, field, attr); String dateFormat = attr.dateFormat(); String readConverterExp = attr.readConverterExp(); + String separator = attr.separator(); String dictType = attr.dictType(); if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) { @@ -541,11 +544,11 @@ } else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) { - cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp)); + cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); } else if (StringUtils.isNotEmpty(dictType)) { - cell.setCellValue(convertDictByExp(dictType, Convert.toStr(value))); + cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); } else { @@ -623,28 +626,36 @@ * * @param propertyValue 鍙傛暟鍊� * @param converterExp 缈昏瘧娉ㄨВ + * @param separator 鍒嗛殧绗� * @return 瑙f瀽鍚庡�� - * @throws Exception */ - public static String convertByExp(String propertyValue, String converterExp) throws Exception + public static String convertByExp(String propertyValue, String converterExp, String separator) { - try + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) { - String[] convertSource = converterExp.split(","); - for (String item : convertSource) + String[] itemArray = item.split("="); + if (StringUtils.containsAny(separator, propertyValue)) { - String[] itemArray = item.split("="); + for (String value : propertyValue.split(separator)) + { + if (itemArray[0].equals(value)) + { + propertyString.append(itemArray[1] + separator); + break; + } + } + } + else + { if (itemArray[0].equals(propertyValue)) { return itemArray[1]; } } } - catch (Exception e) - { - throw e; - } - return propertyValue; + return StringUtils.stripEnd(propertyString.toString(), separator); } /** @@ -652,52 +663,62 @@ * * @param propertyValue 鍙傛暟鍊� * @param converterExp 缈昏瘧娉ㄨВ + * @param separator 鍒嗛殧绗� * @return 瑙f瀽鍚庡�� - * @throws Exception */ - public static String reverseByExp(String propertyValue, String converterExp) throws Exception + public static String reverseByExp(String propertyValue, String converterExp, String separator) { - try + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) { - String[] convertSource = converterExp.split(","); - for (String item : convertSource) + String[] itemArray = item.split("="); + if (StringUtils.containsAny(separator, propertyValue)) { - String[] itemArray = item.split("="); + for (String value : propertyValue.split(separator)) + { + if (itemArray[1].equals(value)) + { + propertyString.append(itemArray[0] + separator); + break; + } + } + } + else + { if (itemArray[1].equals(propertyValue)) { return itemArray[0]; } } } - catch (Exception e) - { - throw e; - } - return propertyValue; + return StringUtils.stripEnd(propertyString.toString(), separator); } /** * 瑙f瀽瀛楀吀鍊� * - * @param dictType 瀛楀吀绫诲瀷 * @param dictValue 瀛楀吀鍊� + * @param dictType 瀛楀吀绫诲瀷 + * @param separator 鍒嗛殧绗� * @return 瀛楀吀鏍囩 */ - public static String convertDictByExp(String dictType, String dictValue) throws Exception + public static String convertDictByExp(String dictValue, String dictType, String separator) { - return DictUtils.getDictLabel(dictType, dictValue); + return DictUtils.getDictLabel(dictType, dictValue, separator); } /** * 鍙嶅悜瑙f瀽鍊煎瓧鍏稿�� * + * @param dictLabel 瀛楀吀鏍囩 * @param dictType 瀛楀吀绫诲瀷 - * @param dictValue 瀛楀吀鏍囩 + * @param separator 鍒嗛殧绗� * @return 瀛楀吀鍊� */ - public static String reverseDictByExp(String dictType, String dictLabel) throws Exception + public static String reverseDictByExp(String dictLabel, String dictType, String separator) { - return DictUtils.getDictValue(dictType, dictLabel); + return DictUtils.getDictValue(dictType, dictLabel, separator); } /** @@ -875,14 +896,7 @@ } else { - if ((Double) val % 1 > 0) - { - val = new DecimalFormat("0.00").format(val); - } - else - { - val = new DecimalFormat("0").format(val); - } + val = new BigDecimal(val.toString()); // 娴偣鏍煎紡澶勭悊 } } else if (cell.getCellTypeEnum() == CellType.STRING) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java index b31804b..0b06dd9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.sql; +import com.ruoyi.common.exception.BaseException; import com.ruoyi.common.utils.StringUtils; /** @@ -10,9 +11,9 @@ public class SqlUtil { /** - * 浠呮敮鎸佸瓧姣嶃�佹暟瀛椼�佷笅鍒掔嚎銆佺┖鏍笺�侀�楀彿锛堟敮鎸佸涓瓧娈垫帓搴忥級 + * 浠呮敮鎸佸瓧姣嶃�佹暟瀛椼�佷笅鍒掔嚎銆佺┖鏍笺�侀�楀彿銆佸皬鏁扮偣锛堟敮鎸佸涓瓧娈垫帓搴忥級 */ - public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,]+"; + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; /** * 妫�鏌ュ瓧绗︼紝闃叉娉ㄥ叆缁曡繃 @@ -21,7 +22,7 @@ { if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) { - return StringUtils.EMPTY; + throw new BaseException("鍙傛暟涓嶇鍚堣鑼冿紝涓嶈兘杩涜鏌ヨ"); } return value; } diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 7f4669f..488243e 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -47,6 +47,18 @@ <artifactId>druid-spring-boot-starter</artifactId> </dependency> + <!-- 楠岃瘉鐮� --> + <dependency> + <groupId>com.github.penggle</groupId> + <artifactId>kaptcha</artifactId> + <exclusions> + <exclusion> + <artifactId>javax.servlet-api</artifactId> + <groupId>javax.servlet</groupId> + </exclusion> + </exclusions> + </dependency> + <!-- 鑾峰彇绯荤粺淇℃伅 --> <dependency> <groupId>com.github.oshi</groupId> diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 81df4b9..35d2ce0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -20,7 +20,7 @@ /** * 鏁版嵁杩囨护澶勭悊 - * + * * @author ruoyi */ @Aspect @@ -93,10 +93,10 @@ /** * 鏁版嵁鑼冨洿杩囨护 - * + * * @param joinPoint 鍒囩偣 * @param user 鐢ㄦ埛 - * @param alias 鍒悕 + * @param userAlias 鍒悕 */ public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias) { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java new file mode 100644 index 0000000..43e78ae --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java @@ -0,0 +1,83 @@ +package com.ruoyi.framework.config; + +import java.util.Properties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import static com.google.code.kaptcha.Constants.*; + +/** + * 楠岃瘉鐮侀厤缃� + * + * @author ruoyi + */ +@Configuration +public class CaptchaConfig +{ + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 鏄惁鏈夎竟妗� 榛樿涓簍rue 鎴戜滑鍙互鑷繁璁剧疆yes锛宯o + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 楠岃瘉鐮佹枃鏈瓧绗﹂鑹� 榛樿涓篊olor.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 楠岃瘉鐮佸浘鐗囧搴� 榛樿涓�200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 楠岃瘉鐮佸浘鐗囬珮搴� 榛樿涓�50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 楠岃瘉鐮佹枃鏈瓧绗﹀ぇ灏� 榛樿涓�40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 楠岃瘉鐮佹枃鏈瓧绗﹂暱搴� 榛樿涓�5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 楠岃瘉鐮佹枃鏈瓧浣撴牱寮� 榛樿涓簄ew Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 鍥剧墖鏍峰紡 姘寸汗com.google.code.kaptcha.impl.WaterRipple 楸肩溂com.google.code.kaptcha.impl.FishEyeGimpy 闃村奖com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } + + @Bean(name = "captchaProducerMath") + public DefaultKaptcha getKaptchaBeanMath() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 鏄惁鏈夎竟妗� 榛樿涓簍rue 鎴戜滑鍙互鑷繁璁剧疆yes锛宯o + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 杈规棰滆壊 榛樿涓篊olor.BLACK + properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); + // 楠岃瘉鐮佹枃鏈瓧绗﹂鑹� 榛樿涓篊olor.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); + // 楠岃瘉鐮佸浘鐗囧搴� 榛樿涓�200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 楠岃瘉鐮佸浘鐗囬珮搴� 榛樿涓�50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 楠岃瘉鐮佹枃鏈瓧绗﹀ぇ灏� 榛樿涓�40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); + // 楠岃瘉鐮佹枃鏈敓鎴愬櫒 + properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ruoyi.framework.config.KaptchaTextCreator"); + // 楠岃瘉鐮佹枃鏈瓧绗﹂棿璺� 榛樿涓�2 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); + // 楠岃瘉鐮佹枃鏈瓧绗﹂暱搴� 榛樿涓�5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); + // 楠岃瘉鐮佹枃鏈瓧浣撴牱寮� 榛樿涓簄ew Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 楠岃瘉鐮佸櫔鐐归鑹� 榛樿涓篊olor.BLACK + properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); + // 骞叉壈瀹炵幇绫� + properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); + // 鍥剧墖鏍峰紡 姘寸汗com.google.code.kaptcha.impl.WaterRipple 楸肩溂com.google.code.kaptcha.impl.FishEyeGimpy 闃村奖com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java new file mode 100644 index 0000000..3e74580 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java @@ -0,0 +1,75 @@ +package com.ruoyi.framework.config; + +import java.util.Random; +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +/** + * 楠岃瘉鐮佹枃鏈敓鎴愬櫒 + * + * @author ruoyi + */ +public class KaptchaTextCreator extends DefaultTextCreator +{ + private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); + + @Override + public String getText() + { + Integer result = 0; + Random random = new Random(); + int x = random.nextInt(10); + int y = random.nextInt(10); + StringBuilder suChinese = new StringBuilder(); + int randomoperands = (int) Math.round(Math.random() * 2); + if (randomoperands == 0) + { + result = x * y; + suChinese.append(CNUMBERS[x]); + suChinese.append("*"); + suChinese.append(CNUMBERS[y]); + } + else if (randomoperands == 1) + { + if (!(x == 0) && y % x == 0) + { + result = y / x; + suChinese.append(CNUMBERS[y]); + suChinese.append("/"); + suChinese.append(CNUMBERS[x]); + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + } + else if (randomoperands == 2) + { + if (x >= y) + { + result = x - y; + suChinese.append(CNUMBERS[x]); + suChinese.append("-"); + suChinese.append(CNUMBERS[y]); + } + else + { + result = y - x; + suChinese.append(CNUMBERS[y]); + suChinese.append("-"); + suChinese.append(CNUMBERS[x]); + } + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java index bce2f3f..d310382 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java @@ -13,7 +13,7 @@ /** * 闃叉閲嶅鎻愪氦鎷︽埅鍣� - * + * * @author ruoyi */ @Component @@ -46,8 +46,8 @@ /** * 楠岃瘉鏄惁閲嶅鎻愪氦鐢卞瓙绫诲疄鐜板叿浣撶殑闃查噸澶嶆彁浜ょ殑瑙勫垯 - * - * @param httpServletRequest + * + * @param request * @return * @throws Exception */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java index 072aa5e..0023855 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -22,7 +22,7 @@ /** * token楠岃瘉澶勭悊 - * + * * @author ruoyi */ @Component @@ -51,7 +51,7 @@ /** * 鑾峰彇鐢ㄦ埛韬唤淇℃伅 - * + * * @return 鐢ㄦ埛淇℃伅 */ public LoginUser getLoginUser(HttpServletRequest request) @@ -95,7 +95,7 @@ /** * 鍒涘缓浠ょ墝 - * + * * @param loginUser 鐢ㄦ埛淇℃伅 * @return 浠ょ墝 */ @@ -113,8 +113,8 @@ /** * 楠岃瘉浠ょ墝鏈夋晥鏈燂紝鐩稿樊涓嶈冻20鍒嗛挓锛岃嚜鍔ㄥ埛鏂扮紦瀛� - * - * @param token 浠ょ墝 + * + * @param loginUser * @return 浠ょ墝 */ public void verifyToken(LoginUser loginUser) @@ -129,7 +129,7 @@ /** * 鍒锋柊浠ょ墝鏈夋晥鏈� - * + * * @param loginUser 鐧诲綍淇℃伅 */ public void refreshToken(LoginUser loginUser) @@ -140,10 +140,10 @@ String userKey = getTokenKey(loginUser.getToken()); redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); } - + /** * 璁剧疆鐢ㄦ埛浠g悊淇℃伅 - * + * * @param loginUser 鐧诲綍淇℃伅 */ public void setUserAgent(LoginUser loginUser) @@ -155,7 +155,7 @@ loginUser.setBrowser(userAgent.getBrowser().getName()); loginUser.setOs(userAgent.getOperatingSystem().getName()); } - + /** * 浠庢暟鎹0鏄庣敓鎴愪护鐗� * diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 9c64782..d1dc739 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -148,15 +148,27 @@ } /** - * 鐢熸垚浠g爜 + * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) + @GetMapping("/download/{tableName}") + public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException + { + byte[] data = genTableService.downloadCode(tableName); + genCode(response, data); + } + + /** + * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� */ @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") - public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException + public AjaxResult genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) { - byte[] data = genTableService.generatorCode(tableName); - genCode(response, data); + genTableService.generatorCode(tableName); + return AjaxResult.success(); } /** @@ -168,7 +180,7 @@ public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); - byte[] data = genTableService.generatorCode(tableNames); + byte[] data = genTableService.downloadCode(tableNames); genCode(response, data); } @@ -185,4 +197,4 @@ response.setContentType("application/octet-stream; charset=UTF-8"); IOUtils.write(data, response.getOutputStream()); } -} +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 56acaf8..f52dce5 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -55,6 +55,12 @@ @NotBlank(message = "浣滆�呬笉鑳戒负绌�") private String functionAuthor; + /** 鐢熸垚浠g爜鏂瑰紡锛�0zip鍘嬬缉鍖� 1鑷畾涔夎矾寰勶級 */ + private String genType; + + /** 鐢熸垚璺緞锛堜笉濉粯璁ら」鐩矾寰勶級 */ + private String genPath; + /** 涓婚敭淇℃伅 */ private GenTableColumn pkColumn; @@ -180,6 +186,26 @@ this.functionAuthor = functionAuthor; } + public String getGenType() + { + return genType; + } + + public void setGenType(String genType) + { + this.genType = genType; + } + + public String getGenPath() + { + return genPath; + } + + public void setGenPath(String genPath) + { + this.genPath = genPath; + } + public GenTableColumn getPkColumn() { return pkColumn; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 0aa26ff..3d521fa 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.generator.service; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.util.LinkedHashMap; @@ -21,9 +22,11 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.core.text.CharsetKit; import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.mapper.GenTableColumnMapper; @@ -202,13 +205,13 @@ } /** - * 鐢熸垚浠g爜 + * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 * * @param tableName 琛ㄥ悕绉� * @return 鏁版嵁 */ @Override - public byte[] generatorCode(String tableName) + public byte[] downloadCode(String tableName) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(outputStream); @@ -218,13 +221,55 @@ } /** - * 鎵归噺鐢熸垚浠g爜 + * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� + * + * @param tableName 琛ㄥ悕绉� + * @return 鏁版嵁 + */ + @Override + public void generatorCode(String tableName) + { + // 鏌ヨ琛ㄤ俊鎭� + GenTable table = genTableMapper.selectGenTableByName(tableName); + // 鏌ヨ鍒椾俊鎭� + List<GenTableColumn> columns = table.getColumns(); + setPkColumn(table, columns); + + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 鑾峰彇妯℃澘鍒楄〃 + List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) + { + // 娓叉煋妯℃澘 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + try + { + String path = getGenPath(table, template); + FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); + } + catch (IOException e) + { + throw new CustomException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); + } + } + } + } + + /** + * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 * * @param tableNames 琛ㄦ暟缁� * @return 鏁版嵁 */ @Override - public byte[] generatorCode(String[] tableNames) + public byte[] downloadCode(String[] tableNames) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(outputStream); @@ -347,4 +392,21 @@ genTable.setParentMenuName(parentMenuName); } } + + /** + * 鑾峰彇浠g爜鐢熸垚鍦板潃 + * + * @param table 涓氬姟琛ㄤ俊鎭� + * @param template 妯℃澘鏂囦欢璺緞 + * @return 鐢熸垚鍦板潃 + */ + public static String getGenPath(GenTable table, String template) + { + String genPath = table.getGenPath(); + if (StringUtils.equals(genPath, "/")) + { + return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); + } + return genPath + File.separator + VelocityUtils.getFileName(template, table); + } } \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java index 06a4bbe..e017d35 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java @@ -75,20 +75,28 @@ public Map<String, String> previewCode(Long tableId); /** - * 鐢熸垚浠g爜 + * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 * * @param tableName 琛ㄥ悕绉� * @return 鏁版嵁 */ - public byte[] generatorCode(String tableName); + public byte[] downloadCode(String tableName); /** - * 鎵归噺鐢熸垚浠g爜 + * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� + * + * @param tableName 琛ㄥ悕绉� + * @return 鏁版嵁 + */ + public void generatorCode(String tableName); + + /** + * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 * * @param tableNames 琛ㄦ暟缁� * @return 鏁版嵁 */ - public byte[] generatorCode(String[] tableNames); + public byte[] downloadCode(String[] tableNames); /** * 淇敼淇濆瓨鍙傛暟鏍¢獙 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 20fd1da..091a956 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -11,20 +11,25 @@ import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; +/** + * 妯℃澘澶勭悊宸ュ叿绫� + * + * @author ruoyi + */ public class VelocityUtils { /** 椤圭洰绌洪棿璺緞 */ private static final String PROJECT_PATH = "main/java"; /** mybatis绌洪棿璺緞 */ - private static final String MYBATIS_PATH = "main/resources/mybatis"; + private static final String MYBATIS_PATH = "main/resources/mapper"; /** 榛樿涓婄骇鑿滃崟锛岀郴缁熷伐鍏� */ private static final String DEFAULT_PARENT_MENU_ID = "3"; /** * 璁剧疆妯℃澘鍙橀噺淇℃伅 - * + * * @return 妯℃澘鍒楄〃 */ public static VelocityContext prepareContext(GenTable genTable) @@ -93,7 +98,7 @@ /** * 鑾峰彇妯℃澘淇℃伅 - * + * * @return 妯℃澘鍒楄〃 */ public static List<String> getTemplateList(String tplCategory) @@ -183,7 +188,7 @@ /** * 鑾峰彇鍖呭墠缂� - * + * * @param packageName 鍖呭悕绉� * @return 鍖呭墠缂�鍚嶇О */ @@ -196,8 +201,8 @@ /** * 鏍规嵁鍒楃被鍨嬭幏鍙栧鍏ュ寘 - * - * @param column 鍒楅泦鍚� + * + * @param columns 鍒楅泦鍚� * @return 杩斿洖闇�瑕佸鍏ョ殑鍖呭垪琛� */ public static HashSet<String> getImportList(List<GenTableColumn> columns) @@ -220,7 +225,7 @@ /** * 鑾峰彇鏉冮檺鍓嶇紑 - * + * * @param moduleName 妯″潡鍚嶇О * @param businessName 涓氬姟鍚嶇О * @return 杩斿洖鏉冮檺鍓嶇紑 @@ -228,13 +233,12 @@ public static String getPermissionPrefix(String moduleName, String businessName) { return StringUtils.format("{}:{}", moduleName, businessName); - } /** * 鑾峰彇涓婄骇鑿滃崟ID瀛楁 - * - * @param options 鐢熸垚鍏朵粬閫夐」 + * + * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 涓婄骇鑿滃崟ID瀛楁 */ public static String getParentMenuId(JSONObject paramsObj) @@ -248,8 +252,8 @@ /** * 鑾峰彇鏍戠紪鐮� - * - * @param options 鐢熸垚鍏朵粬閫夐」 + * + * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戠紪鐮� */ public static String getTreecode(JSONObject paramsObj) @@ -263,8 +267,8 @@ /** * 鑾峰彇鏍戠埗缂栫爜 - * - * @param options 鐢熸垚鍏朵粬閫夐」 + * + * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戠埗缂栫爜 */ public static String getTreeParentCode(JSONObject paramsObj) @@ -278,8 +282,8 @@ /** * 鑾峰彇鏍戝悕绉� - * - * @param options 鐢熸垚鍏朵粬閫夐」 + * + * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戝悕绉� */ public static String getTreeName(JSONObject paramsObj) @@ -293,7 +297,7 @@ /** * 鑾峰彇闇�瑕佸湪鍝竴鍒椾笂闈㈡樉绀哄睍寮�鎸夐挳 - * + * * @param genTable 涓氬姟琛ㄥ璞� * @return 灞曞紑鎸夐挳鍒楀簭鍙� */ @@ -317,4 +321,4 @@ } return num; } -} \ No newline at end of file +} diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index 3c73ecb..fc41807 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -15,6 +15,8 @@ <result property="businessName" column="business_name" /> <result property="functionName" column="function_name" /> <result property="functionAuthor" column="function_author" /> + <result property="genType" column="gen_type" /> + <result property="genPath" column="gen_path" /> <result property="options" column="options" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> @@ -50,7 +52,7 @@ </resultMap> <sql id="selectGenTableVo"> - select table_id, table_name, table_comment, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, options, create_by, create_time, update_by, update_time, remark from gen_table + select table_id, table_name, table_comment, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table </sql> <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> @@ -106,7 +108,7 @@ </select> <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> - SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, + SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort FROM gen_table t LEFT JOIN gen_table_column c ON t.table_id = c.table_id @@ -114,7 +116,7 @@ </select> <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> - SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, + SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort FROM gen_table t LEFT JOIN gen_table_column c ON t.table_id = c.table_id @@ -132,6 +134,8 @@ <if test="businessName != null and businessName != ''">business_name,</if> <if test="functionName != null and functionName != ''">function_name,</if> <if test="functionAuthor != null and functionAuthor != ''">function_author,</if> + <if test="genType != null and genType != ''">gen_type,</if> + <if test="genPath != null and genPath != ''">gen_path,</if> <if test="remark != null and remark != ''">remark,</if> <if test="createBy != null and createBy != ''">create_by,</if> create_time @@ -145,6 +149,8 @@ <if test="businessName != null and businessName != ''">#{businessName},</if> <if test="functionName != null and functionName != ''">#{functionName},</if> <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if> + <if test="genType != null and genType != ''">#{genType},</if> + <if test="genPath != null and genPath != ''">#{genPath},</if> <if test="remark != null and remark != ''">#{remark},</if> <if test="createBy != null and createBy != ''">#{createBy},</if> sysdate() @@ -158,6 +164,8 @@ <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if> <if test="className != null and className != ''">class_name = #{className},</if> <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if> + <if test="genType != null and genType != ''">gen_type = #{genType},</if> + <if test="genPath != null and genPath != ''">gen_path = #{genPath},</if> <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if> <if test="packageName != null and packageName != ''">package_name = #{packageName},</if> <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if> diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index fb10ed6..a6ae202 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> #foreach($column in $columns) #if($column.query) #set($dictType=$column.dictType) @@ -51,23 +51,30 @@ #end #end <el-form-item> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> <el-button - class="filter-item" - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >鎼滅储</el-button> - <el-button - class="filter-item" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['${moduleName}:${businessName}:add']" >鏂板</el-button> - </el-form-item> - </el-form> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> <el-table v-loading="loading" @@ -157,6 +164,23 @@ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> </el-select> </el-form-item> +#elseif($column.htmlType == "checkbox" && "" != $dictType) + <el-form-item label="${comment}"> + <el-checkbox-group v-model="form.${field}"> + <el-checkbox + v-for="dict in ${field}Options" + :key="dict.dictValue" + :label="dict.dictValue"> + {{dict.dictLabel}} + </el-checkbox> + </el-checkbox-group> + </el-form-item> +#elseif($column.htmlType == "checkbox" && $dictType) + <el-form-item label="${comment}"> + <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}"> <el-radio-group v-model="form.${field}"> @@ -212,6 +236,8 @@ return { // 閬僵灞� loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // ${functionName}琛ㄦ牸鏁版嵁 ${businessName}List: [], // ${functionName}鏍戦�夐」 @@ -236,7 +262,7 @@ queryParams: { #foreach ($column in $columns) #if($column.query) - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + $column.javaField: null#if($velocityCount != $columns.size()),#end #end #end @@ -312,7 +338,7 @@ #end // $comment瀛楀吀缈昏瘧 ${column.javaField}Format(row, column) { - return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); + return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField}); }, #end #end @@ -326,10 +352,13 @@ this.form = { #foreach ($column in $columns) #if($column.htmlType == "radio") - $column.javaField: "0"#if($velocityCount != $columns.size()),#end + $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end + +#elseif($column.htmlType == "checkbox") + $column.javaField: []#if($velocityCount != $columns.size()),#end #else - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + $column.javaField: null#if($velocityCount != $columns.size()),#end #end #end @@ -356,20 +385,30 @@ handleUpdate(row) { this.reset(); this.getTreeselect(); - if (row != undefined) { + if (row != null) { this.form.${treeParentCode} = row.${treeCode}; } get${BusinessName}(row.${pkColumn.javaField}).then(response => { this.form = response.data; +#foreach ($column in $columns) +#if($column.htmlType == "checkbox") + this.form.$column.javaField = this.form.${column.javaField}.split(","); +#end +#end this.open = true; this.title = "淇敼${functionName}"; }); }, /** 鎻愪氦鎸夐挳 */ - submitForm: function() { + submitForm() { this.#[[$]]#refs["form"].validate(valid => { if (valid) { - if (this.form.${pkColumn.javaField} != undefined) { +#foreach ($column in $columns) +#if($column.htmlType == "checkbox") + this.form.$column.javaField = this.form.${column.javaField}.join(","); +#end +#end + if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { if (response.code === 200) { this.msgSuccess("淇敼鎴愬姛"); @@ -404,4 +443,4 @@ } } }; -</script> \ No newline at end of file +</script> diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 273135f..9d6fc23 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> #foreach($column in $columns) #if($column.query) #set($dictType=$column.dictType) @@ -51,7 +51,7 @@ #end #end <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -95,6 +95,14 @@ v-hasPermi="['${moduleName}:${businessName}:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> @@ -185,6 +193,23 @@ <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> </el-select> </el-form-item> +#elseif($column.htmlType == "checkbox" && "" != $dictType) + <el-form-item label="${comment}"> + <el-checkbox-group v-model="form.${field}"> + <el-checkbox + v-for="dict in ${field}Options" + :key="dict.dictValue" + :label="dict.dictValue"> + {{dict.dictLabel}} + </el-checkbox> + </el-checkbox-group> + </el-form-item> +#elseif($column.htmlType == "checkbox" && $dictType) + <el-form-item label="${comment}"> + <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}"> <el-radio-group v-model="form.${field}"> @@ -243,6 +268,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // ${functionName}琛ㄦ牸鏁版嵁 @@ -269,7 +296,7 @@ pageSize: 10, #foreach ($column in $columns) #if($column.query) - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + $column.javaField: null#if($velocityCount != $columns.size()),#end #end #end @@ -326,7 +353,7 @@ #end // $comment瀛楀吀缈昏瘧 ${column.javaField}Format(row, column) { - return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); + return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField}); }, #end #end @@ -340,10 +367,13 @@ this.form = { #foreach ($column in $columns) #if($column.htmlType == "radio") - $column.javaField: "0"#if($velocityCount != $columns.size()),#end + $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end + +#elseif($column.htmlType == "checkbox") + $column.javaField: []#if($velocityCount != $columns.size()),#end #else - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + $column.javaField: null#if($velocityCount != $columns.size()),#end #end #end @@ -363,7 +393,7 @@ // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.${pkColumn.javaField}) - this.single = selection.length!=1 + this.single = selection.length!==1 this.multiple = !selection.length }, /** 鏂板鎸夐挳鎿嶄綔 */ @@ -378,15 +408,25 @@ const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids get${BusinessName}(${pkColumn.javaField}).then(response => { this.form = response.data; +#foreach ($column in $columns) +#if($column.htmlType == "checkbox") + this.form.$column.javaField = this.form.${column.javaField}.split(","); +#end +#end this.open = true; this.title = "淇敼${functionName}"; }); }, /** 鎻愪氦鎸夐挳 */ - submitForm: function() { + submitForm() { this.#[[$]]#refs["form"].validate(valid => { if (valid) { - if (this.form.${pkColumn.javaField} != undefined) { +#foreach ($column in $columns) +#if($column.htmlType == "checkbox") + this.form.$column.javaField = this.form.${column.javaField}.join(","); +#end +#end + if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { if (response.code === 200) { this.msgSuccess("淇敼鎴愬姛"); @@ -435,4 +475,4 @@ } } }; -</script> \ No newline at end of file +</script> diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java index a0aadb6..fd652d6 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java @@ -66,7 +66,7 @@ * 鎵ц鍚� * * @param context 宸ヤ綔鎵ц涓婁笅鏂囧璞� - * @param sysScheduleJob 绯荤粺璁″垝浠诲姟 + * @param sysJob 绯荤粺璁″垝浠诲姟 */ protected void after(JobExecutionContext context, SysJob sysJob, Exception e) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java index e99e067..7b156fa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java @@ -6,14 +6,14 @@ /** * 鑿滃崟琛� 鏁版嵁灞� - * + * * @author ruoyi */ public interface SysMenuMapper { /** * 鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param menu 鑿滃崟淇℃伅 * @return 鑿滃崟鍒楄〃 */ @@ -21,14 +21,14 @@ /** * 鏍规嵁鐢ㄦ埛鎵�鏈夋潈闄� - * + * * @return 鏉冮檺鍒楄〃 */ public List<String> selectMenuPerms(); /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param menu 鑿滃崟淇℃伅 * @return 鑿滃崟鍒楄〃 */ @@ -36,7 +36,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 - * + * * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ @@ -44,22 +44,22 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟 - * + * * @return 鑿滃崟鍒楄〃 */ public List<SysMenu> selectMenuTreeAll(); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟 - * - * @param username 鐢ㄦ埛ID + * + * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ public List<SysMenu> selectMenuTreeByUserId(Long userId); /** * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭� - * + * * @param roleId 瑙掕壊ID * @return 閫変腑鑿滃崟鍒楄〃 */ @@ -67,7 +67,7 @@ /** * 鏍规嵁鑿滃崟ID鏌ヨ淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 鑿滃崟淇℃伅 */ @@ -75,7 +75,7 @@ /** * 鏄惁瀛樺湪鑿滃崟瀛愯妭鐐� - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -83,7 +83,7 @@ /** * 鏂板鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -91,7 +91,7 @@ /** * 淇敼鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -99,7 +99,7 @@ /** * 鍒犻櫎鑿滃崟绠$悊淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -107,7 +107,7 @@ /** * 鏍¢獙鑿滃崟鍚嶇О鏄惁鍞竴 - * + * * @param menuName 鑿滃崟鍚嶇О * @param parentId 鐖惰彍鍗旾D * @return 缁撴灉 diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index cece2f4..af54bd9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -77,7 +77,7 @@ <select id="checkDeptNameUnique" resultMap="SysDeptResult"> <include refid="selectDeptVo"/> - where dept_name=#{deptName} and parent_id = #{parentId} + where dept_name=#{deptName} and parent_id = #{parentId} limit 1 </select> <insert id="insertDept" parameterType="SysDept"> diff --git a/ruoyi-ui/babel.config.js b/ruoyi-ui/babel.config.js index ba17966..b99f001 100644 --- a/ruoyi-ui/babel.config.js +++ b/ruoyi-ui/babel.config.js @@ -1,5 +1,13 @@ module.exports = { presets: [ - '@vue/app' - ] + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app + '@vue/cli-plugin-babel/preset' + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + 'plugins': ['dynamic-import-node'] + } + } } diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index b8e30be..d8ce134 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -5,7 +5,7 @@ "author": "鑻ヤ緷", "license": "MIT", "scripts": { - "dev": "vue-cli-service serve --open", + "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", @@ -43,10 +43,11 @@ "@riophae/vue-treeselect": "0.4.0", "axios": "0.18.1", "clipboard": "2.0.4", + "core-js": "3.6.5", "echarts": "4.2.1", "element-ui": "2.13.2", "file-saver": "2.0.1", - "js-beautify": "^1.10.2", + "js-beautify": "1.10.2", "fuse.js": "3.4.4", "js-cookie": "2.2.0", "jsencrypt": "3.0.0-rc.1", @@ -65,32 +66,31 @@ "vuex": "3.1.0" }, "devDependencies": { - "@vue/cli-plugin-babel": "3.5.3", - "@vue/cli-plugin-eslint": "^3.9.1", - "@vue/cli-plugin-unit-jest": "3.5.3", - "@vue/cli-service": "3.5.3", + "@vue/cli-plugin-babel": "4.4.4", + "@vue/cli-plugin-eslint": "4.4.4", + "@vue/cli-plugin-unit-jest": "4.4.4", + "@vue/cli-service": "4.4.4", "@vue/test-utils": "1.0.0-beta.29", - "autoprefixer": "^9.5.1", - "babel-core": "7.0.0-bridge.0", - "babel-eslint": "10.0.1", + "autoprefixer": "9.5.1", + "babel-eslint": "10.1.0", "babel-jest": "23.6.0", + "babel-plugin-dynamic-import-node": "2.3.3", "chalk": "2.4.2", "chokidar": "2.1.5", "connect": "3.6.6", - "eslint": "5.15.3", - "eslint-plugin-vue": "5.2.2", + "eslint": "6.7.2", + "eslint-plugin-vue": "6.2.2", "html-webpack-plugin": "3.2.0", - "http-proxy-middleware": "^0.19.1", "husky": "1.3.1", "lint-staged": "8.1.5", "mockjs": "1.0.1-beta3", - "node-sass": "^4.9.0", "plop": "2.3.0", - "runjs": "^4.3.2", - "sass-loader": "^7.1.0", + "runjs": "4.3.2", + "sass": "1.26.10", + "sass-loader": "8.0.2", "script-ext-html-webpack-plugin": "2.1.3", "script-loader": "0.7.2", - "serve-static": "^1.13.2", + "serve-static": "1.13.2", "svg-sprite-loader": "4.1.3", "svgo": "1.2.0", "vue-template-compiler": "2.6.10" diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js index 09a0b6f..ed8c2e4 100644 --- a/ruoyi-ui/src/api/tool/gen.js +++ b/ruoyi-ui/src/api/tool/gen.js @@ -42,6 +42,7 @@ params: data }) } + // 棰勮鐢熸垚浠g爜 export function previewTable(tableId) { return request({ @@ -49,6 +50,7 @@ method: 'get' }) } + // 鍒犻櫎琛ㄦ暟鎹� export function delTable(tableId) { return request({ @@ -57,3 +59,11 @@ }) } +// 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� +export function genCode(tableName) { + return request({ + url: '/tool/gen/genCode/' + tableName, + method: 'get' + }) +} + diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss index a5bcbb9..06254d2 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -142,7 +142,28 @@ padding-left: 15px; margin-bottom: 10px; } - + +/* button color */ +.el-button--cyan.is-active, +.el-button--cyan:active { + background: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +.el-button--cyan:focus, +.el-button--cyan:hover { + background: #48D1CC; + border-color: #48D1CC; + color: #FFFFFF; +} + +.el-button--cyan { + background-color: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + /* text color */ .text-navy { color: #1ab394; @@ -198,4 +219,8 @@ opacity: .8; color: #fff!important; background: #42b983!important; +} + +.top-right-btn { + float: right; } \ No newline at end of file diff --git a/ruoyi-ui/src/components/HeaderSearch/index.vue b/ruoyi-ui/src/components/HeaderSearch/index.vue index 3b4790d..9a11a51 100644 --- a/ruoyi-ui/src/components/HeaderSearch/index.vue +++ b/ruoyi-ui/src/components/HeaderSearch/index.vue @@ -167,7 +167,7 @@ display: inline-block; vertical-align: middle; - /deep/ .el-input__inner { + ::v-deep .el-input__inner { border-radius: 0; border: 0; padding-left: 0; diff --git a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue index 34a7e55..bb753a1 100644 --- a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue +++ b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue @@ -82,7 +82,7 @@ position: relative; overflow: hidden; width: 100%; - /deep/ { + ::v-deep { .el-scrollbar__bar { bottom: 0px; } diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index c30cd7d..8a9a60c 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -18,7 +18,7 @@ import './permission' // permission control import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; -import { parseTime, resetForm, addDateRange, selectDictLabel, download, handleTree } from "@/utils/ruoyi"; +import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi"; import Pagination from "@/components/Pagination"; // 鍏ㄥ眬鏂规硶鎸傝浇 @@ -28,6 +28,7 @@ Vue.prototype.resetForm = resetForm Vue.prototype.addDateRange = addDateRange Vue.prototype.selectDictLabel = selectDictLabel +Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.download = download Vue.prototype.handleTree = handleTree diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 2388082..5b109a0 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -77,6 +77,21 @@ return actions.join(''); } +// 鍥炴樉鏁版嵁瀛楀吀锛堝瓧绗︿覆鏁扮粍锛� +export function selectDictLabels(datas, value, separator) { + var actions = []; + var currentSeparator = undefined === separator ? "," : separator; + var temp = value.split(currentSeparator); + Object.keys(value.split(currentSeparator)).some((val) => { + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + temp[val])) { + actions.push(datas[key].dictLabel + currentSeparator); + } + }) + }) + return actions.join('').substring(0, actions.join('').length - 1); +} + // 閫氱敤涓嬭浇鏂规硶 export function download(fileName) { window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true; @@ -98,10 +113,10 @@ // 杞崲瀛楃涓诧紝undefined,null绛夎浆鍖栦负"" export function praseStrEmpty(str) { - if (!str || str == "undefined" || str == "null") { - return ""; - } - return str; + if (!str || str == "undefined" || str == "null") { + return ""; + } + return str; } /** @@ -120,15 +135,15 @@ //瀵规簮鏁版嵁娣卞害鍏嬮殕 const cloneData = JSON.parse(JSON.stringify(data)) //寰幆鎵�鏈夐」 - const treeData = cloneData.filter(father => { - let branchArr = cloneData.filter(child => { - //杩斿洖姣忎竴椤圭殑瀛愮骇鏁扮粍 - return father[id] === child[parentId] - }); - branchArr.length > 0 ? father.children = branchArr : ''; - //杩斿洖绗竴灞� - return father[parentId] === rootId; + const treeData = cloneData.filter(father => { + let branchArr = cloneData.filter(child => { + //杩斿洖姣忎竴椤圭殑瀛愮骇鏁扮粍 + return father[id] === child[parentId] + }); + branchArr.length > 0 ? father.children = branchArr : ''; + //杩斿洖绗竴灞� + return father[parentId] === rootId; }); return treeData != '' ? treeData : data; - } - +} + diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 91df596..8486503 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -29,7 +29,7 @@ <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> </el-input> <div class="login-code"> - <img :src="codeUrl" @click="getCode" /> + <img :src="codeUrl" @click="getCode" class="login-code-img"/> </div> </el-form-item> <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox> @@ -200,4 +200,7 @@ font-size: 12px; letter-spacing: 1px; } +.login-code-img { + height: 38px; +} </style> diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 061dfbe..7a90991 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> <el-input v-model="queryParams.jobName" @@ -31,7 +31,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -84,6 +84,14 @@ v-hasPermi="['monitor:job:query']" >鏃ュ織</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> @@ -274,6 +282,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 瀹氭椂浠诲姟琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index 254f486..0ddbba6 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> <el-input v-model="queryParams.jobName" @@ -56,7 +56,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -90,6 +90,14 @@ v-hasPermi="['monitor:job:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="jobLogList" @selection-change="handleSelectionChange"> @@ -175,6 +183,8 @@ ids: [], // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 璋冨害鏃ュ織琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index c92b55e..b1b5cac 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="鐧诲綍鍦板潃" prop="ipaddr"> <el-input v-model="queryParams.ipaddr" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -84,6 +84,14 @@ v-hasPermi="['system:logininfor:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> @@ -126,6 +134,8 @@ ids: [], // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index 580d71c..f3cb911 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -20,7 +20,7 @@ /> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index d593698..22d4fb9 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="绯荤粺妯″潡" prop="title"> <el-input v-model="queryParams.title" @@ -66,7 +66,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -100,6 +100,14 @@ v-hasPermi="['system:config:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> @@ -195,6 +203,8 @@ ids: [], // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index dffe611..f0515e4 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="鍙傛暟鍚嶇О" prop="configName"> <el-input v-model="queryParams.configName" @@ -44,7 +44,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -97,6 +97,14 @@ v-hasPermi="['system:config:remove']" >娓呯悊缂撳瓨</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> @@ -188,6 +196,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 鍙傛暟琛ㄦ牸鏁版嵁 @@ -356,4 +366,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index c1e5d47..5499af7 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> - <el-form :inline="true"> - <el-form-item label="閮ㄩ棬鍚嶇О"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> <el-input v-model="queryParams.deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" @@ -10,7 +10,7 @@ @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="鐘舵��"> + <el-form-item label="鐘舵��" prop="status"> <el-select v-model="queryParams.status" placeholder="閮ㄩ棬鐘舵��" clearable size="small"> <el-option v-for="dict in statusOptions" @@ -21,23 +21,30 @@ </el-select> </el-form-item> <el-form-item> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> <el-button - class="filter-item" - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >鎼滅储</el-button> - <el-button - class="filter-item" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:dept:add']" >鏂板</el-button> - </el-form-item> - </el-form> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> <el-table v-loading="loading" @@ -56,17 +63,17 @@ </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" + <el-button + size="mini" + type="text" + icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dept:edit']" >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" + <el-button + size="mini" + type="text" + icon="el-icon-plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']" >鏂板</el-button> @@ -149,6 +156,8 @@ return { // 閬僵灞� loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 琛ㄦ牸鏍戞暟鎹� deptList: [], // 閮ㄩ棬鏍戦�夐」 @@ -247,6 +256,11 @@ handleQuery() { this.getList(); }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd(row) { this.reset(); @@ -310,4 +324,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 7108e32..8270343 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true"> + <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true"> <el-form-item label="瀛楀吀鍚嶇О" prop="dictType"> <el-select v-model="queryParams.dictType" size="small"> <el-option @@ -31,7 +31,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -75,6 +75,14 @@ v-hasPermi="['system:dict:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> @@ -170,6 +178,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 瀛楀吀琛ㄦ牸鏁版嵁 @@ -348,4 +358,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index c2a4f0f..11fcbb4 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="瀛楀吀鍚嶇О" prop="dictName"> <el-input v-model="queryParams.dictName" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -103,6 +103,14 @@ v-hasPermi="['system:dict:remove']" >娓呯悊缂撳瓨</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> @@ -196,6 +204,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 瀛楀吀琛ㄦ牸鏁版嵁 @@ -360,4 +370,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 9fc2d78..cf75ebf 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> - <el-form :inline="true"> - <el-form-item label="鑿滃崟鍚嶇О"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> <el-input v-model="queryParams.menuName" placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" @@ -10,7 +10,7 @@ @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="鐘舵��"> + <el-form-item label="鐘舵��" prop="status"> <el-select v-model="queryParams.status" placeholder="鑿滃崟鐘舵��" clearable size="small"> <el-option v-for="dict in statusOptions" @@ -21,10 +21,30 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:menu:add']">鏂板</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:menu:add']" + >鏂板</el-button> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> <el-table v-loading="loading" @@ -197,6 +217,8 @@ return { // 閬僵灞� loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鑿滃崟琛ㄦ牸鏍戞暟鎹� menuList: [], // 鑿滃崟鏍戦�夐」 @@ -310,6 +332,11 @@ handleQuery() { this.getList(); }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd(row) { this.reset(); diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index 9af05ff..986e505 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="鍏憡鏍囬" prop="noticeTitle"> <el-input v-model="queryParams.noticeTitle" @@ -30,7 +30,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -65,6 +65,14 @@ v-hasPermi="['system:notice:remove']" >鍒犻櫎</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> @@ -190,6 +198,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 鍏憡琛ㄦ牸鏁版嵁 @@ -338,4 +348,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 77c916f..46c55d1 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="宀椾綅缂栫爜" prop="postCode"> <el-input v-model="queryParams.postCode" @@ -30,7 +30,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -74,6 +74,14 @@ v-hasPermi="['system:post:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"> @@ -107,7 +115,7 @@ </template> </el-table-column> </el-table> - + <pagination v-show="total>0" :total="total" @@ -164,6 +172,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 宀椾綅琛ㄦ牸鏁版嵁 @@ -320,4 +330,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 1bfa408..5454fb8 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true"> + <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true"> <el-form-item label="瑙掕壊鍚嶇О" prop="roleName"> <el-input v-model="queryParams.roleName" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -91,9 +91,17 @@ icon="el-icon-download" size="mini" @click="handleExport" - v-hasPermi="['system:post:export']" + v-hasPermi="['system:role:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange"> @@ -249,6 +257,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 瑙掕壊琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 9585371..b64bdc6 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -27,7 +27,7 @@ </el-col> <!--鐢ㄦ埛鏁版嵁--> <el-col :span="20" :xs="24"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName"> <el-input v-model="queryParams.userName" @@ -77,7 +77,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -130,6 +130,14 @@ v-hasPermi="['system:user:export']" >瀵煎嚭</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> @@ -356,6 +364,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 鐢ㄦ埛琛ㄦ牸鏁版嵁 diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue index c23e7e0..bd4a2d8 100644 --- a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue @@ -6,7 +6,7 @@ <span slot="label">鐢熸垚妯℃澘</span> <el-select v-model="info.tplCategory"> <el-option label="鍗曡〃锛堝鍒犳敼鏌ワ級" value="crud" /> - <el-option label="鏍戣〃锛堝鍒犳敼鏌ワ級" value="tree"/> + <el-option label="鏍戣〃锛堝鍒犳敼鏌ワ級" value="tree" /> </el-select> </el-form-item> </el-col> @@ -60,14 +60,56 @@ </el-col> <el-col :span="12"> - <el-form-item prop="functionName"> + <el-form-item> <span slot="label"> 涓婄骇鑿滃崟 <el-tooltip content="鍒嗛厤鍒版寚瀹氳彍鍗曚笅锛屼緥濡� 绯荤粺绠$悊" placement="top"> <i class="el-icon-question"></i> </el-tooltip> </span> - <treeselect :append-to-body="true" v-model="info.parentMenuId" :options="menus" :normalizer="normalizer" :show-count="true" placeholder="璇烽�夋嫨绯荤粺鑿滃崟"/> + <treeselect + :append-to-body="true" + v-model="info.parentMenuId" + :options="menus" + :normalizer="normalizer" + :show-count="true" + placeholder="璇烽�夋嫨绯荤粺鑿滃崟" + /> + </el-form-item> + </el-col> + + <el-col :span="12"> + <el-form-item prop="genType"> + <span slot="label"> + 鐢熸垚浠g爜鏂瑰紡 + <el-tooltip content="榛樿涓簔ip鍘嬬缉鍖呬笅杞斤紝涔熷彲浠ヨ嚜瀹氫箟鐢熸垚璺緞" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + </span> + <el-radio v-model="info.genType" label="0">zip鍘嬬缉鍖�</el-radio> + <el-radio v-model="info.genType" label="1">鑷畾涔夎矾寰�</el-radio> + </el-form-item> + </el-col> + + <el-col :span="24" v-if="info.genType == '1'"> + <el-form-item prop="genPath"> + <span slot="label"> + 鑷畾涔夎矾寰� + <el-tooltip content="濉啓纾佺洏缁濆璺緞锛岃嫢涓嶅~鍐欙紝鍒欑敓鎴愬埌褰撳墠Web椤圭洰涓�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + </span> + <el-input v-model="info.genPath"> + <el-dropdown slot="append"> + <el-button type="primary"> + 鏈�杩戣矾寰勫揩閫熼�夋嫨 + <i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item @click.native="info.genPath = '/'">鎭㈠榛樿鐨勭敓鎴愬熀纭�璺緞</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + </el-input> </el-form-item> </el-col> </el-row> @@ -165,7 +207,7 @@ ], functionName: [ { required: true, message: "璇疯緭鍏ョ敓鎴愬姛鑳藉悕", trigger: "blur" } - ] + ], } }; }, diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index 6e9183f..451c5c6 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="琛ㄥ悕绉�" prop="tableName"> <el-input v-model="queryParams.tableName" @@ -32,7 +32,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -76,6 +76,14 @@ v-hasPermi="['tool:gen:remove']" >鍒犻櫎</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="鍒锋柊" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange"> @@ -166,7 +174,7 @@ </template> <script> -import { listTable, previewTable, delTable } from "@/api/tool/gen"; +import { listTable, previewTable, delTable, genCode } from "@/api/tool/gen"; import importTable from "./importTable"; import { downLoadZip } from "@/utils/zipdownload"; export default { @@ -186,6 +194,8 @@ single: true, // 闈炲涓鐢� multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, // 鎬绘潯鏁� total: 0, // 琛ㄦ暟鎹� @@ -241,7 +251,13 @@ this.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁"); return; } - downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi"); + if(row.genType === "1") { + genCode(row.tableName).then(response => { + this.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath); + }); + } else { + downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi"); + } }, /** 鎵撳紑瀵煎叆琛ㄥ脊绐� */ openImportTable() { diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 87632b5..974da00 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -30,6 +30,7 @@ devServer: { host: '0.0.0.0', port: port, + open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { @@ -68,17 +69,6 @@ .loader('svg-sprite-loader') .options({ symbolId: 'icon-[name]' - }) - .end() - - // set preserveWhitespace - config.module - .rule('vue') - .use('vue-loader') - .loader('vue-loader') - .tap(options => { - options.compilerOptions.preserveWhitespace = true - return options }) .end() diff --git a/sql/ry_20200629.sql b/sql/ry_20200724.sql similarity index 99% rename from sql/ry_20200629.sql rename to sql/ry_20200724.sql index 3af5000..65a3065 100644 --- a/sql/ry_20200629.sql +++ b/sql/ry_20200724.sql @@ -120,7 +120,7 @@ -- ---------------------------- -- 鍒濆鍖�-瑙掕壊淇℃伅琛ㄦ暟鎹� -- ---------------------------- -insert into sys_role values('1', '绯荤粺绠$悊鍛�', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '绯荤粺绠$悊鍛�'); +insert into sys_role values('1', '瓒呯骇绠$悊鍛�', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '瓒呯骇绠$悊鍛�'); insert into sys_role values('2', '鏅�氳鑹�', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '鏅�氳鑹�'); @@ -635,6 +635,8 @@ business_name varchar(30) comment '鐢熸垚涓氬姟鍚�', function_name varchar(50) comment '鐢熸垚鍔熻兘鍚�', function_author varchar(50) comment '鐢熸垚鍔熻兘浣滆��', + gen_type char(1) default '0' comment '鐢熸垚浠g爜鏂瑰紡锛�0zip鍘嬬缉鍖� 1鑷畾涔夎矾寰勶級', + gen_path varchar(200) default '/' comment '鐢熸垚璺緞锛堜笉濉粯璁ら」鐩矾寰勶級', options varchar(1000) comment '鍏跺畠鐢熸垚閫夐」', create_by varchar(64) default '' comment '鍒涘缓鑰�', create_time datetime comment '鍒涘缓鏃堕棿', -- Gitblit v1.9.3