|
@@ -68,6 +68,86 @@
|
|
|
|
|
|
|
|
|
## 升级改造
|
|
|
+0.由于很多项目都使用若伊框架开发,如果放在同一个服务器上,那么cookies和redis的存储会重叠,因此这边做了处理
|
|
|
+```js
|
|
|
+// 前端在appjs把cookie存储的方法加上前缀
|
|
|
+import Cookies from 'js-cookie'
|
|
|
+
|
|
|
+let get_method = Cookies.get
|
|
|
+let set_method = Cookies.set
|
|
|
+let remove_method = Cookies.remove
|
|
|
+Cookies.get = (key) => {
|
|
|
+ return get_method('mz_' + key)
|
|
|
+}
|
|
|
+Cookies.set = (key, value, attributes) => {
|
|
|
+ return set_method('mz_' + key, value, attributes)
|
|
|
+}
|
|
|
+Cookies.remove = (key, attributes) => {
|
|
|
+ return remove_method('mz_' + key, attributes)
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+```java
|
|
|
+// 后端在redis配置里添加key前缀
|
|
|
+@Component
|
|
|
+public class RedisKeySerializer implements RedisSerializer<String>
|
|
|
+{
|
|
|
+ private final Charset charset;
|
|
|
+ public final static String key = "mz";
|
|
|
+
|
|
|
+ public RedisKeySerializer()
|
|
|
+ {
|
|
|
+ this(Charset.forName("UTF8"));
|
|
|
+ }
|
|
|
+
|
|
|
+ public RedisKeySerializer(Charset charset)
|
|
|
+ {
|
|
|
+ Assert.notNull(charset, "字符集不允许为NULL");
|
|
|
+ this.charset = charset;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public byte[] serialize(String string) throws SerializationException
|
|
|
+ {
|
|
|
+ // 通过项目名称ruoyi.name来定义Redis前缀,用于区分项目缓存
|
|
|
+ return new StringBuilder(key).append(":").append(string).toString().getBytes(charset);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String deserialize(byte[] bytes) throws SerializationException
|
|
|
+ {
|
|
|
+ return (bytes == null ? null : new String(bytes, charset));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Configuration
|
|
|
+@EnableCaching
|
|
|
+@AutoConfigureBefore(RedisAutoConfiguration.class)
|
|
|
+public class RedisConfig extends CachingConfigurerSupport
|
|
|
+{
|
|
|
+ @Bean
|
|
|
+ @SuppressWarnings(value = { "unchecked", "rawtypes" })
|
|
|
+ public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory,RedisKeySerializer redisKeySerializer)
|
|
|
+ {
|
|
|
+ RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
|
|
+ template.setConnectionFactory(connectionFactory);
|
|
|
+
|
|
|
+ FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
|
|
|
+
|
|
|
+ // 使用StringRedisSerializer来序列化和反序列化redis的key值
|
|
|
+ template.setKeySerializer(redisKeySerializer);//template.setKeySerializer(new StringRedisSerializer());
|
|
|
+ template.setValueSerializer(serializer);
|
|
|
+
|
|
|
+ // Hash的key也采用StringRedisSerializer的序列化方式
|
|
|
+ template.setHashKeySerializer(redisKeySerializer);//template.setHashKeySerializer(new StringRedisSerializer());
|
|
|
+ template.setHashValueSerializer(serializer);
|
|
|
+
|
|
|
+ template.afterPropertiesSet();
|
|
|
+ return template;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+```
|
|
|
1.首先在根目录的pom文件添加
|
|
|
```xml
|
|
|
<profiles>
|
|
@@ -233,6 +313,60 @@ SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA = 'mz-cloud' and COLUMN_COMMENT like
|
|
|
SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA = 'mz-cloud' and COLUMN_COMMENT like '%时间%' and COLUMN_NAME not IN('create_time_str','create_user_id','create_user_type','create_by','create_unit','create_unit_name','update_time_str','update_user_id','update_by','update_unit','update_unit_name','state') and CHARACTER_MAXIMUM_LENGTH != 14
|
|
|
```
|
|
|
|
|
|
+(11)查询权限重复
|
|
|
+```mysql
|
|
|
+SELECT count(1)as count ,perms FROM sys_menu GROUP BY perms HAVING count > 1
|
|
|
+```
|
|
|
+
|
|
|
+(12)查询涉及行政区划id的
|
|
|
+```mysql
|
|
|
+SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = 'mz-cloud' and (COLUMN_COMMENT like '%行政%' or COLUMN_COMMENT like '%区划%' or COLUMN_COMMENT like '%居住%' or COLUMN_COMMENT like '%籍贯%' or COLUMN_COMMENT like '%户籍%' or COLUMN_COMMENT like '%现居%') and COLUMN_NAME not IN('create_time_str','create_user_id','create_user_type','create_by','create_unit','create_unit_name','update_time_str','update_user_id','update_by','update_unit','update_unit_name','state')
|
|
|
+```
|
|
|
+
|
|
|
+(13)比较文档里缺少的表和字段
|
|
|
+```mysql
|
|
|
+SELECT * FROM
|
|
|
+
|
|
|
+(
|
|
|
+SELECT a1.TABLE_NAME, a1.COLUMN_NAME,a1.COLUMN_COMMENT,a1.IS_NULLABLE,a1.DATA_TYPE,a1.CHARACTER_MAXIMUM_LENGTH,a1.COLUMN_KEY, a2.zdmc,a2.zdlx,a2.zdgs,a2.sfbx,a2.dictid,a2.dbtype,a2.dblength,a2.ispk,a2.bbb,a2.zdbs,
|
|
|
+
|
|
|
+case when a1.COLUMN_COMMENT = IF(a2.dictid = '' or a2.dictid is null,a2.zdmc,CONCAT(a2.zdmc,'(',a2.dictid,')')) then 'true' else 'false' end as c1,
|
|
|
+case when a1.IS_NULLABLE = case when a2.sfbx = 'Y' then 'NO' else 'YES' end then 'true' else 'false' end as c2,
|
|
|
+case when a1.DATA_TYPE = a2.dbtype then 'true' else 'false' end as c3,
|
|
|
+case when a1.CHARACTER_MAXIMUM_LENGTH = a2.dblength or a2.dbtype= 'int' or a2.dbtype = 'decimal' then 'true' else 'false' end as c4,
|
|
|
+case when a1.COLUMN_KEY = case when a2.ispk = '1' then 'PRI' else '' end then 'true' else 'false' end as c5
|
|
|
+FROM
|
|
|
+(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'mz-cloud' and TABLE_NAME NOT like '%act%' and TABLE_NAME NOT like '%www%' and TABLE_NAME NOT like '%v_%' and TABLE_NAME NOT like '%qrtz%' and COLUMN_NAME not IN('create_time_str','create_user_id','create_user_type','create_by','create_unit','create_unit_name','update_time_str','update_user_id','update_by','update_unit','update_unit_name','state')) a1
|
|
|
+LEFT JOIN
|
|
|
+(SELECT b1.*,b2.bid as bbb,b2.bmc FROM ry.`columns` b1, ry.`tables` b2 WHERE b1.bid = b2.id) a2
|
|
|
+ON a2.bbb = a1.TABLE_NAME and a2.zdbs = a1.COLUMN_NAME
|
|
|
+
|
|
|
+) a
|
|
|
+WHERE ISNULL(a.bbb)
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+(14)比较文档里现有字段和实际数据库不一致的地方
|
|
|
+```mysql
|
|
|
+SELECT * FROM
|
|
|
+(
|
|
|
+SELECT a1.TABLE_NAME, a1.COLUMN_NAME,a1.COLUMN_COMMENT,a1.IS_NULLABLE,a1.DATA_TYPE,a1.CHARACTER_MAXIMUM_LENGTH,a1.COLUMN_KEY, a2.zdmc,a2.zdlx,a2.zdgs,a2.sfbx,a2.dictid,a2.dbtype,a2.dblength,a2.ispk,a2.bbb,a2.zdbs,
|
|
|
+
|
|
|
+case when a1.COLUMN_COMMENT = IF(a2.dictid = '' or a2.dictid is null,a2.zdmc,CONCAT(a2.zdmc,'(',a2.dictid,')')) then 'true' else 'false' end as c1,
|
|
|
+case when a1.IS_NULLABLE = case when a2.sfbx = 'Y' then 'NO' else 'YES' end then 'true' else 'false' end as c2,
|
|
|
+case when a1.DATA_TYPE = a2.dbtype then 'true' else 'false' end as c3,
|
|
|
+case when a1.CHARACTER_MAXIMUM_LENGTH = a2.dblength or a2.dbtype= 'int' or a2.dbtype = 'decimal' then 'true' else 'false' end as c4,
|
|
|
+case when a1.COLUMN_KEY = case when a2.ispk = '1' then 'PRI' else '' end then 'true' else 'false' end as c5
|
|
|
+FROM
|
|
|
+(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'mz-cloud' and TABLE_NAME NOT like '%act%' and TABLE_NAME NOT like '%www%' and TABLE_NAME NOT like '%v_%' and TABLE_NAME NOT like '%qrtz%' and COLUMN_NAME not IN('create_time_str','create_user_id','create_user_type','create_by','create_unit','create_unit_name','update_time_str','update_user_id','update_by','update_unit','update_unit_name','state')) a1
|
|
|
+LEFT JOIN
|
|
|
+(SELECT b1.*,b2.bid as bbb,b2.bmc FROM ry.`columns` b1, ry.`tables` b2 WHERE b1.bid = b2.id) a2
|
|
|
+ON a2.bbb = a1.TABLE_NAME and a2.zdbs = a1.COLUMN_NAME
|
|
|
+
|
|
|
+) a
|
|
|
+WHERE a.bbb is not null and (c1 != 'true' or c2 !='true' or c3 != 'true' or c4 != 'true' or c5 != 'true')
|
|
|
+```
|
|
|
+
|
|
|
## 平台简介
|
|
|
|
|
|
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|