Browse Source

会话增加授权按钮,增加业务异常和系统日志

git-svn-id: https://192.168.57.71/svn/jsgkj@1081 931142cf-59ea-a443-aa0e-51397b428577
ld_zhouk 8 năm trước cách đây
mục cha
commit
f332943447

+ 5 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/mappers/ButtonModelMapper.java

@@ -1,7 +1,10 @@
 package com.xt.js.gkaq.frame.mappers;
 package com.xt.js.gkaq.frame.mappers;
 
 
+import java.util.List;
+
 import com.xt.js.gkaq.common.BaseMapper;
 import com.xt.js.gkaq.common.BaseMapper;
 import com.xt.js.gkaq.frame.model.ButtonModel;
 import com.xt.js.gkaq.frame.model.ButtonModel;
+import com.xt.js.gkaq.frame.model.GroupModelDto;
 
 
 public interface ButtonModelMapper extends BaseMapper<ButtonModel> {
 public interface ButtonModelMapper extends BaseMapper<ButtonModel> {
 
 
@@ -12,4 +15,6 @@ public interface ButtonModelMapper extends BaseMapper<ButtonModel> {
      * @return
      * @return
      */
      */
     int deleteByMenu(String menu);
     int deleteByMenu(String menu);
+
+    List<ButtonModel> selectAllByUser(GroupModelDto dto);
 }
 }

+ 7 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/mappers/SysLogModelMapper.java

@@ -0,0 +1,7 @@
+package com.xt.js.gkaq.frame.mappers;
+
+import com.xt.js.gkaq.common.BaseMapper;
+import com.xt.js.gkaq.frame.model.SysLogModel;
+
+public interface SysLogModelMapper extends BaseMapper<SysLogModel> {
+}

+ 41 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/model/SysLogModel.java

@@ -0,0 +1,41 @@
+package com.xt.js.gkaq.frame.model;
+
+import com.xt.js.gkaq.common.BaseUUIDModel;
+
+public class SysLogModel extends BaseUUIDModel {
+    /**
+     * serialVersionUID
+     */
+    private static final long serialVersionUID = -5526155564008993724L;
+
+    private String classPath;
+
+    private String type;
+
+    private String message;
+
+    public String getClassPath() {
+        return classPath;
+    }
+
+    public void setClassPath(String classPath) {
+        this.classPath = classPath == null ? null : classPath.trim();
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type == null ? null : type.trim();
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message == null ? null : message.trim();
+    }
+
+}

+ 5 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/ButtonService.java

@@ -1,7 +1,10 @@
 package com.xt.js.gkaq.frame.service;
 package com.xt.js.gkaq.frame.service;
 
 
+import java.util.List;
+
 import com.xt.js.gkaq.common.BaseUUIDModelService;
 import com.xt.js.gkaq.common.BaseUUIDModelService;
 import com.xt.js.gkaq.frame.model.ButtonModel;
 import com.xt.js.gkaq.frame.model.ButtonModel;
+import com.xt.js.gkaq.frame.model.GroupModelDto;
 
 
 /**
 /**
  * °´Å¥·þÎñ½Ó¿Ú
  * °´Å¥·þÎñ½Ó¿Ú
@@ -9,4 +12,6 @@ import com.xt.js.gkaq.frame.model.ButtonModel;
 public interface ButtonService extends BaseUUIDModelService<ButtonModel> {
 public interface ButtonService extends BaseUUIDModelService<ButtonModel> {
 
 
     public int deleteByMenu(String menu);
     public int deleteByMenu(String menu);
+
+    public List<ButtonModel> selectAllByUser(GroupModelDto dto);
 }
 }

+ 13 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/SysLogService.java

@@ -0,0 +1,13 @@
+package com.xt.js.gkaq.frame.service;
+
+import com.xt.js.gkaq.common.BaseUUIDModelService;
+import com.xt.js.gkaq.frame.model.SysLogModel;
+
+/**
+ * ϵͳÈÕÖ¾·þÎñ½Ó¿Ú
+ * 
+ * @author yuanxd
+ *
+ */
+public interface SysLogService extends BaseUUIDModelService<SysLogModel> {
+}

+ 8 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/impl/ButtonServiceImpl.java

@@ -1,5 +1,7 @@
 package com.xt.js.gkaq.frame.service.impl;
 package com.xt.js.gkaq.frame.service.impl;
 
 
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -7,6 +9,7 @@ import com.xt.js.gkaq.common.BaseMapper;
 import com.xt.js.gkaq.common.BaseUUIDModelServiceImpl;
 import com.xt.js.gkaq.common.BaseUUIDModelServiceImpl;
 import com.xt.js.gkaq.frame.mappers.ButtonModelMapper;
 import com.xt.js.gkaq.frame.mappers.ButtonModelMapper;
 import com.xt.js.gkaq.frame.model.ButtonModel;
 import com.xt.js.gkaq.frame.model.ButtonModel;
+import com.xt.js.gkaq.frame.model.GroupModelDto;
 import com.xt.js.gkaq.frame.service.ButtonService;
 import com.xt.js.gkaq.frame.service.ButtonService;
 
 
 @Service
 @Service
@@ -23,4 +26,9 @@ public class ButtonServiceImpl extends BaseUUIDModelServiceImpl<ButtonModel> imp
         return mapper.deleteByMenu(menu);
         return mapper.deleteByMenu(menu);
     }
     }
 
 
+    @Override
+    public List<ButtonModel> selectAllByUser(GroupModelDto dto) {
+        return mapper.selectAllByUser(dto);
+    }
+
 }
 }

+ 21 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/impl/SysLogServiceImpl.java

@@ -0,0 +1,21 @@
+package com.xt.js.gkaq.frame.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.xt.js.gkaq.common.BaseMapper;
+import com.xt.js.gkaq.common.BaseUUIDModelServiceImpl;
+import com.xt.js.gkaq.frame.mappers.SysLogModelMapper;
+import com.xt.js.gkaq.frame.model.SysLogModel;
+import com.xt.js.gkaq.frame.service.SysLogService;
+
+@Service
+public class SysLogServiceImpl extends BaseUUIDModelServiceImpl<SysLogModel> implements SysLogService {
+	@Autowired
+	private SysLogModelMapper mapper;
+
+	@Override
+	protected BaseMapper<SysLogModel> getMapper() {
+		return mapper;
+	}
+}

+ 1 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/system/FrameParam.java

@@ -15,6 +15,7 @@ public class FrameParam {
 	public static String SESSION_KEY_AUTH = "__AUTH";
 	public static String SESSION_KEY_AUTH = "__AUTH";
 
 
     public static final String SESSION_KEY_MENUS = "GKAQ_USER_MENUS";
     public static final String SESSION_KEY_MENUS = "GKAQ_USER_MENUS";
+    public static final String SESSION_KEY_BTNS = "GKAQ_USER_BTNS";
 
 
     /**
     /**
 	 * ÖØÐ¼ÓÔØÏµÍ³²ÎÊý
 	 * ÖØÐ¼ÓÔØÏµÍ³²ÎÊý

+ 6 - 0
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/system/GkaqFormAuthenticationFilter.java

@@ -11,9 +11,11 @@ import org.apache.shiro.session.Session;
 import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
 import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 
 
+import com.xt.js.gkaq.frame.model.ButtonModel;
 import com.xt.js.gkaq.frame.model.GroupModelDto;
 import com.xt.js.gkaq.frame.model.GroupModelDto;
 import com.xt.js.gkaq.frame.model.MenuModel;
 import com.xt.js.gkaq.frame.model.MenuModel;
 import com.xt.js.gkaq.frame.model.UserModel;
 import com.xt.js.gkaq.frame.model.UserModel;
+import com.xt.js.gkaq.frame.service.ButtonService;
 import com.xt.js.gkaq.frame.service.GroupService;
 import com.xt.js.gkaq.frame.service.GroupService;
 import com.xt.js.gkaq.frame.service.MenuService;
 import com.xt.js.gkaq.frame.service.MenuService;
 import com.yuanxd.tools.utils.Assert;
 import com.yuanxd.tools.utils.Assert;
@@ -29,6 +31,8 @@ public class GkaqFormAuthenticationFilter extends FormAuthenticationFilter {
     private GroupService groupService;
     private GroupService groupService;
     @Autowired
     @Autowired
     private MenuService menuService;
     private MenuService menuService;
+    @Autowired
+    private ButtonService buttonService;
 
 
     @Override
     @Override
     protected boolean onLoginSuccess(AuthenticationToken token, org.apache.shiro.subject.Subject subject,
     protected boolean onLoginSuccess(AuthenticationToken token, org.apache.shiro.subject.Subject subject,
@@ -39,8 +43,10 @@ public class GkaqFormAuthenticationFilter extends FormAuthenticationFilter {
         UserModel user = (UserModel) principal;
         UserModel user = (UserModel) principal;
         GroupModelDto userGroup = groupService.selectByUser(user.getId());
         GroupModelDto userGroup = groupService.selectByUser(user.getId());
         List<MenuModel> menuList = menuService.selectAllByUser(userGroup);
         List<MenuModel> menuList = menuService.selectAllByUser(userGroup);
+        List<ButtonModel> btnList = buttonService.selectAllByUser(userGroup);
         Session session = SecurityUtils.getSubject().getSession();
         Session session = SecurityUtils.getSubject().getSession();
         session.setAttribute(FrameParam.SESSION_KEY_MENUS, menuList);
         session.setAttribute(FrameParam.SESSION_KEY_MENUS, menuList);
+        session.setAttribute(FrameParam.SESSION_KEY_BTNS, btnList);
         return super.onLoginSuccess(token, subject, request, response);
         return super.onLoginSuccess(token, subject, request, response);
     }
     }
 
 

+ 12 - 0
gkaqv2/trunk/modules/frame/src/main/resources/com/xt/js/gkaq/frame/mappers/ButtonModelMapper.xml

@@ -55,4 +55,16 @@
     set STATE = #{STATE_DEL}
     set STATE = #{STATE_DEL}
     where MENU = #{menu,jdbcType=VARCHAR}
     where MENU = #{menu,jdbcType=VARCHAR}
   </delete>
   </delete>
+  <select id="selectAllByUser" resultMap="BaseResultMap" parameterType="com.xt.js.gkaq.frame.model.GroupModelDto" >
+  	<bind name="STATE_DEL" value="@com.xt.js.gkaq.common.BaseUUIDModel@STATE_DELETE"/>
+	select ID, NAME, CODE, MENU, ICON, REMARK, SORTNO
+	from AQ_BASIC_FRAME_BUTTON
+	where ID in (
+	    select BUTTON_ID from AQ_BASIC_FRAME_GROUP_BUTTON where GROUP_ID = #{id,jdbcType=VARCHAR} and STATE != #{STATE_DEL}
+	    union all
+	    select BUTTON_ID from AQ_BASIC_FRAME_ROLE_BUTTON where ROLE_ID = #{role,jdbcType=VARCHAR} and STATE != #{STATE_DEL}
+	)
+	and STATE != #{STATE_DEL}
+   	order by MENU, SORTNO
+  </select>
 </mapper>
 </mapper>

+ 2 - 2
gkaqv2/trunk/modules/frame/src/main/resources/com/xt/js/gkaq/frame/mappers/MenuModelMapper.xml

@@ -128,9 +128,9 @@
 	select ID, PID, NAME, CODE, ICON, URL, LEAF, REMARK, SORTNO
 	select ID, PID, NAME, CODE, ICON, URL, LEAF, REMARK, SORTNO
 	from AQ_BASIC_FRAME_MENU
 	from AQ_BASIC_FRAME_MENU
 	where ID in (
 	where ID in (
-	    select MENU_ID from AQ_BASIC_FRAME_GROUP_MENU where GROUP_ID = #{id,jdbcType=VARCHAR}
+	    select MENU_ID from AQ_BASIC_FRAME_GROUP_MENU where GROUP_ID = #{id,jdbcType=VARCHAR} and STATE != #{STATE_DEL}
 	    union all
 	    union all
-	    select MENU_ID from AQ_BASIC_FRAME_ROLE_MENU where ROLE_ID = #{role,jdbcType=VARCHAR}
+	    select MENU_ID from AQ_BASIC_FRAME_ROLE_MENU where ROLE_ID = #{role,jdbcType=VARCHAR} and STATE != #{STATE_DEL}
 	)
 	)
 	and STATE != #{STATE_DEL}
 	and STATE != #{STATE_DEL}
    	order by PID, SORTNO
    	order by PID, SORTNO

+ 52 - 0
gkaqv2/trunk/modules/frame/src/main/resources/com/xt/js/gkaq/frame/mappers/SysLogModelMapper.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.xt.js.gkaq.frame.mappers.SysLogModelMapper" >
+  <resultMap id="BaseResultMap" type="com.xt.js.gkaq.frame.model.SysLogModel" >
+    <id column="ID" property="id" jdbcType="VARCHAR" />
+    <result column="CLASS_PATH" property="classPath" jdbcType="VARCHAR" />
+    <result column="TYPE" property="type" jdbcType="CHAR" />
+    <result column="MESSAGE" property="message" jdbcType="VARCHAR" />
+    <result column="STATE" property="state" jdbcType="CHAR" />
+    <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="CREATE_USER" property="createUser" jdbcType="VARCHAR" />
+    <result column="UPDATE_USER" property="updateUser" jdbcType="VARCHAR" />
+  </resultMap>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from AQ_BASIC_FRAME_SYSLOG
+    where ID = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.xt.js.gkaq.frame.model.SysLogModel" >
+    insert into AQ_BASIC_FRAME_SYSLOG (ID, CLASS_PATH, TYPE, 
+      MESSAGE, STATE, CREATE_TIME, 
+      UPDATE_TIME, CREATE_USER, UPDATE_USER
+      )
+    values (#{id,jdbcType=VARCHAR}, #{classPath,jdbcType=VARCHAR}, #{type,jdbcType=CHAR}, 
+      #{message,jdbcType=VARCHAR}, #{state,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR}
+      )
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.xt.js.gkaq.frame.model.SysLogModel" >
+    update AQ_BASIC_FRAME_SYSLOG
+    set CLASS_PATH = #{classPath,jdbcType=VARCHAR},
+      TYPE = #{type,jdbcType=CHAR},
+      MESSAGE = #{message,jdbcType=VARCHAR},
+      STATE = #{state,jdbcType=CHAR},
+      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      CREATE_USER = #{createUser,jdbcType=VARCHAR},
+      UPDATE_USER = #{updateUser,jdbcType=VARCHAR}
+    where ID = #{id,jdbcType=VARCHAR}
+  </update>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select ID, CLASS_PATH, TYPE, MESSAGE, STATE, CREATE_TIME, UPDATE_TIME, CREATE_USER, 
+    UPDATE_USER
+    from AQ_BASIC_FRAME_SYSLOG
+    where ID = #{id,jdbcType=VARCHAR}
+  </select>
+  <select id="selectAll" resultMap="BaseResultMap" >
+    select ID, CLASS_PATH, TYPE, MESSAGE, STATE, CREATE_TIME, UPDATE_TIME, CREATE_USER, 
+    UPDATE_USER
+    from AQ_BASIC_FRAME_SYSLOG
+  </select>
+</mapper>

+ 1 - 0
gkaqv2/trunk/modules/frame/src/main/resources/generatorConfig.xml

@@ -88,5 +88,6 @@
 		</table>
 		</table>
 		  <table tableName="AQ_BASIC_FRAME_USERINFO" domainObjectName="UserInfoModel"></table>
 		  <table tableName="AQ_BASIC_FRAME_USERINFO" domainObjectName="UserInfoModel"></table>
 		  -->
 		  -->
+		<table tableName="AQ_BASIC_FRAME_SYSLOG" domainObjectName="SysLogModel"></table>
 	</context>
 	</context>
 </generatorConfiguration>
 </generatorConfiguration>