From a9f4a4e11136334b7828cb98a0cd2066bb0f74d4 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 07 八月 2020 09:22:36 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java | 36 +++++++++++++++++-
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml | 2
.gitignore | 3 +
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 6 +-
ruoyi-ui/src/utils/ruoyi.js | 18 +++-----
ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml | 2
ruoyi-ui/src/utils/request.js | 7 +--
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 2
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml | 4 +-
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java | 2
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml | 2
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml | 2
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml | 4 +-
14 files changed, 59 insertions(+), 33 deletions(-)
diff --git a/.gitignore b/.gitignore
index fd446f4..2c0e049 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,7 +37,8 @@
# Others
*.log
*.xml.versionsBackup
+*.swp
!*/build/*.java
!*/build/*.html
-!*/build/*.xml
\ No newline at end of file
+!*/build/*.xml
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 494fb4b..d950b77 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
@@ -476,7 +476,7 @@
{
if (ColumnType.STRING == attr.cellType())
{
- cell.setCellType(CellType.NUMERIC);
+ cell.setCellType(CellType.STRING);
cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
}
else if (ColumnType.NUMERIC == attr.cellType())
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
index 19bd77e..9993b98 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java
@@ -5,7 +5,10 @@
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
+import com.ruoyi.common.utils.StringUtils;
/**
* spring宸ュ叿绫� 鏂逛究鍦ㄩ潪spring绠$悊鐜涓幏鍙朾ean
@@ -13,15 +16,23 @@
* @author ruoyi
*/
@Component
-public final class SpringUtils implements BeanFactoryPostProcessor
+public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware
{
/** Spring搴旂敤涓婁笅鏂囩幆澧� */
private static ConfigurableListableBeanFactory beanFactory;
+ private static ApplicationContext applicationContext;
+
@Override
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
{
SpringUtils.beanFactory = beanFactory;
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
+ {
+ SpringUtils.applicationContext = applicationContext;
}
/**
@@ -111,4 +122,25 @@
{
return (T) AopContext.currentProxy();
}
+
+ /**
+ * 鑾峰彇褰撳墠鐨勭幆澧冮厤缃紝鏃犻厤缃繑鍥瀗ull
+ *
+ * @return 褰撳墠鐨勭幆澧冮厤缃�
+ */
+ public static String[] getActiveProfiles()
+ {
+ return applicationContext.getEnvironment().getActiveProfiles();
+ }
+
+ /**
+ * 鑾峰彇褰撳墠鐨勭幆澧冮厤缃紝褰撴湁澶氫釜鐜閰嶇疆鏃讹紝鍙幏鍙栫涓�涓�
+ *
+ * @return 褰撳墠鐨勭幆澧冮厤缃�
+ */
+ public static String getActiveProfile()
+ {
+ final String[] activeProfiles = getActiveProfiles();
+ return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
index 67862a3..f80a877 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
@@ -75,7 +75,7 @@
@Override
public SysUserOnline loginUserToUserOnline(LoginUser user)
{
- if (StringUtils.isNull(user) && StringUtils.isNull(user.getUser()))
+ if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser()))
{
return null;
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
index a1c8efd..2c6f74a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
@@ -61,7 +61,7 @@
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
- where config_key = #{configKey}
+ where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index af54bd9..3eb449e 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -64,7 +64,7 @@
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
- where del_flag = '0' and parent_id = #{deptId}
+ where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
index c5b3129..9dbc3b5 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -57,7 +57,7 @@
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
- where dict_type = #{dictType}
+ where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
index c713ec3..302ca56 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
@@ -118,7 +118,7 @@
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
- where menu_name=#{menuName} and parent_id = #{parentId}
+ where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
index 0b689c7..c82d808 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
@@ -64,12 +64,12 @@
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
- where post_name=#{postName}
+ where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
- where post_code=#{postCode}
+ where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
index 48331ff..d57f2a1 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -80,12 +80,12 @@
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
- where r.role_name=#{roleName}
+ where r.role_name=#{roleName} limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
- where r.role_key=#{roleKey}
+ where r.role_key=#{roleKey} limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
index f9fc3e6..532b5e5 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
@@ -10,7 +10,7 @@
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
- select count(1) from sys_role_menu where menu_id = #{menuId}
+ select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 9ca29a3..a1c926a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -92,15 +92,15 @@
</select>
<select id="checkUserNameUnique" parameterType="String" resultType="int">
- select count(1) from sys_user where user_name = #{userName}
+ select count(1) from sys_user where user_name = #{userName} limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
- select user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
+ select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
- select user_id, email from sys_user where email = #{email}
+ select user_id, email from sys_user where email = #{email} limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js
index f62368e..112d453 100644
--- a/ruoyi-ui/src/utils/request.js
+++ b/ruoyi-ui/src/utils/request.js
@@ -32,17 +32,14 @@
// 鑾峰彇閿欒淇℃伅
const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) {
- MessageBox.confirm(
- '鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�',
- '绯荤粺鎻愮ず',
- {
+ MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', {
confirmButtonText: '閲嶆柊鐧诲綍',
cancelButtonText: '鍙栨秷',
type: 'warning'
}
).then(() => {
store.dispatch('LogOut').then(() => {
- location.reload() // 涓轰簡閲嶆柊瀹炰緥鍖杤ue-router瀵硅薄 閬垮厤bug
+ location.href = '/index';
})
})
} else if (code === 500) {
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index 5b109a0..838fc1f 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -54,15 +54,12 @@
}
// 娣诲姞鏃ユ湡鑼冨洿
-export function addDateRange(params, dateRange) {
- var search = params;
- search.beginTime = "";
- search.endTime = "";
- if (null != dateRange && '' != dateRange) {
- search.beginTime = this.dateRange[0];
- search.endTime = this.dateRange[1];
+export function addDateRange (params = {}, dateRange) {
+ if (dateRange != null && dateRange !== '') {
+ params.beginTime = this.dateRange[0]
+ params.endTime = this.dateRange[1]
}
- return search;
+ return params
}
// 鍥炴樉鏁版嵁瀛楀吀
@@ -83,8 +80,8 @@
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])) {
+ Object.keys(datas).some((key) => {
+ if (datas[key].dictValue == ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator);
}
})
@@ -146,4 +143,3 @@
});
return treeData != '' ? treeData : data;
}
-
--
Gitblit v1.9.3