修改角色列表无法显示的问题
This commit is contained in:
@@ -2,19 +2,28 @@ package com.jsh.erp.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Role;
|
import com.jsh.erp.datasource.entities.Role;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.role.RoleService;
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||||
|
import com.jsh.erp.utils.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ji sheng hua 华夏ERP
|
* @author ji sheng hua 华夏ERP
|
||||||
@@ -75,11 +84,35 @@ public class RoleController {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/list")
|
@RequestMapping(value = "/list")
|
||||||
public List<Role> list(HttpServletRequest request)throws Exception {
|
public String list(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
||||||
return roleService.getRole();
|
@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
|
* create by: qiankunpingtai
|
||||||
* website:https://qiankunpingtai.cn
|
* website:https://qiankunpingtai.cn
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface RoleMapperEx {
|
public interface RoleMapperEx {
|
||||||
|
|
||||||
@@ -18,4 +19,5 @@ public interface RoleMapperEx {
|
|||||||
@Param("name") String name);
|
@Param("name") String name);
|
||||||
|
|
||||||
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||||
|
List<Role> getRoleList(Map<String, String> parameterMap);
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RoleService {
|
public class RoleService {
|
||||||
@@ -50,12 +51,10 @@ public class RoleService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Role> getRole()throws Exception {
|
public List<Role> getRoleList(Map<String, String> parameterMap)throws Exception {
|
||||||
RoleExample example = new RoleExample();
|
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
|
||||||
List<Role> list=null;
|
List<Role> list=null;
|
||||||
try{
|
try{
|
||||||
list=roleMapper.selectByExample(example);
|
list=roleMapperEx.getRoleList(parameterMap);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
|||||||
@@ -35,4 +35,14 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</update>
|
</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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user