From 3552a70bf2d5495352025f9fc6d7894f88dbeed3 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Thu, 3 Jan 2019 16:28:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96xml=E6=96=87=E4=BB=B6sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysRoleResourcePermissionServiceImpl.java | 4 +- .../java/com/lq/cms/web/IndexController.java | 2 +- .../WebSocket/AbstraceWebSocketHandler.java | 47 ------------------- .../lq/code/WebSocket/CommoditySocket.java | 28 ----------- .../com/lq/code/WebSocket/MarcoHandler.java | 23 --------- .../lq/code/WebSocket/MyWebSocketConfig.java | 17 ------- .../lq/code/WebSocket/WebSorketHandler.java | 20 -------- .../lq/code/util/CreateMapperFileUtil.java | 9 ++-- src/main/java/com/lq/code/util/Md5Util.java | 6 ++- .../java/com/lq/code/util/StringUtil.java | 3 +- .../com/lq/code/util/sql/MysqlBuilder.java | 4 +- .../resources/mybatis/mapping/SysFileDao.xml | 8 +++- .../resources/mybatis/mapping/SysLogDao.xml | 19 +++++--- .../mybatis/mapping/SysPermissionDao.xml | 8 +++- .../mybatis/mapping/SysResourceDao.xml | 21 ++++++--- .../resources/mybatis/mapping/SysRoleDao.xml | 19 ++++++-- .../mapping/SysRoleResourcePermissionDao.xml | 10 ++-- .../resources/mybatis/mapping/SysUserDao.xml | 24 +++++++--- .../mybatis/mapping/SysUserRoleDao.xml | 7 ++- .../mybatis/mapping/WechatAccesstokenDao.xml | 13 ++++- .../mybatis/mapping/WechatInfoDao.xml | 14 ++++-- .../resources/mybatis/mappingTemplate.xml | 21 ++++++--- src/main/resources/spring-import.xml | 2 +- .../resources/spring/spring-websocket.xml | 16 ------- .../webapp/WEB-INF/views/jsp/cms/info.jsp | 12 ----- .../WEB-INF/views/jsp/cms/sys/menu/edit.jsp | 1 + 26 files changed, 139 insertions(+), 219 deletions(-) delete mode 100644 src/main/java/com/lq/code/WebSocket/AbstraceWebSocketHandler.java delete mode 100644 src/main/java/com/lq/code/WebSocket/CommoditySocket.java delete mode 100644 src/main/java/com/lq/code/WebSocket/MarcoHandler.java delete mode 100644 src/main/java/com/lq/code/WebSocket/MyWebSocketConfig.java delete mode 100644 src/main/java/com/lq/code/WebSocket/WebSorketHandler.java delete mode 100644 src/main/resources/spring/spring-websocket.xml diff --git a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java index 725d8b9..043228c 100644 --- a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java @@ -66,7 +66,7 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl message) throws Exception { - if (message instanceof TextMessage){ - handleTextMessage(session, (TextMessage) message); - } - else if (message instanceof BinaryMessage){ - handleBinaryMessage(session, (BinaryMessage) message); - } - else if (message instanceof PongMessage){ - handlPongMessage(session, (PongMessage) message); - } else { - throw new IllegalStateException("Unexpected WebSocket message type"+message); - } - } - - protected void handleTextMessage(WebSocketSession session,TextMessage message)throws Exception{ - - } - - protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message)throws Exception{ - - } - protected void handlPongMessage(WebSocketSession session,PongMessage message)throws Exception{ - - } - - @Override - public void handleTransportError(WebSocketSession session, Throwable throwable) throws Exception { - - } - - @Override - public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception { - - } - - -} diff --git a/src/main/java/com/lq/code/WebSocket/CommoditySocket.java b/src/main/java/com/lq/code/WebSocket/CommoditySocket.java deleted file mode 100644 index e70a03c..0000000 --- a/src/main/java/com/lq/code/WebSocket/CommoditySocket.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.lq.code.WebSocket; - -import org.springframework.web.socket.CloseStatus; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; -import org.springframework.web.socket.handler.TextWebSocketHandler; - -/** - * Created by qi_liang on 2018/6/13. - */ -public class CommoditySocket extends TextWebSocketHandler { - - @Override - public void afterConnectionEstablished(WebSocketSession session) throws Exception { - System.out.println("open ......"); - } - - @Override - public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { - System.out.println("Close ........"); - } - - @Override - protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { - super.handleTextMessage(session, message); - System.out.println("接受到的消息是"+message.getPayload()); - } -} diff --git a/src/main/java/com/lq/code/WebSocket/MarcoHandler.java b/src/main/java/com/lq/code/WebSocket/MarcoHandler.java deleted file mode 100644 index 453de81..0000000 --- a/src/main/java/com/lq/code/WebSocket/MarcoHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.lq.code.WebSocket; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; -import org.springframework.web.socket.handler.AbstractWebSocketHandler; - - -/** - * Created by qi_liang on 2018/4/18. - */ -public class MarcoHandler extends AbstractWebSocketHandler { - - private static final Logger logger = LoggerFactory.getLogger(MarcoHandler.class); - //文本消息  - protected void handleTextMessage(WebSocketSession session, TextMessage message)throws Exception{ - logger.info("Received message:"+message.getPayload()); - // Thread.sleep(2000); //  模拟延时 - session.sendMessage(new TextMessage("Polo!")); //发送小 - } - -} diff --git a/src/main/java/com/lq/code/WebSocket/MyWebSocketConfig.java b/src/main/java/com/lq/code/WebSocket/MyWebSocketConfig.java deleted file mode 100644 index 180df27..0000000 --- a/src/main/java/com/lq/code/WebSocket/MyWebSocketConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.lq.code.WebSocket; - -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.socket.config.annotation.WebSocketConfigurer; -import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; - -/** - * Created by qi_liang on 2018/4/1. - */ -public class MyWebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer { - - - @Override - public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) { - - } -} diff --git a/src/main/java/com/lq/code/WebSocket/WebSorketHandler.java b/src/main/java/com/lq/code/WebSocket/WebSorketHandler.java deleted file mode 100644 index 8382fdb..0000000 --- a/src/main/java/com/lq/code/WebSocket/WebSorketHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.lq.code.WebSocket; - -import org.springframework.web.socket.CloseStatus; -import org.springframework.web.socket.WebSocketMessage; -import org.springframework.web.socket.WebSocketSession; - -/** - * Created by qi_liang on 2018/6/13. - */ -public interface WebSorketHandler { - - void alfterConeectionEstablished(WebSocketSession session)throws Exception; - - void handlMessage(WebSocketSession session, WebSocketMessage message)throws Exception; - - void handlTransportError(WebSocketSession session, CloseStatus closeStatus)throws Exception; - - boolean supportsPartialMessages(); - -} diff --git a/src/main/java/com/lq/code/util/CreateMapperFileUtil.java b/src/main/java/com/lq/code/util/CreateMapperFileUtil.java index 5dc40fa..b8e9b19 100644 --- a/src/main/java/com/lq/code/util/CreateMapperFileUtil.java +++ b/src/main/java/com/lq/code/util/CreateMapperFileUtil.java @@ -17,18 +17,21 @@ public class CreateMapperFileUtil { public static String createXML(String filePath,Class daoClazz,Class entityClazz,AbstractDbBuiler db){ String result=FileUtil.read(filePath); + //dao类名 result=result.replace("@DaoName",daoClazz.getName()); + //实体名 result=result.replace("@BeanName",entityClazz.getName()); + //表名 result=result.replace("@tableName", SqlUtil.beanNameToTableName(entityClazz)); StringBuffer columnBuffer=new StringBuffer(); StringBuffer attributeBuffer=new StringBuffer(); - StringBuffer columnAndAttributeBuffer=new StringBuffer(); + StringBuffer columnAndAttributeBuffer=new StringBuffer(); Map map=SqlUtil.getAttributeAndColumn(entityClazz); for (String key:map.keySet()){ attributeBuffer.append("#{"+key+"},"); columnBuffer.append(map.get(key)+","); - columnAndAttributeBuffer.append("\n "+map.get(key)+"="+"#{"+key+"},"); + columnAndAttributeBuffer.append("\n "+map.get(key)+"="+"#{"+key+"},"); } attributeBuffer.deleteCharAt(attributeBuffer.length()-1); columnBuffer.deleteCharAt(columnBuffer.length()-1); @@ -36,10 +39,8 @@ public class CreateMapperFileUtil { result=result.replace("@tableColumn",columnBuffer); result=result.replace("@beanAttribute",attributeBuffer); result=result.replace("@ColumnEqAttribute",columnAndAttributeBuffer); - return result; - } public static void createXml(Class daoClazz,Class entityClazz,AbstractDbBuiler db)throws IOException { diff --git a/src/main/java/com/lq/code/util/Md5Util.java b/src/main/java/com/lq/code/util/Md5Util.java index 876d21e..c54d7ec 100644 --- a/src/main/java/com/lq/code/util/Md5Util.java +++ b/src/main/java/com/lq/code/util/Md5Util.java @@ -27,10 +27,12 @@ public class Md5Util { StringBuffer buffer=new StringBuffer(""); for (int offset=0;offset map:mapList){ String dataTypeStr = dataTypeMap.get(map.get("fieldType")); sql.append(SqlUtil.caseToHump(map.get("fieldName"))+" "+dataTypeStr); - if (dataTypeStr.equals("varchar")||dataTypeStr.equals("int")){ + if ("varchar".equals(dataTypeStr)||"int".equals(dataTypeStr)){ if (map.containsKey("fieldLength")) { sql.append("("+map.get("fieldLength")+")"); diff --git a/src/main/resources/mybatis/mapping/SysFileDao.xml b/src/main/resources/mybatis/mapping/SysFileDao.xml index 40c8588..5dd62fe 100644 --- a/src/main/resources/mybatis/mapping/SysFileDao.xml +++ b/src/main/resources/mybatis/mapping/SysFileDao.xml @@ -5,12 +5,16 @@ + + id,path,create_time,file_type,file_name,status + + diff --git a/src/main/resources/mybatis/mapping/SysLogDao.xml b/src/main/resources/mybatis/mapping/SysLogDao.xml index 5543e4c..1f8a4af 100644 --- a/src/main/resources/mybatis/mapping/SysLogDao.xml +++ b/src/main/resources/mybatis/mapping/SysLogDao.xml @@ -5,21 +5,30 @@ + + id,user_ip,create_time,url,status + + @@ -46,7 +55,5 @@ - - diff --git a/src/main/resources/mybatis/mapping/SysPermissionDao.xml b/src/main/resources/mybatis/mapping/SysPermissionDao.xml index 1cf10af..01c8351 100644 --- a/src/main/resources/mybatis/mapping/SysPermissionDao.xml +++ b/src/main/resources/mybatis/mapping/SysPermissionDao.xml @@ -4,8 +4,14 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + id,name,status + + diff --git a/src/main/resources/mybatis/mapping/SysResourceDao.xml b/src/main/resources/mybatis/mapping/SysResourceDao.xml index ef99627..bd86b61 100644 --- a/src/main/resources/mybatis/mapping/SysResourceDao.xml +++ b/src/main/resources/mybatis/mapping/SysResourceDao.xml @@ -5,8 +5,13 @@ + + + id,url_path,sort,parent_id,menu_ico,menu_name,create_time,update_time,user_id,status + + - SELECT COUNT(*) FROM sys_resource WHERE status=1 + SELECT COUNT(id) FROM sys_resource WHERE status=1 @@ -88,7 +97,7 @@ SELECT t1.* FROM sys_role t1 LEFT JOIN sys_user_role t2 ON t1.id=t2.role_id @@ -14,11 +18,16 @@ @@ -54,11 +63,13 @@ diff --git a/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml b/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml index 04b7546..a6b8c2c 100644 --- a/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml +++ b/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml @@ -6,6 +6,10 @@ + + id,permission_id,resource_id,role_id,create_time,status + + - SELECT * FROM sys_role_resource_permission + SELECT + FROM sys_role_resource_permission WHERE 1=1 AND resource_id=#{resourceId} AND permission_id=#{permissonId} @@ -72,7 +77,4 @@ - - - \ No newline at end of file diff --git a/src/main/resources/mybatis/mapping/SysUserDao.xml b/src/main/resources/mybatis/mapping/SysUserDao.xml index ca5c2d0..2fdd29b 100644 --- a/src/main/resources/mybatis/mapping/SysUserDao.xml +++ b/src/main/resources/mybatis/mapping/SysUserDao.xml @@ -6,26 +6,38 @@ + + + id,login_name,password,create_time,update_time,last_login_time,email,img_url,remarks,status + + diff --git a/src/main/resources/mybatis/mapping/SysUserRoleDao.xml b/src/main/resources/mybatis/mapping/SysUserRoleDao.xml index 04d5cc1..5e4e671 100644 --- a/src/main/resources/mybatis/mapping/SysUserRoleDao.xml +++ b/src/main/resources/mybatis/mapping/SysUserRoleDao.xml @@ -6,8 +6,13 @@ + + user_id, role_id, create_time, update_time,status + + diff --git a/src/main/resources/mybatis/mapping/WechatAccesstokenDao.xml b/src/main/resources/mybatis/mapping/WechatAccesstokenDao.xml index 1caf73a..a989f40 100644 --- a/src/main/resources/mybatis/mapping/WechatAccesstokenDao.xml +++ b/src/main/resources/mybatis/mapping/WechatAccesstokenDao.xml @@ -5,12 +5,21 @@ + + + id,create_time,wechat_info_id,access_tokne,last_update_time + + diff --git a/src/main/resources/mybatis/mapping/WechatInfoDao.xml b/src/main/resources/mybatis/mapping/WechatInfoDao.xml index 536b82b..d0685c7 100644 --- a/src/main/resources/mybatis/mapping/WechatInfoDao.xml +++ b/src/main/resources/mybatis/mapping/WechatInfoDao.xml @@ -5,12 +5,16 @@ + + + id,wechat_open_id,app_secpet,create_time,app_id,encoding_type,wechat_name,url,token,encoding_aes_key,last_update_time,status + @@ -54,15 +58,15 @@ WHERE id=#{id} AND - status = 1 + status = 1 - SELECT * FROM @tableName WHERE id=#{id} AND status = 1 + SELECT + FROM @tableName + WHERE id=#{id} AND status = 1 @@ -45,11 +56,9 @@ UPDATE FROM @tableName SET - status = 0 + status = 0 WHERE id=#{id} - - \ No newline at end of file diff --git a/src/main/resources/spring-import.xml b/src/main/resources/spring-import.xml index 0daf615..b7fc4f8 100644 --- a/src/main/resources/spring-import.xml +++ b/src/main/resources/spring-import.xml @@ -15,5 +15,5 @@ - + \ No newline at end of file diff --git a/src/main/resources/spring/spring-websocket.xml b/src/main/resources/spring/spring-websocket.xml deleted file mode 100644 index 2c22927..0000000 --- a/src/main/resources/spring/spring-websocket.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/info.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/info.jsp index 9960325..092d7af 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/info.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/info.jsp @@ -88,18 +88,6 @@ 操作系统: ${sysInfoVo.osInfo.osName} ${sysInfoVo.osInfo.osVersion} - - 用户的主目录: - 4核 - - - 工作目录 - 476M - - - 系统目录 - - diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/menu/edit.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/menu/edit.jsp index c1e0138..25ca09a 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/menu/edit.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/menu/edit.jsp @@ -16,6 +16,7 @@ $("#menuIco").val('${sysResource.menuIco}'); }) +