Authored by qinchao

模块管理修改

... ... @@ -22,9 +22,9 @@ public interface AuthModuleMapper {
AuthModule selectById(@Param("id") int id);
List<AuthModule> selectAuthModules(PageBean page);
List<AuthModule> selectAuthModules(@Param("startIndex") int startIndex, @Param("pageSize") int pageSize , @Param("keys") String keys);
int selectCount();
int selectCount(@Param("keys") String keys);
int deleteByName(@Param("name") String name);
... ...
... ... @@ -58,12 +58,21 @@
select
count(1)
from auth_module
where 1=1
<if test="keys != null and keys != '' " >
AND (module_name like CONCAT('%',#{keys},'%') or module_name like CONCAT('%',#{keys},'%') )
</if>
</select>
<select id="selectAuthModules" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auth_module
where
1=1
<if test="keys != null and keys != '' " >
AND (module_name like CONCAT('%',#{keys},'%') or module_name like CONCAT('%',#{keys},'%') )
</if>
order by id desc
limit #{startIndex},#{pageSize}
</select>
... ...
... ... @@ -103,20 +103,20 @@ public class ModuleCtrl {
@RequestMapping("/getAuthModules")
@ResponseBody
public BaseResponse<PageResponse<AuthModule>> getAuthModules(@RequestBody PageRequest req) {
public BaseResponse<PageResponse<AuthModule>> getAuthModules(@RequestBody PageRequest req,String keys) {
try{
// 组装分页对象
PageBean page = PageBean.initPageInfo(req.getCurrentPage(),
req.getPageSize(), req);
// 先查询符合条件的总数量
int total = authModuleMapper.selectCount();
int total = authModuleMapper.selectCount(keys);
// 数量为0 直接返回
if (total == 0) {
// 返回初始page对象
return null;
}
// 获取列表
List<AuthModule> authModules = authModuleMapper.selectAuthModules(page);
List<AuthModule> authModules = authModuleMapper.selectAuthModules(page.getStartIndex(),page.getPageSize(),keys);
if (CollectionUtils.isEmpty(authModules)) {
log.debug("getAuthModules is null with param is {}", req);
return null;
... ...