Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
cfe16838
Commit
cfe16838
authored
Jun 13, 2019
by
qiankunpingtai
Browse files
修改角色列表无法显示的问题
parent
e3711f47
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/RoleController.java
View file @
cfe16838
...
...
@@ -2,19 +2,28 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Role
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.role.RoleService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
/**
* @author ji sheng hua 华夏ERP
...
...
@@ -75,11 +84,35 @@ public class RoleController {
return
arr
;
}
@PostMapping
(
value
=
"/list"
)
public
List
<
Role
>
list
(
HttpServletRequest
request
)
throws
Exception
{
return
roleService
.
getRole
();
@RequestMapping
(
value
=
"/list"
)
public
String
list
(
@RequestParam
(
value
=
Constants
.
PAGE_SIZE
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
Constants
.
CURRENT_PAGE
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
"name"
)
String
name
,
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
String
>
parameterMap
=
ParamUtils
.
requestToMap
(
request
);
parameterMap
.
put
(
"name"
,
name
);
PageQueryInfo
queryInfo
=
new
PageQueryInfo
();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
if
(
pageSize
==
null
||
pageSize
<=
0
)
{
pageSize
=
BusinessConstants
.
DEFAULT_PAGINATION_PAGE_SIZE
;
}
if
(
currentPage
==
null
||
currentPage
<=
0
)
{
currentPage
=
BusinessConstants
.
DEFAULT_PAGINATION_PAGE_NUMBER
;
}
PageHelper
.
startPage
(
currentPage
,
pageSize
,
true
);
List
<
Role
>
list
=
roleService
.
getRoleList
(
parameterMap
);
//获取分页查询后的数据
PageInfo
<
Role
>
pageInfo
=
new
PageInfo
<>(
list
);
objectMap
.
put
(
"page"
,
queryInfo
);
if
(
list
==
null
)
{
queryInfo
.
setRows
(
new
ArrayList
<
Object
>());
queryInfo
.
setTotal
(
BusinessConstants
.
DEFAULT_LIST_NULL_NUMBER
);
return
returnJson
(
objectMap
,
"查找不到数据"
,
ErpInfo
.
OK
.
code
);
}
queryInfo
.
setRows
(
list
);
queryInfo
.
setTotal
(
pageInfo
.
getTotal
());
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
...
...
src/main/java/com/jsh/erp/datasource/mappers/RoleMapperEx.java
View file @
cfe16838
...
...
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
public
interface
RoleMapperEx
{
...
...
@@ -18,4 +19,5 @@ public interface RoleMapperEx {
@Param
(
"name"
)
String
name
);
int
batchDeleteRoleByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
List
<
Role
>
getRoleList
(
Map
<
String
,
String
>
parameterMap
);
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/role/RoleService.java
View file @
cfe16838
...
...
@@ -23,6 +23,7 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
RoleService
{
...
...
@@ -50,12 +51,10 @@ public class RoleService {
return
result
;
}
public
List
<
Role
>
getRole
()
throws
Exception
{
RoleExample
example
=
new
RoleExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
public
List
<
Role
>
getRoleList
(
Map
<
String
,
String
>
parameterMap
)
throws
Exception
{
List
<
Role
>
list
=
null
;
try
{
list
=
roleMapper
.
selectByExample
(
example
);
list
=
roleMapper
Ex
.
getRoleList
(
parameterMap
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
...
...
src/main/resources/mapper_xml/RoleMapperEx.xml
View file @
cfe16838
...
...
@@ -35,4 +35,14 @@
</foreach>
)
</update>
<select
id=
"getRoleList"
resultMap=
"com.jsh.erp.datasource.mappers.RoleMapper.BaseResultMap"
>
SELECT *
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if
test=
"name != null and name != ''"
>
<bind
name=
"name"
value=
"'%' + _parameter.name + '%'"
/>
and name like #{name}
</if>
</select>
</mapper>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment