mgt fix
mgt fix
This commit is contained in:
@@ -7,8 +7,6 @@ import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.domain.GroupMember;
|
||||
import org.maxkey.domain.Groups;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
@@ -17,22 +15,8 @@ import org.maxkey.domain.UserInfo;
|
||||
|
||||
public interface GroupMemberMapper extends IJpaBaseMapper<GroupMember> {
|
||||
|
||||
public List<UserInfo> gridUserMemberInGroup(GroupMember entity);
|
||||
|
||||
public Integer countUserMemberInGroup(GroupMember entity);
|
||||
|
||||
public List<UserInfo> gridAllUserMemberInGroup(GroupMember entity);
|
||||
|
||||
public Integer countAllUserMemberInGroup(GroupMember entity);
|
||||
|
||||
public List<UserInfo> gridUserMemberNotInGroup(GroupMember entity);
|
||||
|
||||
public Integer countUserMemberNotInGroup(GroupMember entity);
|
||||
|
||||
public List<Groups> gridGroupMemberInGroup(GroupMember entity);
|
||||
|
||||
public Integer countGroupMemberInGroup(GroupMember entity);
|
||||
|
||||
|
||||
|
||||
public List<GroupMember> allMemberInGroup(GroupMember entity);
|
||||
public List<GroupMember> memberInGroup(GroupMember entity);
|
||||
public List<GroupMember> memberNotInGroup(GroupMember entity);
|
||||
public List<GroupMember> groupMemberInGroup(GroupMember entity);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.domain.GroupPrivileges;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
@@ -16,12 +15,10 @@ import org.maxkey.domain.apps.Applications;
|
||||
|
||||
public interface GroupPrivilegesMapper extends IJpaBaseMapper<GroupPrivileges> {
|
||||
|
||||
public List<Applications> gridAppsInGroup(GroupPrivileges entity);
|
||||
public List<GroupPrivileges>appsInGroup(GroupPrivileges entity);
|
||||
|
||||
public Integer countAppsInGroup(GroupPrivileges entity);
|
||||
|
||||
public List<Applications> gridAppsNotInGroup(GroupPrivileges entity);
|
||||
public List<GroupPrivileges> appsNotInGroup(GroupPrivileges entity);
|
||||
|
||||
public Integer countAppsNotInGroup(GroupPrivileges entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,64 +22,4 @@ public class GroupMemberService extends JpaBaseService<GroupMember>{
|
||||
// TODO Auto-generated method stub
|
||||
return (GroupMemberMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public JpaPageResults<UserInfo> gridMemberInGroup(GroupMember entity) {
|
||||
Integer totalCount = parseCount(getMapper().countUserMemberInGroup(entity));
|
||||
if(totalCount == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
int totalPage = calculateTotalPage(entity,totalCount);
|
||||
|
||||
if(totalPage == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
if(totalPage < entity.getPage()) {
|
||||
entity.setPage(totalPage);
|
||||
entity.setStartRow(calculateStartRow(totalPage ,entity.getPageResults()));
|
||||
}
|
||||
entity.setPageable(true);
|
||||
return new JpaPageResults<UserInfo>(entity.getPage(),entity.getPageResults(),totalCount,getMapper().gridUserMemberInGroup(entity));
|
||||
}
|
||||
|
||||
public JpaPageResults<UserInfo> gridAllMemberInGroup(GroupMember entity) {
|
||||
Integer totalCount = parseCount(getMapper().countAllUserMemberInGroup(entity));
|
||||
if(totalCount == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
int totalPage = calculateTotalPage(entity,totalCount);
|
||||
|
||||
if(totalPage == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
if(totalPage < entity.getPage()) {
|
||||
entity.setPage(totalPage);
|
||||
entity.setStartRow(calculateStartRow(totalPage ,entity.getPageResults()));
|
||||
}
|
||||
entity.setPageable(true);
|
||||
return new JpaPageResults<UserInfo>(entity.getPage(),entity.getPageResults(),totalCount,getMapper().gridAllUserMemberInGroup(entity));
|
||||
}
|
||||
|
||||
public JpaPageResults<UserInfo> gridMemberNotInGroup(GroupMember entity) {
|
||||
Integer totalCount = parseCount(getMapper().countUserMemberNotInGroup(entity));
|
||||
if(totalCount == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
int totalPage = calculateTotalPage(entity,totalCount);
|
||||
|
||||
if(totalPage == 0) {
|
||||
return new JpaPageResults<UserInfo>();
|
||||
}
|
||||
|
||||
if(totalPage < entity.getPage()) {
|
||||
entity.setPage(totalPage);
|
||||
entity.setStartRow(calculateStartRow(totalPage ,entity.getPageResults()));
|
||||
}
|
||||
entity.setPageable(true);
|
||||
return new JpaPageResults<UserInfo>(entity.getPage(),entity.getPageResults(),totalCount,getMapper().gridUserMemberNotInGroup(entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package org.maxkey.dao.service;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.dao.persistence.GroupPrivilegesMapper;
|
||||
import org.maxkey.domain.GroupPrivileges;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -25,47 +23,4 @@ public class GroupPrivilegesService extends JpaBaseService<GroupPrivileges>{
|
||||
return (GroupPrivilegesMapper)super.getMapper();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public JpaPageResults<Applications> gridAppsInGroup(GroupPrivileges entity) {
|
||||
Integer totalCount = parseCount(getMapper().countAppsInGroup(entity));
|
||||
if(totalCount == 0) {
|
||||
return new JpaPageResults<Applications>();
|
||||
}
|
||||
|
||||
int totalPage = calculateTotalPage(entity,totalCount);
|
||||
|
||||
if(totalPage == 0) {
|
||||
return new JpaPageResults<Applications>();
|
||||
}
|
||||
|
||||
if(totalPage < entity.getPage()) {
|
||||
entity.setPage(totalPage);
|
||||
entity.setStartRow(calculateStartRow(totalPage ,entity.getPageResults()));
|
||||
}
|
||||
entity.setPageable(true);
|
||||
return new JpaPageResults<Applications>(entity.getPage(),entity.getPageResults(),totalCount,getMapper().gridAppsInGroup(entity));
|
||||
}
|
||||
|
||||
public JpaPageResults<Applications> gridAppsNotInGroupGrid(GroupPrivileges entity) {
|
||||
Integer totalCount = parseCount(getMapper().countAppsNotInGroup(entity));
|
||||
if(totalCount == 0) {
|
||||
return new JpaPageResults<Applications>();
|
||||
}
|
||||
|
||||
int totalPage = calculateTotalPage(entity,totalCount);
|
||||
|
||||
if(totalPage == 0) {
|
||||
return new JpaPageResults<Applications>();
|
||||
}
|
||||
|
||||
if(totalPage < entity.getPage()) {
|
||||
entity.setPage(totalPage);
|
||||
entity.setStartRow(calculateStartRow(totalPage ,entity.getPageResults()));
|
||||
}
|
||||
entity.setPageable(true);
|
||||
return new JpaPageResults<Applications>(entity.getPage(),entity.getPageResults(),totalCount,getMapper().gridAppsNotInGroup(entity));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
<!-- GROUP_MEMBER User Member-->
|
||||
<select id="gridAllUserMemberInGroup" parameterType="GroupMember" resultType="UserInfo">
|
||||
<select id="allMemberInGroup" parameterType="GroupMember" resultType="GroupMember">
|
||||
SELECT DISTINCT
|
||||
U.ID,
|
||||
U.USERNAME,
|
||||
@@ -57,17 +57,9 @@
|
||||
WHERE 1 = 1
|
||||
</select>
|
||||
|
||||
<select id="countAllUserMemberInGroup" parameterType="GroupMember" resultType="java.lang.Integer">
|
||||
SELECT DISTINCT
|
||||
COUNT(U.ID)
|
||||
FROM
|
||||
USERINFO U
|
||||
WHERE 1 = 1
|
||||
</select>
|
||||
|
||||
<select id="gridUserMemberInGroup" parameterType="GroupMember" resultType="UserInfo">
|
||||
<select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember">
|
||||
SELECT DISTINCT
|
||||
U.ID,
|
||||
GM.ID,
|
||||
U.USERNAME,
|
||||
U.USERTYPE,
|
||||
U.WINDOWSACCOUNT,
|
||||
@@ -121,27 +113,8 @@
|
||||
AND GM.MEMBERID = U.ID
|
||||
</select>
|
||||
|
||||
<select id="countUserMemberInGroup" parameterType="GroupMember" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(U.ID)
|
||||
FROM
|
||||
USERINFO U,
|
||||
GROUPS G,
|
||||
GROUP_MEMBER GM
|
||||
WHERE 1 = 1
|
||||
<if test="groupId != null and groupId != ''">
|
||||
AND GM.GROUPID = #{groupId}
|
||||
AND G.ID = #{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND G.NAME = #{groupName}
|
||||
</if>
|
||||
AND GM.TYPE = 'USER'
|
||||
AND GM.GROUPID = G.ID
|
||||
AND GM.MEMBERID = U.ID
|
||||
</select>
|
||||
|
||||
<select id="gridUserMemberNotInGroup" parameterType="GroupMember" resultType="UserInfo">
|
||||
<select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember">
|
||||
SELECT DISTINCT
|
||||
U.ID,
|
||||
U.USERNAME,
|
||||
@@ -199,30 +172,9 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="countUserMemberNotInGroup" parameterType="GroupMember" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(U.ID)
|
||||
FROM
|
||||
USERINFO U
|
||||
WHERE
|
||||
U.ID NOT IN(
|
||||
SELECT GM.MEMBERID
|
||||
FROM GROUPS G,GROUP_MEMBER GM
|
||||
WHERE 1 = 1
|
||||
<if test="groupId != null and groupId != ''">
|
||||
AND GM.GROUPID = #{groupId}
|
||||
AND G.ID = #{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND G.NAME = #{groupName}
|
||||
</if>
|
||||
AND GM.TYPE = 'USER'
|
||||
AND GM.GROUPID = G.ID
|
||||
)
|
||||
</select>
|
||||
|
||||
<!-- GROUP_MEMBER Group Member-->
|
||||
<select id="gridGroupMemberInGroup" parameterType="GroupMember" resultType="Groups">
|
||||
<select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups">
|
||||
SELECT DISTINCT
|
||||
IG.*
|
||||
FROM
|
||||
@@ -242,28 +194,6 @@
|
||||
AND G.NAME = #{groupName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countGroupMemberInGroup" parameterType="GroupMember" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(G.ID)
|
||||
FROM
|
||||
GROUPS IG,
|
||||
GROUPS G,
|
||||
GROUP_MEMBER GM
|
||||
WHERE
|
||||
1 = 1
|
||||
AND GM.GROUPID = G.ID
|
||||
AND GM.MEMBERID = IG.ID
|
||||
AND GM.TYPE = 'GROUP'
|
||||
<if test="groupId != null and groupId != ''">
|
||||
AND GM.GROUPID = #{groupId}
|
||||
AND G.ID = #{groupId}
|
||||
</if>
|
||||
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND G.NAME = #{groupName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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="org.maxkey.dao.persistence.GroupPrivilegesMapper" >
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
AND APPS.ID = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND APPS.NAME LIKE '%${name}%'
|
||||
</if>
|
||||
<if test="protocol != null and protocol != ''">
|
||||
AND APPS.PROTOCOL = #{protocol}
|
||||
</if>
|
||||
<if test="category != null and category != ''">
|
||||
AND APPS.CATEGORY = #{category}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- AppGroup -->
|
||||
<select id="appsInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
APPLICATIONS APPS,
|
||||
GROUP_APP GA
|
||||
WHERE
|
||||
GA.APPID=APPS.ID
|
||||
AND GA.GROUPID = #{groupId}
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
<select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
APPLICATIONS APPS
|
||||
WHERE
|
||||
1 = 1
|
||||
AND APPS.ID NOT IN(
|
||||
SELECT
|
||||
APPID
|
||||
FROM
|
||||
GROUP_APP
|
||||
WHERE
|
||||
GROUPID = #{groupId}
|
||||
)
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
|
||||
<select id="grid" parameterType="Organizations" resultType="Organizations">
|
||||
<select id="queryPageResults" parameterType="Organizations" resultType="Organizations">
|
||||
SELECT
|
||||
*
|
||||
FROM ORGANIZATIONS
|
||||
@@ -29,13 +29,6 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM ORGANIZATIONS
|
||||
WHERE 1 = 1
|
||||
<include refid="dao_where_statement"/>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="logisticDelete" parameterType="Organizations" >
|
||||
UPDATE ORGANIZATIONS SET STATUS = '2'
|
||||
WHERE 1 = 1
|
||||
|
||||
Reference in New Issue
Block a user