mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	发布 v2.5.1 针对 v2.5.0 版本新特性bug修复
This commit is contained in:
		@@ -4,7 +4,7 @@
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
 | 
			
		||||
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
 | 
			
		||||
<br>
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
 | 
			
		||||
[]()
 | 
			
		||||
[]()
 | 
			
		||||
[]()
 | 
			
		||||
 
 | 
			
		||||
@@ -76,12 +76,13 @@ services:
 | 
			
		||||
        ipv4_address: 172.30.0.48
 | 
			
		||||
 | 
			
		||||
  ruoyi-server1:
 | 
			
		||||
    image: "ruoyi/ruoyi-server:2.5.0"
 | 
			
		||||
    image: "ruoyi/ruoyi-server:2.5.1"
 | 
			
		||||
    environment:
 | 
			
		||||
      - TZ=Asia/Shanghai
 | 
			
		||||
    volumes:
 | 
			
		||||
      # 配置文件
 | 
			
		||||
      - /docker/server1/logs/:/ruoyi/server/logs/
 | 
			
		||||
      - /docker/ruoyi/uploadPath/:/ruoyi/server/ruoyi/uploadPath/
 | 
			
		||||
    privileged: true
 | 
			
		||||
    restart: always
 | 
			
		||||
    networks:
 | 
			
		||||
@@ -89,12 +90,13 @@ services:
 | 
			
		||||
        ipv4_address: 172.30.0.60
 | 
			
		||||
 | 
			
		||||
  ruoyi-server2:
 | 
			
		||||
    image: "ruoyi/ruoyi-server:2.5.0"
 | 
			
		||||
    image: "ruoyi/ruoyi-server:2.5.1"
 | 
			
		||||
    environment:
 | 
			
		||||
      - TZ=Asia/Shanghai
 | 
			
		||||
    volumes:
 | 
			
		||||
      # 配置文件
 | 
			
		||||
      - /docker/server2/logs/:/ruoyi/server/logs/
 | 
			
		||||
      - /docker/ruoyi/uploadPath/:/ruoyi/server/ruoyi/uploadPath/
 | 
			
		||||
    privileged: true
 | 
			
		||||
    restart: always
 | 
			
		||||
    networks:
 | 
			
		||||
@@ -102,7 +104,7 @@ services:
 | 
			
		||||
        ipv4_address: 172.30.0.61
 | 
			
		||||
 | 
			
		||||
  ruoyi-monitor-admin:
 | 
			
		||||
    image: "ruoyi/ruoyi-monitor-admin:2.5.0"
 | 
			
		||||
    image: "ruoyi/ruoyi-monitor-admin:2.5.1"
 | 
			
		||||
    environment:
 | 
			
		||||
      - TZ=Asia/Shanghai
 | 
			
		||||
    privileged: true
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								pom.xml
									
									
									
									
									
								
							@@ -6,14 +6,14 @@
 | 
			
		||||
 | 
			
		||||
    <groupId>com.ruoyi</groupId>
 | 
			
		||||
    <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
    <version>2.5.0</version>
 | 
			
		||||
    <version>2.5.1</version>
 | 
			
		||||
 | 
			
		||||
    <name>RuoYi-Vue-Plus</name>
 | 
			
		||||
    <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
 | 
			
		||||
    <description>RuoYi-Vue-Plus后台管理系统</description>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
        <ruoyi-vue-plus.version>2.5.0</ruoyi-vue-plus.version>
 | 
			
		||||
        <ruoyi-vue-plus.version>2.5.1</ruoyi-vue-plus.version>
 | 
			
		||||
        <spring-boot.version>2.4.8</spring-boot.version>
 | 
			
		||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>2.5.0</version>
 | 
			
		||||
        <version>2.5.1</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <artifactId>ruoyi-extend</artifactId>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-extend</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>2.5.0</version>
 | 
			
		||||
        <version>2.5.1</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "ruoyi-vue-plus",
 | 
			
		||||
  "version": "2.5.0",
 | 
			
		||||
  "version": "2.5.1",
 | 
			
		||||
  "description": "RuoYi-Vue-Plus后台管理系统",
 | 
			
		||||
  "author": "LionLi",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
 
 | 
			
		||||
@@ -130,14 +130,14 @@ export default {
 | 
			
		||||
            this.quill.format("image", false);
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
        toolbar.addHandler("video", (value) => {
 | 
			
		||||
          this.uploadType = "video";
 | 
			
		||||
          if (value) {
 | 
			
		||||
            this.$refs.upload.$children[0].$refs.input.click();
 | 
			
		||||
          } else {
 | 
			
		||||
            this.quill.format("video", false);
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
        // toolbar.addHandler("video", (value) => {
 | 
			
		||||
        //   this.uploadType = "video";
 | 
			
		||||
        //   if (value) {
 | 
			
		||||
        //     this.$refs.upload.$children[0].$refs.input.click();
 | 
			
		||||
        //   } else {
 | 
			
		||||
        //     this.quill.format("video", false);
 | 
			
		||||
        //   }
 | 
			
		||||
        // });
 | 
			
		||||
      }
 | 
			
		||||
      this.Quill.pasteHTML(this.currentValue);
 | 
			
		||||
      this.Quill.on("text-change", (delta, oldDelta, source) => {
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ export default {
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 删除图片
 | 
			
		||||
    handleRemove(file, fileList) {
 | 
			
		||||
      const findex = this.fileList.indexOf(file.name);
 | 
			
		||||
      const findex = this.fileList.map(f => f.name).indexOf(file.name);
 | 
			
		||||
      this.fileList.splice(findex, 1);
 | 
			
		||||
      this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -91,6 +91,18 @@
 | 
			
		||||
            <span>更新日志</span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <el-collapse accordion>
 | 
			
		||||
            <el-collapse-item title="v2.5.1 - 2021-7-13">
 | 
			
		||||
              <ol>
 | 
			
		||||
                <li>update 验证码开关 转移到表 参数管理 内</li>
 | 
			
		||||
                <li>update 使用hutool重构 判断是否url</li>
 | 
			
		||||
                <li>fix 修复 docker业务集群部署与文件上传的问题</li>
 | 
			
		||||
                <li>fix 修复代码生成同步表结构id冲突问题</li>
 | 
			
		||||
                <li>fix 修复代码生成选择字典 无法取消问题</li>
 | 
			
		||||
                <li>fix 修复代码生成字典为null问题</li>
 | 
			
		||||
                <li>fix 图片上传 多图时无法删除相应图片修复</li>
 | 
			
		||||
                <li>remove 删除富文本video事件</li>
 | 
			
		||||
              </ol>
 | 
			
		||||
            </el-collapse-item>
 | 
			
		||||
            <el-collapse-item title="v2.5.0 - 2021-7-12">
 | 
			
		||||
              <ol>
 | 
			
		||||
                <li>update springboot 2.4.7 => 2.4.8</li>
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
 | 
			
		||||
        </el-input>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item prop="code" v-if="captchaEnabled">
 | 
			
		||||
      <el-form-item prop="code" v-if="captchaOnOff">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="loginForm.code"
 | 
			
		||||
          auto-complete="off"
 | 
			
		||||
@@ -81,8 +81,8 @@ export default {
 | 
			
		||||
        code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
 | 
			
		||||
      },
 | 
			
		||||
      loading: false,
 | 
			
		||||
      redirect: undefined,
 | 
			
		||||
      captchaEnabled:false
 | 
			
		||||
      captchaOnOff: true,
 | 
			
		||||
      redirect: undefined
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
@@ -100,8 +100,8 @@ export default {
 | 
			
		||||
  methods: {
 | 
			
		||||
    getCode() {
 | 
			
		||||
      getCodeImg().then(res => {
 | 
			
		||||
        this.captchaEnabled = res.data.enabled;
 | 
			
		||||
        if(res.data.enabled){
 | 
			
		||||
        this.captchaOnOff = res.data.captchaOnOff === undefined ? true : res.data.captchaOnOff;
 | 
			
		||||
        if (this.captchaOnOff) {
 | 
			
		||||
          this.codeUrl = "data:image/gif;base64," + res.data.img;
 | 
			
		||||
          this.loginForm.uuid = res.data.uuid;
 | 
			
		||||
        }
 | 
			
		||||
@@ -134,7 +134,9 @@ export default {
 | 
			
		||||
            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
 | 
			
		||||
          }).catch(() => {
 | 
			
		||||
            this.loading = false;
 | 
			
		||||
            this.getCode();
 | 
			
		||||
            if (this.captchaOnOff) {
 | 
			
		||||
              this.getCode();
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>2.5.0</version>
 | 
			
		||||
        <version>2.5.1</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
 
 | 
			
		||||
@@ -14,11 +14,6 @@ import org.springframework.stereotype.Component;
 | 
			
		||||
@ConfigurationProperties(prefix = "captcha")
 | 
			
		||||
public class CaptchaProperties {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 验证码开关
 | 
			
		||||
	 */
 | 
			
		||||
	private Boolean enabled;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 验证码类型
 | 
			
		||||
 	 */
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
 | 
			
		||||
import com.ruoyi.common.utils.DateUtils;
 | 
			
		||||
import com.ruoyi.common.utils.MessageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.ServletUtils;
 | 
			
		||||
import com.ruoyi.framework.config.properties.CaptchaProperties;
 | 
			
		||||
import com.ruoyi.system.service.ISysConfigService;
 | 
			
		||||
import com.ruoyi.system.service.ISysUserService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.security.authentication.AuthenticationManager;
 | 
			
		||||
@@ -41,10 +41,10 @@ public class SysLoginService
 | 
			
		||||
    private RedisCache redisCache;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private CaptchaProperties captchaProperties;
 | 
			
		||||
    private ISysUserService userService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
    private ISysUserService userService;
 | 
			
		||||
	private ISysConfigService configService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private AsyncService asyncService;
 | 
			
		||||
@@ -61,19 +61,12 @@ public class SysLoginService
 | 
			
		||||
    public String login(String username, String password, String code, String uuid)
 | 
			
		||||
    {
 | 
			
		||||
		HttpServletRequest request = ServletUtils.getRequest();
 | 
			
		||||
		if(captchaProperties.getEnabled()) {
 | 
			
		||||
			String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
 | 
			
		||||
			String captcha = redisCache.getCacheObject(verifyKey);
 | 
			
		||||
			redisCache.deleteObject(verifyKey);
 | 
			
		||||
			if (captcha == null) {
 | 
			
		||||
				asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"), request);
 | 
			
		||||
				throw new CaptchaExpireException();
 | 
			
		||||
			}
 | 
			
		||||
			if (!code.equalsIgnoreCase(captcha)) {
 | 
			
		||||
				asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"), request);
 | 
			
		||||
				throw new CaptchaException();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		boolean captchaOnOff = configService.selectCaptchaOnOff();
 | 
			
		||||
        // 验证码开关
 | 
			
		||||
        if (captchaOnOff)
 | 
			
		||||
        {
 | 
			
		||||
            validateCapcha(username, code, uuid, request);
 | 
			
		||||
        }
 | 
			
		||||
        // 用户验证
 | 
			
		||||
        Authentication authentication = null;
 | 
			
		||||
        try
 | 
			
		||||
@@ -102,6 +95,28 @@ public class SysLoginService
 | 
			
		||||
        return tokenService.createToken(loginUser);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 校验验证码
 | 
			
		||||
     *
 | 
			
		||||
     * @param username 用户名
 | 
			
		||||
     * @param code 验证码
 | 
			
		||||
     * @param uuid 唯一标识
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public void validateCapcha(String username, String code, String uuid, HttpServletRequest request) {
 | 
			
		||||
		String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
 | 
			
		||||
		String captcha = redisCache.getCacheObject(verifyKey);
 | 
			
		||||
		redisCache.deleteObject(verifyKey);
 | 
			
		||||
		if (captcha == null) {
 | 
			
		||||
			asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"), request);
 | 
			
		||||
			throw new CaptchaExpireException();
 | 
			
		||||
		}
 | 
			
		||||
		if (!code.equalsIgnoreCase(captcha)) {
 | 
			
		||||
			asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"), request);
 | 
			
		||||
			throw new CaptchaException();
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 记录登录信息
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -35,10 +35,7 @@ import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.StringWriter;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.LinkedHashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
import java.util.zip.ZipEntry;
 | 
			
		||||
import java.util.zip.ZipOutputStream;
 | 
			
		||||
@@ -137,14 +134,17 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
 | 
			
		||||
            for (GenTableColumn cenTableColumn : genTable.getColumns()) {
 | 
			
		||||
                genTableColumnMapper.update(cenTableColumn,
 | 
			
		||||
                        new LambdaUpdateWrapper<GenTableColumn>()
 | 
			
		||||
                                .set(cenTableColumn.getIsPk() == null, GenTableColumn::getIsPk, null)
 | 
			
		||||
                                .set(cenTableColumn.getIsIncrement() == null, GenTableColumn::getIsIncrement, null)
 | 
			
		||||
                                .set(cenTableColumn.getIsInsert() == null, GenTableColumn::getIsInsert, null)
 | 
			
		||||
                                .set(cenTableColumn.getIsEdit() == null, GenTableColumn::getIsEdit, null)
 | 
			
		||||
                                .set(cenTableColumn.getIsList() == null, GenTableColumn::getIsList, null)
 | 
			
		||||
                                .set(cenTableColumn.getIsQuery() == null, GenTableColumn::getIsQuery, null)
 | 
			
		||||
								.set(cenTableColumn.getIsRequired() == null, GenTableColumn::getIsRequired, null)
 | 
			
		||||
                                .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId()));
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getColumnComment()), GenTableColumn::getColumnComment, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsPk()), GenTableColumn::getIsPk, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsIncrement()), GenTableColumn::getIsIncrement, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsInsert()), GenTableColumn::getIsInsert, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsEdit()), GenTableColumn::getIsEdit, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getQueryType()), GenTableColumn::getQueryType, null)
 | 
			
		||||
							.set(StrUtil.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, null)
 | 
			
		||||
							.eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId()));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -180,10 +180,14 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
 | 
			
		||||
                if (row > 0) {
 | 
			
		||||
                    // 保存列信息
 | 
			
		||||
                    List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
 | 
			
		||||
					List<GenTableColumn> saveColumns = new ArrayList<>();
 | 
			
		||||
                    for (GenTableColumn column : genTableColumns) {
 | 
			
		||||
                        GenUtils.initColumnField(column, table);
 | 
			
		||||
						saveColumns.add(column);
 | 
			
		||||
                    }
 | 
			
		||||
					genTableColumnMapper.insertAll(genTableColumns);
 | 
			
		||||
                    if (CollUtil.isNotEmpty(saveColumns)) {
 | 
			
		||||
						genTableColumnMapper.insertAll(saveColumns);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
@@ -287,12 +291,16 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
 | 
			
		||||
        }
 | 
			
		||||
        List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
 | 
			
		||||
 | 
			
		||||
		List<GenTableColumn> saveColumns = new ArrayList<>();
 | 
			
		||||
        dbTableColumns.forEach(column -> {
 | 
			
		||||
            if (!tableColumnNames.contains(column.getColumnName())) {
 | 
			
		||||
                GenUtils.initColumnField(column, table);
 | 
			
		||||
				saveColumns.add(column);
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		genTableColumnMapper.insertAll(tableColumns);
 | 
			
		||||
		if (CollUtil.isNotEmpty(saveColumns)) {
 | 
			
		||||
			genTableColumnMapper.insertAll(saveColumns);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
 | 
			
		||||
        if (CollUtil.isNotEmpty(delColumns)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package com.ruoyi.system.domain.vo;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import cn.hutool.core.lang.Validator;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
@@ -56,7 +56,7 @@ public class MetaVo {
 | 
			
		||||
		this.title = title;
 | 
			
		||||
		this.icon = icon;
 | 
			
		||||
		this.noCache = noCache;
 | 
			
		||||
		if (StringUtils.ishttp(link)) {
 | 
			
		||||
		if (Validator.isUrl(link)) {
 | 
			
		||||
			this.link = link;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,13 @@ public interface ISysConfigService extends IServicePlus<SysConfig> {
 | 
			
		||||
     */
 | 
			
		||||
    public String selectConfigByKey(String configKey);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取验证码开关
 | 
			
		||||
     *
 | 
			
		||||
     * @return true开启,false关闭
 | 
			
		||||
     */
 | 
			
		||||
    public boolean selectCaptchaOnOff();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询参数配置列表
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,19 @@ public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysCo
 | 
			
		||||
		return StrUtil.EMPTY;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 获取验证码开关
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return true开启,false关闭
 | 
			
		||||
	 */
 | 
			
		||||
	public boolean selectCaptchaOnOff() {
 | 
			
		||||
		String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff");
 | 
			
		||||
		if (StrUtil.isEmpty(captchaOnOff)) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return Convert.toBool(captchaOnOff);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 查询参数配置列表
 | 
			
		||||
	 *
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@ import com.ruoyi.common.core.domain.entity.SysRole;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.domain.SysRoleMenu;
 | 
			
		||||
import com.ruoyi.system.domain.vo.MetaVo;
 | 
			
		||||
import com.ruoyi.system.domain.vo.RouterVo;
 | 
			
		||||
@@ -19,6 +18,7 @@ import com.ruoyi.system.mapper.SysMenuMapper;
 | 
			
		||||
import com.ruoyi.system.mapper.SysRoleMapper;
 | 
			
		||||
import com.ruoyi.system.mapper.SysRoleMenuMapper;
 | 
			
		||||
import com.ruoyi.system.service.ISysMenuService;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
@@ -371,7 +371,7 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu>
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isInnerLink(SysMenu menu) {
 | 
			
		||||
        return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
 | 
			
		||||
        return menu.getIsFrame().equals(UserConstants.NO_FRAME) && Validator.isUrl(menu.getPath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.core.redis.RedisCache;
 | 
			
		||||
import com.ruoyi.framework.captcha.UnsignedMathGenerator;
 | 
			
		||||
import com.ruoyi.framework.config.properties.CaptchaProperties;
 | 
			
		||||
import com.ruoyi.system.service.ISysConfigService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
@@ -26,7 +27,7 @@ import java.util.concurrent.TimeUnit;
 | 
			
		||||
/**
 | 
			
		||||
 * 验证码操作处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
public class CaptchaController {
 | 
			
		||||
@@ -47,15 +48,18 @@ public class CaptchaController {
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private CaptchaProperties captchaProperties;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private ISysConfigService configService;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 生成验证码
 | 
			
		||||
	 */
 | 
			
		||||
	@GetMapping("/captchaImage")
 | 
			
		||||
	public AjaxResult getCode() {
 | 
			
		||||
		Map<String, Object> ajax = new HashMap<>();
 | 
			
		||||
		Boolean enabled = captchaProperties.getEnabled();
 | 
			
		||||
		ajax.put("enabled", enabled);
 | 
			
		||||
		if (!enabled) {
 | 
			
		||||
		boolean captchaOnOff = configService.selectCaptchaOnOff();
 | 
			
		||||
		ajax.put("captchaOnOff", captchaOnOff);
 | 
			
		||||
		if (!captchaOnOff) {
 | 
			
		||||
			return AjaxResult.success(ajax);
 | 
			
		||||
		}
 | 
			
		||||
		// 保存验证码信息
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.ruoyi.web.controller.system;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.lang.Validator;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
import com.ruoyi.common.constant.UserConstants;
 | 
			
		||||
import com.ruoyi.common.core.controller.BaseController;
 | 
			
		||||
@@ -9,7 +10,6 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 | 
			
		||||
import com.ruoyi.common.enums.BusinessType;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.utils.ServletUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.framework.web.service.TokenService;
 | 
			
		||||
import com.ruoyi.system.service.ISysMenuService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
@@ -97,7 +97,7 @@ public class SysMenuController extends BaseController
 | 
			
		||||
        {
 | 
			
		||||
            return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
 | 
			
		||||
        }
 | 
			
		||||
        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
 | 
			
		||||
        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !Validator.isUrl(menu.getPath()))
 | 
			
		||||
        {
 | 
			
		||||
            return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
 | 
			
		||||
        }
 | 
			
		||||
@@ -117,7 +117,7 @@ public class SysMenuController extends BaseController
 | 
			
		||||
        {
 | 
			
		||||
            return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
 | 
			
		||||
        }
 | 
			
		||||
        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
 | 
			
		||||
        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !Validator.isUrl(menu.getPath()))
 | 
			
		||||
        {
 | 
			
		||||
            return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -14,8 +14,6 @@ ruoyi:
 | 
			
		||||
  addressEnabled: true
 | 
			
		||||
 | 
			
		||||
captcha:
 | 
			
		||||
  # 验证码开关
 | 
			
		||||
  enabled: true
 | 
			
		||||
  # 验证码类型 math 数组计算 char 字符验证
 | 
			
		||||
  type: math
 | 
			
		||||
  # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
 | 
			
		||||
 
 | 
			
		||||
@@ -285,7 +285,7 @@ export default {
 | 
			
		||||
#else
 | 
			
		||||
#set($comment=$column.columnComment)
 | 
			
		||||
#end
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
      // $comment字典
 | 
			
		||||
      ${column.javaField}Options: [],
 | 
			
		||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
 | 
			
		||||
@@ -327,7 +327,7 @@ export default {
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getList();
 | 
			
		||||
#foreach ($column in $columns)
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
    this.getDicts("${column.dictType}").then(response => {
 | 
			
		||||
      this.${column.javaField}Options = response.data;
 | 
			
		||||
    });
 | 
			
		||||
@@ -379,7 +379,7 @@ export default {
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
#foreach ($column in $columns)
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
 | 
			
		||||
#if($parentheseIndex != -1)
 | 
			
		||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
 | 
			
		||||
 
 | 
			
		||||
@@ -350,7 +350,7 @@ export default {
 | 
			
		||||
#else
 | 
			
		||||
#set($comment=$column.columnComment)
 | 
			
		||||
#end
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
      // $comment字典
 | 
			
		||||
      ${column.javaField}Options: [],
 | 
			
		||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
 | 
			
		||||
@@ -394,7 +394,7 @@ export default {
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getList();
 | 
			
		||||
#foreach ($column in $columns)
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
    this.getDicts("${column.dictType}").then(response => {
 | 
			
		||||
      this.${column.javaField}Options = response.data;
 | 
			
		||||
    });
 | 
			
		||||
@@ -427,7 +427,7 @@ export default {
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
#foreach ($column in $columns)
 | 
			
		||||
#if(${column.dictType} != '')
 | 
			
		||||
#if(${column.dictType} && ${column.dictType} != '')
 | 
			
		||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
 | 
			
		||||
#if($parentheseIndex != -1)
 | 
			
		||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
 | 
			
		||||
 
 | 
			
		||||
@@ -159,7 +159,7 @@ create table sys_menu (
 | 
			
		||||
insert into sys_menu values('1', '系统管理', '0', '1', 'system',           null,   1, 0, 'M', '0', '0', '', 'system',   'admin', sysdate(), '', null, '系统管理目录');
 | 
			
		||||
insert into sys_menu values('2', '系统监控', '0', '2', 'monitor',          null,   1, 0, 'M', '0', '0', '', 'monitor',  'admin', sysdate(), '', null, '系统监控目录');
 | 
			
		||||
insert into sys_menu values('3', '系统工具', '0', '3', 'tool',             null,   1, 0, 'M', '0', '0', '', 'tool',     'admin', sysdate(), '', null, '系统工具目录');
 | 
			
		||||
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null ,  0, 0, 'M', '0', '0', '', 'guide',    'admin', sysdate(), '', null, '若依官网地址');
 | 
			
		||||
insert into sys_menu values('4', 'PLUS官网', '0', '4', 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus', null ,  0, 0, 'M', '0', '0', '', 'guide',    'admin', sysdate(), '', null, 'RuoYi-Vue-Plus官网地址');
 | 
			
		||||
-- 二级菜单
 | 
			
		||||
insert into sys_menu values('100',  '用户管理', '1',   '1', 'user',       'system/user/index',        1, 0, 'C', '0', '0', 'system:user:list',        'user',          'admin', sysdate(), '', null, '用户管理菜单');
 | 
			
		||||
insert into sys_menu values('101',  '角色管理', '1',   '2', 'role',       'system/role/index',        1, 0, 'C', '0', '0', 'system:role:list',        'peoples',       'admin', sysdate(), '', null, '角色管理菜单');
 | 
			
		||||
@@ -537,9 +537,10 @@ create table sys_config (
 | 
			
		||||
  primary key (config_id)
 | 
			
		||||
) engine=innodb auto_increment=100 comment = '参数配置表';
 | 
			
		||||
 | 
			
		||||
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName',     'skin-blue',     'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
 | 
			
		||||
insert into sys_config values(2, '用户管理-账号初始密码',     'sys.user.initPassword',  '123456',        'Y', 'admin', sysdate(), '', null, '初始化密码 123456' );
 | 
			
		||||
insert into sys_config values(3, '主框架页-侧边栏主题',       'sys.index.sideTheme',    'theme-dark',    'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' );
 | 
			
		||||
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName',            'skin-blue',     'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
 | 
			
		||||
insert into sys_config values(2, '用户管理-账号初始密码',     'sys.user.initPassword',         '123456',        'Y', 'admin', sysdate(), '', null, '初始化密码 123456' );
 | 
			
		||||
insert into sys_config values(3, '主框架页-侧边栏主题',       'sys.index.sideTheme',           'theme-dark',    'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' );
 | 
			
		||||
insert into sys_config values(4, '账号自助-验证码开关',       'sys.account.captchaOnOff',      'true',          'Y', 'admin', sysdate(), '', null, '是否开启登录验证码功能(true开启,false关闭)');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
@@ -685,4 +686,4 @@ create table gen_table_column (
 | 
			
		||||
  update_by         varchar(64)     default ''                 comment '更新者',
 | 
			
		||||
  update_time       datetime                                   comment '更新时间',
 | 
			
		||||
  primary key (column_id)
 | 
			
		||||
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
 | 
			
		||||
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
 | 
			
		||||
		Reference in New Issue
	
	Block a user