Commit 1b1215cf by xushihong

角色列表搜索功能修改

parent f7fdc1ec
<component name="ArtifactManager">
<artifact type="war" name="xzxt-shiro:war">
<output-path>$PROJECT_DIR$/target</output-path>
<root id="archive" name="xzxt_shiro.war">
<output-path>$PROJECT_DIR$/target/artifacts/xzxt_shiro_war</output-path>
<root id="archive" name="xzxt-shiro_war.war">
<element id="artifact" artifact-name="xzxt-shiro:war exploded" />
</root>
</artifact>
......
<component name="ArtifactManager">
<artifact type="exploded-war" name="xzxt-shiro:war exploded">
<output-path>$PROJECT_DIR$/target/xzxt_shiro</output-path>
<output-path>$PROJECT_DIR$/target/artifacts/xzxt_shiro_war_exploded</output-path>
<root id="root">
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
......@@ -27,6 +27,8 @@
<element id="library" level="project" name="Maven: com.github.miemiedev:mybatis-paginator:1.2.15" />
<element id="library" level="project" name="Maven: com.github.pagehelper:pagehelper:3.4.1" />
<element id="library" level="project" name="Maven: mysql:mysql-connector-java:5.1.32" />
<element id="library" level="module" name="Maven: org.oracle:ojdbc6:10" module-name="xzxt-shiro" />
<element id="library" level="module" name="Maven: net.sf.json-lib:json-lib:2.1" module-name="xzxt-shiro" />
<element id="library" level="project" name="Maven: com.alibaba:druid:1.0.9" />
<element id="library" level="project" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-aop:4.3.6.RELEASE" />
......@@ -50,10 +52,11 @@
<element id="library" level="project" name="Maven: org.noggit:noggit:0.5" />
<element id="library" level="project" name="Maven: dom4j:dom4j:1.6.1" />
<element id="library" level="project" name="Maven: xml-apis:xml-apis:1.0.b2" />
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-core:1.2.3" />
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-core:1.3.2" />
<element id="library" level="project" name="Maven: commons-beanutils:commons-beanutils:1.8.3" />
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-web:1.2.3" />
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-spring:1.2.3" />
<element id="library" level="project" name="Maven: com.alibaba:fastjson:1.2.39" />
<element id="library" level="project" name="Maven: io.springfox:springfox-swagger2:2.7.0" />
<element id="library" level="project" name="Maven: io.swagger:swagger-annotations:1.5.13" />
<element id="library" level="project" name="Maven: io.swagger:swagger-models:1.5.13" />
......@@ -80,12 +83,8 @@
<element id="library" level="project" name="Maven: org.opensymphony.quartz:quartz:1.6.1" />
<element id="library" level="project" name="Maven: net.sf.ehcache:ehcache:2.10.2.2.21" />
<element id="library" level="project" name="Maven: org.projectlombok:lombok:1.16.10" />
<element id="library" level="project" name="Maven: javax.servlet:javax.servlet-api:3.0.1" />
</element>
</element>
<element id="directory" name="META-INF">
<element id="file-copy" path="$PROJECT_DIR$/target/xzxt_shiro/META-INF/MANIFEST.MF" />
</element>
<element id="javaee-facet-resources" facet="xzxt-shiro/web/Web" />
</root>
</artifact>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
<type id="Spring" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
......@@ -13,17 +11,7 @@
</list>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/target" />
</component>
</project>
\ No newline at end of file
......@@ -19,6 +19,7 @@ public interface SysRoleDao {
* @return
*/
List<SysRole> selectSysRoles(SysRole sysRole);
List<SysRole> selectSysRolesAll(SysRole sysRole);
/**
* 根据条件获取角色列表
......
......@@ -48,6 +48,25 @@
${limit*page}
) where rn > ${(page-1)*limit}
</select>
<select id="selectSysRolesAll" resultMap="BaseResultMap">
select * from (
select
b.ID, b.ROLENAME, b.DESCRIPTION, b.LRR, b.LRSJ, b.GXR, b.GXSJ, b.LRDWDM, b.LRDWMC, b.SCBZ, b.IP, b.SFFB , b.PID , b.TYPE
<if test="userId != null" >
from sys_user_role a,sys_role b
where b.SCBZ='0'
AND A.USER_ID=#{userId,jdbcType=VARCHAR} and A.ROLE_ID=b.id
<if test="rolename != null"> and b.ROLENAME like '%'||#{rolename}||'%'</if>
</if>
<if test="userId == null" >
from sys_role b
where b.SCBZ='0'
<if test="rolename != null"> and b.ROLENAME like '%'||#{rolename}||'%'</if>
</if>
)
</select>
<select id="selectSysRoleCountByCondition" resultType="integer">
<!---->
SELECT
......@@ -55,11 +74,13 @@
<if test="userId != null" >
from sys_user_role a,sys_role b
where b.SCBZ='0'
AND A.USER_ID=#{userId,jdbcType=VARCHAR} and A.ROLE_ID=b.id
AND A.USER_ID=#{userId,jdbcType=VARCHAR} and A.ROLE_ID=b.ids
<if test="rolename != null"> and b.ROLENAME like '%'||#{rolename}||'%'</if>
</if>
<if test="userId == null" >
from sys_role b
where b.SCBZ='0'
<if test="rolename != null"> and b.ROLENAME like '%'||#{rolename}||'%'</if>
</if>
</select>
<select id="selectSysRolesByCondition" parameterType="com.xzxtshiro.pojo.SysRole" resultMap="BaseResultMap">
......
......@@ -31,7 +31,16 @@ public class SysRoleServiceImpl implements SysRoleService{
@Override
public BaseModel selectSysRolePage(SysRole SysRole) {
List<SysRole> data = sysRoleDao.selectSysRoles(SysRole);
List<SysRole> data = new ArrayList<SysRole>();
if((SysRole.getPermissionName() != null && SysRole.getRolename() != null) || SysRole.getPermissionName() != null){
data = sysRoleDao.selectSysRolesAll(SysRole);
}else{
data = sysRoleDao.selectSysRoles(SysRole);
}
for (SysRole role1 : data) {
List<SysPermissionNew> permissionNews = sysRoleDao.selectPermissionBySysRoleId(role1.getId());
StringBuffer permission = new StringBuffer();
......@@ -41,13 +50,12 @@ public class SysRoleServiceImpl implements SysRoleService{
}
}
role1.setPermissionName(permission.toString());
}
Integer count = sysRoleDao.selectSysRoleCountByCondition(SysRole);
//过滤permissmionName查询
if(SysRole.getPermissionName() != null){
if((SysRole.getPermissionName() != null && SysRole.getRolename() != null) || SysRole.getPermissionName() != null){
for(int i = 0; i < count; i ++){
Iterator<SysRole> it = data.iterator();
while(it.hasNext()){
......@@ -74,18 +82,28 @@ public class SysRoleServiceImpl implements SysRoleService{
BaseModel rolePage = new BaseModel();
if(SysRole.getPermissionName() != null){
//设置permissionName 搜索时候的 rn
List<SysRole> newData = new ArrayList<SysRole>();
if((SysRole.getPermissionName() != null && SysRole.getRolename() != null) || SysRole.getPermissionName() != null){
for(int i = 0; i < data.size(); i ++){
data.get(i).setRn(i+1);
}
for(int i = (SysRole.getPage() - 1) * SysRole.getLimit(); i < SysRole.getPage() * SysRole.getLimit(); i++){
if(i == data.size()){
break;
}
newData.add(data.get(i));
}
count ++;
}
if(SysRole.getRolename() != null){
rolePage.setCount(data.size());
//设置显示的总数
rolePage.setCount(count);
if(SysRole.getPermissionName() != null && SysRole.getRolename() == null || (SysRole.getPermissionName() != null && SysRole.getRolename() != null)){
rolePage.setData(newData);
}else{
rolePage.setCount(count);
rolePage.setData(data);
}
rolePage.setData(data);
return rolePage;
}
......
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@192.168.1.105:1521:XZXT3
jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
jdbc.username=XZXT
jdbc.password=XZXT
......
......@@ -149,15 +149,16 @@
height: 480
});
var $ = layui.$, active = {
reload: function(){
$('.queryUserList').on('click', function(){
var rolename = cheNull($('#rolename').val());
var permissionName = cheNull($('#permissionName').val());
console.log(rolename);
console.log(permissionName);
if (rolename==null){
rolename = '';
}
if (permissionName==null){
permissionName = '';
}
table.reload('testReload', {
where: {
rolename: rolename,
......@@ -167,16 +168,18 @@
curr: 1 //重新从第 1 页开始
},
done: function(res, curr, count){
this.where={};
this.where={
rolename: rolename,
permissionName: permissionName
};
}
});
}
};
$('.queryUserList').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// $('.queryUserList').on('click', function(){
// var type = $(this).data('type');
// active[type] ? active[type].call(this) : '';
// });
});
function cheNull(str) {
if (str==""){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment