Browse Source

兼容mysql5低版本

pull/324/head
648540858 3 years ago
parent
commit
5c2d27f75d
  1. 16
      sql/mysql.sql
  2. 8
      src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

16
sql/mysql.sql

@ -397,13 +397,13 @@ LOCK TABLES `platform_gb_stream` WRITE;
UNLOCK TABLES;
--
-- Table structure for table `role`
-- Table structure for table `user_role`
--
DROP TABLE IF EXISTS `role`;
DROP TABLE IF EXISTS `user_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role` (
CREATE TABLE `user_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`authority` varchar(50) NOT NULL,
@ -414,13 +414,13 @@ CREATE TABLE `role` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `role`
-- Dumping data for table `user_role`
--
LOCK TABLES `role` WRITE;
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
INSERT INTO `role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
LOCK TABLES `user_role` WRITE;
/*!40000 ALTER TABLE `user_role` DISABLE KEYS */;
INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
/*!40000 ALTER TABLE `user_role` ENABLE KEYS */;
UNLOCK TABLES;
--

8
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java

@ -27,7 +27,7 @@ public interface UserMapper {
@Delete("DELETE FROM user WHERE id != 1 and id=#{id}")
int delete(int id);
@Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority , role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and user.username=#{username} AND user.password=#{password}")
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username} AND u.password=#{password}")
@Results(id = "roleMap", value = {
@Result(column = "roleID", property = "role.id"),
@Result(column = "roleName", property = "role.name"),
@ -37,15 +37,15 @@ public interface UserMapper {
})
User select(String username, String password);
@Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and user.id=#{id}")
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.id=#{id}")
@ResultMap(value="roleMap")
User selectById(int id);
@Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and username=#{username}")
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username}")
@ResultMap(value="roleMap")
User getUserByUsername(String username);
@Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id")
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id")
@ResultMap(value="roleMap")
List<User> selectAll();
}

2
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

@ -123,7 +123,7 @@ public class StreamPushController {
// 录像查询以channelId作为deviceId查询
String key = DeferredResultHolder.UPLOAD_FILE_CHANNEL;
String uuid = UUID.randomUUID().toString();
logger.warn("通道导入文件类型: {}",file.getContentType() );
logger.info("通道导入文件类型: {}",file.getContentType() );
if (file.isEmpty()) {
logger.warn("通道导入文件为空");
WVPResult<Object> wvpResult = new WVPResult<>();

Loading…
Cancel
Save