mirror of https://github.com/elunez/eladmin
				
				
				
			v1.9 发布,详情查看发行版说明
							parent
							
								
									31e4a08a31
								
							
						
					
					
						commit
						343ce346db
					
				
							
								
								
									
										19
									
								
								README.md
								
								
								
								
							
							
						
						
									
										19
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -109,23 +109,20 @@
 | 
			
		|||
#### 系统预览
 | 
			
		||||
<table>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c781eec.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c7890ab.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf77fa8144d68788.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf7763993e361778.png"/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/02/28/5c7795b707347.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c7b089b.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf7763971d453615.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf77632e85a60423.png"/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c7b9c30.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c7b7504.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf77632b4b090165.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf77639b1be47210.png"/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><img src="https://i.loli.net/2018/12/22/5c1e10c7a9f7d.png"/></td>
 | 
			
		||||
		<td><img src="https://i.imgur.com/FzVaAlS.png"/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><img src="https://i.imgur.com/ah3X2HG.png"/></td>
 | 
			
		||||
        <td><img src="https://i.loli.net/2019/05/18/5cdf77639929277783.png"/></td>
 | 
			
		||||
 <td><img src="https://i.loli.net/2019/05/18/5cdf78969adc389599.png"/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    <parent>
 | 
			
		||||
        <artifactId>eladmin</artifactId>
 | 
			
		||||
        <groupId>me.zhengjie</groupId>
 | 
			
		||||
        <version>1.8</version>
 | 
			
		||||
        <version>1.9</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    <parent>
 | 
			
		||||
        <artifactId>eladmin</artifactId>
 | 
			
		||||
        <groupId>me.zhengjie</groupId>
 | 
			
		||||
        <version>1.8</version>
 | 
			
		||||
        <version>1.9</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>me.zhengjie</groupId>
 | 
			
		||||
            <artifactId>eladmin-common</artifactId>
 | 
			
		||||
            <version>1.8</version>
 | 
			
		||||
            <version>1.9</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <!--模板引擎-->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ public class GeneratorServiceImpl implements GeneratorService {
 | 
			
		|||
        sql.append("order by table_name");
 | 
			
		||||
        Query query = em.createNativeQuery(sql.toString());
 | 
			
		||||
        query.setFirstResult(startEnd[0]);
 | 
			
		||||
        query.setMaxResults(startEnd[1]);
 | 
			
		||||
        query.setMaxResults(startEnd[1]-startEnd[0]);
 | 
			
		||||
 | 
			
		||||
        System.out.println(sql.toString());
 | 
			
		||||
        List<Object[]> result = query.getResultList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    <parent>
 | 
			
		||||
        <artifactId>eladmin</artifactId>
 | 
			
		||||
        <groupId>me.zhengjie</groupId>
 | 
			
		||||
        <version>1.8</version>
 | 
			
		||||
        <version>1.9</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>me.zhengjie</groupId>
 | 
			
		||||
            <artifactId>eladmin-common</artifactId>
 | 
			
		||||
            <version>1.8</version>
 | 
			
		||||
            <version>1.9</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
</project>
 | 
			
		||||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    <parent>
 | 
			
		||||
        <artifactId>eladmin</artifactId>
 | 
			
		||||
        <groupId>me.zhengjie</groupId>
 | 
			
		||||
        <version>1.8</version>
 | 
			
		||||
        <version>1.9</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>me.zhengjie</groupId>
 | 
			
		||||
            <artifactId>eladmin-generator</artifactId>
 | 
			
		||||
            <version>1.8</version>
 | 
			
		||||
            <version>1.9</version>
 | 
			
		||||
            <exclusions>
 | 
			
		||||
                <exclusion>
 | 
			
		||||
                    <groupId>me.zhengjie</groupId>
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>me.zhengjie</groupId>
 | 
			
		||||
            <artifactId>eladmin-tools</artifactId>
 | 
			
		||||
            <version>1.8</version>
 | 
			
		||||
            <version>1.9</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <!--jwt-->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ Target Server Type    : MYSQL
 | 
			
		|||
Target Server Version : 50562
 | 
			
		||||
File Encoding         : 65001
 | 
			
		||||
 | 
			
		||||
Date: 2019-04-11 11:11:09
 | 
			
		||||
Date: 2019-05-18 11:18:44
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
SET FOREIGN_KEY_CHECKS=0;
 | 
			
		||||
| 
						 | 
				
			
			@ -34,11 +34,6 @@ CREATE TABLE `alipay_config` (
 | 
			
		|||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of alipay_config
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
INSERT INTO `alipay_config` VALUES ('1', '2016091700532697', 'utf-8', 'JSON', 'https://openapi.alipaydev.com/gateway.do', 'http://api.auauz.net/api/aliPay/notify', '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', 'http://api.auauz.net/api/aliPay/return', 'RSA2', '2088102176044281');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for dept
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +180,7 @@ CREATE TABLE `log` (
 | 
			
		|||
  `time` bigint(20) DEFAULT NULL,
 | 
			
		||||
  `username` varchar(255) DEFAULT NULL,
 | 
			
		||||
  PRIMARY KEY (`id`)
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=4954 DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=8176 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of log
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +251,7 @@ CREATE TABLE `permission` (
 | 
			
		|||
  `name` varchar(255) DEFAULT NULL COMMENT '名称',
 | 
			
		||||
  `pid` int(11) NOT NULL COMMENT '上级权限',
 | 
			
		||||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of permission
 | 
			
		||||
| 
						 | 
				
			
			@ -327,7 +322,11 @@ CREATE TABLE `picture` (
 | 
			
		|||
  `username` varchar(255) DEFAULT NULL COMMENT '用户名称',
 | 
			
		||||
  `width` varchar(255) DEFAULT NULL COMMENT '图片宽度',
 | 
			
		||||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of picture
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for qiniu_config
 | 
			
		||||
| 
						 | 
				
			
			@ -357,7 +356,11 @@ CREATE TABLE `qiniu_content` (
 | 
			
		|||
  `update_time` datetime DEFAULT NULL COMMENT '上传或同步的时间',
 | 
			
		||||
  `url` varchar(255) DEFAULT NULL COMMENT '文件url',
 | 
			
		||||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of qiniu_content
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for quartz_job
 | 
			
		||||
| 
						 | 
				
			
			@ -399,7 +402,7 @@ CREATE TABLE `quartz_log` (
 | 
			
		|||
  `params` varchar(255) DEFAULT NULL,
 | 
			
		||||
  `time` bigint(20) DEFAULT NULL,
 | 
			
		||||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of quartz_log
 | 
			
		||||
| 
						 | 
				
			
			@ -415,14 +418,16 @@ CREATE TABLE `role` (
 | 
			
		|||
  `name` varchar(255) NOT NULL COMMENT '名称',
 | 
			
		||||
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
 | 
			
		||||
  `data_scope` varchar(255) DEFAULT NULL,
 | 
			
		||||
  `level` int(255) DEFAULT NULL,
 | 
			
		||||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of role
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
INSERT INTO `role` VALUES ('1', '2018-11-23 11:04:37', '管理员', '系统所有权', '全部');
 | 
			
		||||
INSERT INTO `role` VALUES ('2', '2018-11-23 13:09:06', '普通用户', '用于测试菜单与权限', '自定义');
 | 
			
		||||
INSERT INTO `role` VALUES ('1', '2018-11-23 11:04:37', '超级管理员', '系统所有权', '全部', '1');
 | 
			
		||||
INSERT INTO `role` VALUES ('2', '2018-11-23 13:09:06', '普通用户', '用于测试菜单与权限', '本级', '3');
 | 
			
		||||
INSERT INTO `role` VALUES ('4', '2019-05-13 14:16:15', '普通管理员', '普通管理员级别为2,使用该角色新增用户时只能赋予比普通管理员级别低的角色', '全部', '2');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for roles_depts
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +445,6 @@ CREATE TABLE `roles_depts` (
 | 
			
		|||
-- ----------------------------
 | 
			
		||||
-- Records of roles_depts
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
INSERT INTO `roles_depts` VALUES ('2', '7');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for roles_menus
 | 
			
		||||
| 
						 | 
				
			
			@ -497,9 +501,13 @@ INSERT INTO `roles_menus` VALUES ('3', '2');
 | 
			
		|||
INSERT INTO `roles_menus` VALUES ('4', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('5', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('6', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('7', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('8', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('9', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('10', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('11', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('12', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('14', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('15', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('16', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('17', '2');
 | 
			
		||||
| 
						 | 
				
			
			@ -510,12 +518,18 @@ INSERT INTO `roles_menus` VALUES ('22', '2');
 | 
			
		|||
INSERT INTO `roles_menus` VALUES ('23', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('24', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('27', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('28', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('30', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('32', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('33', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('34', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('35', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('36', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('37', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('38', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('39', '2');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('1', '4');
 | 
			
		||||
INSERT INTO `roles_menus` VALUES ('2', '4');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for roles_permissions
 | 
			
		||||
| 
						 | 
				
			
			@ -534,17 +548,24 @@ CREATE TABLE `roles_permissions` (
 | 
			
		|||
-- Records of roles_permissions
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('1', '1');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('4', '2');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '3');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '4');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('4', '3');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('4', '4');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('4', '5');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('4', '6');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '8');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '14');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '20');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '23');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '24');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '25');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '26');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '30');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '36');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '41');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '46');
 | 
			
		||||
INSERT INTO `roles_permissions` VALUES ('2', '51');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for user
 | 
			
		||||
| 
						 | 
				
			
			@ -575,8 +596,8 @@ CREATE TABLE `user` (
 | 
			
		|||
-- Records of user
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
INSERT INTO `user` VALUES ('1', 'https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg', '2018-08-23 09:11:56', 'admin@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'admin', '2019-04-04 16:00:46', '2', '18888888888', '11');
 | 
			
		||||
INSERT INTO `user` VALUES ('3', 'https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg', '2018-12-27 20:05:26', 'test@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'test', '2019-04-01 09:15:24', '2', '17777777777', '12');
 | 
			
		||||
INSERT INTO `user` VALUES ('5', 'https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg', '2019-04-02 10:07:12', 'hr@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'hr', null, '11', '15555555555', '8');
 | 
			
		||||
INSERT INTO `user` VALUES ('3', 'https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg', '2018-12-27 20:05:26', 'test@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'test', '2019-04-01 09:15:24', '2', '17777777777', '12');
 | 
			
		||||
INSERT INTO `user` VALUES ('5', 'https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg', '2019-04-02 10:07:12', 'hr@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'hr', null, '11', '15555555555', '8');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for users_roles
 | 
			
		||||
| 
						 | 
				
			
			@ -596,7 +617,7 @@ CREATE TABLE `users_roles` (
 | 
			
		|||
-- ----------------------------
 | 
			
		||||
INSERT INTO `users_roles` VALUES ('1', '1');
 | 
			
		||||
INSERT INTO `users_roles` VALUES ('3', '2');
 | 
			
		||||
INSERT INTO `users_roles` VALUES ('5', '2');
 | 
			
		||||
INSERT INTO `users_roles` VALUES ('5', '4');
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for verification_code
 | 
			
		||||
| 
						 | 
				
			
			@ -613,6 +634,10 @@ CREATE TABLE `verification_code` (
 | 
			
		|||
  PRIMARY KEY (`id`) USING BTREE
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of verification_code
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Table structure for visits
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
| 
						 | 
				
			
			@ -626,8 +651,4 @@ CREATE TABLE `visits` (
 | 
			
		|||
  `week_day` varchar(255) DEFAULT NULL,
 | 
			
		||||
  PRIMARY KEY (`id`),
 | 
			
		||||
  UNIQUE KEY `UK_11aksgq87euk9bcyeesfs4vtp` (`date`)
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
-- Records of visits
 | 
			
		||||
-- ----------------------------
 | 
			
		||||
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,6 +37,10 @@ public class Role implements Serializable {
 | 
			
		|||
    @Column(name = "data_scope")
 | 
			
		||||
    private String dataScope = "本级";
 | 
			
		||||
 | 
			
		||||
    // 数值越小,级别越大
 | 
			
		||||
    @Column(name = "level")
 | 
			
		||||
    private Integer level = 3;
 | 
			
		||||
 | 
			
		||||
    @Column
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,19 +1,29 @@
 | 
			
		|||
package me.zhengjie.modules.system.rest;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.lang.Dict;
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.system.domain.Role;
 | 
			
		||||
import me.zhengjie.exception.BadRequestException;
 | 
			
		||||
import me.zhengjie.modules.system.domain.User;
 | 
			
		||||
import me.zhengjie.modules.system.service.RoleService;
 | 
			
		||||
import me.zhengjie.modules.system.service.dto.RoleDTO;
 | 
			
		||||
import me.zhengjie.modules.system.service.query.RoleQueryService;
 | 
			
		||||
import me.zhengjie.utils.SecurityUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
import org.springframework.data.domain.Sort;
 | 
			
		||||
import org.springframework.data.web.PageableDefault;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author jie
 | 
			
		||||
 * @date 2018-12-03
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +40,11 @@ public class RoleController {
 | 
			
		|||
 | 
			
		||||
    private static final String ENTITY_NAME = "role";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取单个role
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping(value = "/roles/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_SELECT')")
 | 
			
		||||
    public ResponseEntity getRoles(@PathVariable Long id){
 | 
			
		||||
| 
						 | 
				
			
			@ -42,8 +57,9 @@ public class RoleController {
 | 
			
		|||
     */
 | 
			
		||||
    @GetMapping(value = "/roles/all")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','USER_ALL','USER_CREATE','USER_EDIT')")
 | 
			
		||||
    public ResponseEntity getAll(){
 | 
			
		||||
        return new ResponseEntity(roleQueryService.queryAll(),HttpStatus.OK);
 | 
			
		||||
    public ResponseEntity getAll(@PageableDefault(value = 2000, sort = {"level"}, direction = Sort.Direction.ASC) Pageable pageable){
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity(roleQueryService.queryAll(pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("查询角色")
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +69,12 @@ public class RoleController {
 | 
			
		|||
        return new ResponseEntity(roleQueryService.queryAll(name,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "/roles/level")
 | 
			
		||||
    public ResponseEntity getLevel(){
 | 
			
		||||
        List<Integer> levels = roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(Role::getLevel).collect(Collectors.toList());
 | 
			
		||||
        return new ResponseEntity(Dict.create().set("level", Collections.min(levels)),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("新增角色")
 | 
			
		||||
    @PostMapping(value = "/roles")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_CREATE')")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,9 +4,11 @@ import me.zhengjie.aop.log.Log;
 | 
			
		|||
import me.zhengjie.config.DataScope;
 | 
			
		||||
import me.zhengjie.domain.Picture;
 | 
			
		||||
import me.zhengjie.domain.VerificationCode;
 | 
			
		||||
import me.zhengjie.modules.system.domain.Role;
 | 
			
		||||
import me.zhengjie.modules.system.domain.User;
 | 
			
		||||
import me.zhengjie.exception.BadRequestException;
 | 
			
		||||
import me.zhengjie.modules.system.service.DeptService;
 | 
			
		||||
import me.zhengjie.modules.system.service.RoleService;
 | 
			
		||||
import me.zhengjie.service.PictureService;
 | 
			
		||||
import me.zhengjie.service.VerificationCodeService;
 | 
			
		||||
import me.zhengjie.utils.*;
 | 
			
		||||
| 
						 | 
				
			
			@ -25,6 +27,7 @@ import org.springframework.validation.annotation.Validated;
 | 
			
		|||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author jie
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +52,9 @@ public class UserController {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private DeptService deptService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private RoleService roleService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private VerificationCodeService verificationCodeService;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,6 +102,7 @@ public class UserController {
 | 
			
		|||
        if (resources.getId() != null) {
 | 
			
		||||
            throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
 | 
			
		||||
        }
 | 
			
		||||
        checkLevel(resources);
 | 
			
		||||
        return new ResponseEntity(userService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -103,6 +110,7 @@ public class UserController {
 | 
			
		|||
    @PutMapping(value = "/users")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_EDIT')")
 | 
			
		||||
    public ResponseEntity update(@Validated(User.Update.class) @RequestBody User resources){
 | 
			
		||||
        checkLevel(resources);
 | 
			
		||||
        userService.update(resources);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.NO_CONTENT);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -111,6 +119,12 @@ public class UserController {
 | 
			
		|||
    @DeleteMapping(value = "/users/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_DELETE')")
 | 
			
		||||
    public ResponseEntity delete(@PathVariable Long id){
 | 
			
		||||
        Integer currentLevel =  Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(Role::getLevel).collect(Collectors.toList()));
 | 
			
		||||
        Integer optLevel =  Collections.min(roleService.findByUsers_Id(id).stream().map(Role::getLevel).collect(Collectors.toList()));
 | 
			
		||||
 | 
			
		||||
        if (currentLevel > optLevel) {
 | 
			
		||||
            throw new BadRequestException("角色权限不足");
 | 
			
		||||
        }
 | 
			
		||||
        userService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -176,4 +190,16 @@ public class UserController {
 | 
			
		|||
        userService.updateEmail(userDetails.getUsername(),user.getEmail());
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误
 | 
			
		||||
     * @param resources
 | 
			
		||||
     */
 | 
			
		||||
    private void checkLevel(User resources) {
 | 
			
		||||
        Integer currentLevel =  Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(Role::getLevel).collect(Collectors.toList()));
 | 
			
		||||
        Integer optLevel = roleService.findByRoles(resources.getRoles());
 | 
			
		||||
        if (currentLevel > optLevel) {
 | 
			
		||||
            throw new BadRequestException("角色权限不足");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,9 @@ public interface RoleService {
 | 
			
		|||
    @Cacheable(key = "'findByUsers_Id:' + #p0")
 | 
			
		||||
    List<Role> findByUsers_Id(Long id);
 | 
			
		||||
 | 
			
		||||
    @Cacheable(keyGenerator = "keyGenerator")
 | 
			
		||||
    Integer findByRoles(Set<Role> roles);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * updatePermission
 | 
			
		||||
     * @param resources
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,8 @@ public class RoleDTO implements Serializable {
 | 
			
		|||
 | 
			
		||||
    private String dataScope;
 | 
			
		||||
 | 
			
		||||
    private Integer level;
 | 
			
		||||
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    private Set<PermissionDTO> permissions;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,6 +65,7 @@ public class RoleServiceImpl implements RoleService {
 | 
			
		|||
        role.setRemark(resources.getRemark());
 | 
			
		||||
        role.setDataScope(resources.getDataScope());
 | 
			
		||||
        role.setDepts(resources.getDepts());
 | 
			
		||||
        role.setLevel(resources.getLevel());
 | 
			
		||||
        roleRepository.save(role);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -102,4 +103,13 @@ public class RoleServiceImpl implements RoleService {
 | 
			
		|||
    public List<Role> findByUsers_Id(Long id) {
 | 
			
		||||
        return roleRepository.findByUsers_Id(id).stream().collect(Collectors.toList());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Integer findByRoles(Set<Role> roles) {
 | 
			
		||||
        Set<RoleDTO> roleDTOS = new HashSet<>();
 | 
			
		||||
        for (Role role : roles) {
 | 
			
		||||
            roleDTOS.add(findById(role.getId()));
 | 
			
		||||
        }
 | 
			
		||||
        return Collections.min(roleDTOS.stream().map(RoleDTO::getLevel).collect(Collectors.toList()));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ public class UserServiceImpl implements UserService {
 | 
			
		|||
 | 
			
		||||
        // 默认密码 123456,此密码是加密后的字符
 | 
			
		||||
        resources.setPassword("e10adc3949ba59abbe56e057f20f883e");
 | 
			
		||||
        resources.setAvatar("https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg");
 | 
			
		||||
        resources.setAvatar("https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg");
 | 
			
		||||
        return userMapper.toDto(userRepository.save(resources));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,9 +55,6 @@ public class MenuQueryService {
 | 
			
		|||
            List<Predicate> list = new ArrayList<Predicate>();
 | 
			
		||||
 | 
			
		||||
            if(!ObjectUtils.isEmpty(name)){
 | 
			
		||||
                /**
 | 
			
		||||
                 * 模糊
 | 
			
		||||
                 */
 | 
			
		||||
                list.add(cb.like(root.get("name").as(String.class),"%"+name+"%"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,8 +49,8 @@ public class RoleQueryService {
 | 
			
		|||
     * 分页
 | 
			
		||||
     */
 | 
			
		||||
    @Cacheable(keyGenerator = "keyGenerator")
 | 
			
		||||
    public Object queryAll(){
 | 
			
		||||
        List<Role> roles = roleRepository.findAll(new Spec(null));
 | 
			
		||||
    public Object queryAll(Pageable pageable){
 | 
			
		||||
        List<Role> roles = roleRepository.findAll(new Spec(null),pageable).getContent();
 | 
			
		||||
        return roleMapper.toDto(roles);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <el-button size="mini" type="success" @click="to">编辑</el-button>
 | 
			
		||||
    <el-button size="mini" type="primary" icon="el-icon-edit" @click="to"/>
 | 
			
		||||
    <eForm ref="form" :sup_this="sup_this" :is-add="false"/>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
    <el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
 | 
			
		||||
      <el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
 | 
			
		||||
    </el-select>
 | 
			
		||||
    <el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
 | 
			
		||||
    <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
 | 
			
		||||
</#if>
 | 
			
		||||
    <!-- 新增 -->
 | 
			
		||||
    <div style="display: inline-block;margin: 0px 2px;">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@
 | 
			
		|||
              <el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
 | 
			
		||||
              <el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <el-button slot="reference" type="danger" size="mini">删除</el-button>
 | 
			
		||||
            <el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
 | 
			
		||||
          </el-popover>
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    <parent>
 | 
			
		||||
        <artifactId>eladmin</artifactId>
 | 
			
		||||
        <groupId>me.zhengjie</groupId>
 | 
			
		||||
        <version>1.8</version>
 | 
			
		||||
        <version>1.9</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +22,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>me.zhengjie</groupId>
 | 
			
		||||
            <artifactId>eladmin-logging</artifactId>
 | 
			
		||||
            <version>1.8</version>
 | 
			
		||||
            <version>1.9</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <!--邮件依赖-->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,4 +67,17 @@ public class PictureController {
 | 
			
		|||
        pictureService.delete(pictureService.findById(id));
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除多张图片
 | 
			
		||||
     * @param ids
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Log("删除图片")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PICTURE_ALL','PICTURE_DELETE')")
 | 
			
		||||
    @DeleteMapping(value = "/pictures")
 | 
			
		||||
    public ResponseEntity deleteAll(@RequestBody Long[] ids) {
 | 
			
		||||
        pictureService.deleteAll(ids);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,15 +8,11 @@ import me.zhengjie.service.QiNiuService;
 | 
			
		|||
import me.zhengjie.service.query.QiNiuQueryService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
 | 
			
		||||
import java.nio.charset.Charset;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -108,4 +104,16 @@ public class QiniuController {
 | 
			
		|||
        qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find());
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除多张图片
 | 
			
		||||
     * @param ids
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Log("删除图片")
 | 
			
		||||
    @DeleteMapping(value = "/qiNiuContent")
 | 
			
		||||
    public ResponseEntity deleteAll(@RequestBody Long[] ids) {
 | 
			
		||||
        qiNiuService.deleteAll(ids, qiNiuService.find());
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,4 +36,11 @@ public interface PictureService {
 | 
			
		|||
     */
 | 
			
		||||
    @CacheEvict(allEntries = true)
 | 
			
		||||
    void delete(Picture picture);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除图片
 | 
			
		||||
     * @param ids
 | 
			
		||||
     */
 | 
			
		||||
    @CacheEvict(allEntries = true)
 | 
			
		||||
    void deleteAll(Long[] ids);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,4 +69,12 @@ public interface QiNiuService {
 | 
			
		|||
     */
 | 
			
		||||
    @CacheEvict(allEntries = true)
 | 
			
		||||
    void synchronize(QiniuConfig config);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除文件
 | 
			
		||||
     * @param ids
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @CacheEvict(allEntries = true)
 | 
			
		||||
    void deleteAll(Long[] ids, QiniuConfig config);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,4 +84,11 @@ public class PictureServiceImpl implements PictureService {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteAll(Long[] ids) {
 | 
			
		||||
        for (Long id : ids) {
 | 
			
		||||
            delete(findById(id));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,4 +179,11 @@ public class QiNiuServiceImpl implements QiNiuService {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteAll(Long[] ids, QiniuConfig config) {
 | 
			
		||||
        for (Long id : ids) {
 | 
			
		||||
            delete(findByContentId(id), config);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,13 @@ public class PictureQueryService {
 | 
			
		|||
                list.add(cb.like(root.get("filename").as(String.class),"%"+picture.getFilename()+"%"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if(!ObjectUtils.isEmpty(picture.getUsername())){
 | 
			
		||||
                /**
 | 
			
		||||
                 * 模糊
 | 
			
		||||
                 */
 | 
			
		||||
                list.add(cb.like(root.get("username").as(String.class),"%"+picture.getUsername()+"%"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Predicate[] p = new Predicate[list.size()];
 | 
			
		||||
            return cb.and(list.toArray(p));
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue