Commit a2430fb5 by huangjinxin

修改参数

1 parent dea8d434
......@@ -75,6 +75,10 @@ public class UserInfoSearch extends PageRequest implements Serializable {
*/
private String roleId;
/**
* 角色id
*/
private String roleName;
/**
* 用户来源:0:bean 1:新建
*/
private Integer source;
......
......@@ -689,12 +689,12 @@ public class UserService {
Query query = entityManager.createNativeQuery(select + querySql.toString() + limit);
List<Map<String, Object>> resultList1 = query.getResultList();
log.info("resultList1:" + JSONObject.toJSONString(resultList1));
// log.info("resultList1:" + JSONObject.toJSONString(resultList1));
//将结果转换为Map,返回后的map中的key是数据库表字段,如果用实体接收,使用@JsonAlias设置一下在反序列化时进行映射
query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List<Map<String, Object>> resultList = query.getResultList();
log.info("resultList:" + JSONObject.toJSONString(resultList));
List<UserInfoSearch> list = resultList.stream().map(a -> mapConvertToObject(a, UserInfoSearch.class)).collect(Collectors.toList());
// log.info("resultList:" + JSONObject.toJSONString(resultList));
List<UserInfoSearch> list = resultList.stream().map(a -> mapConvertToObject(a)).collect(Collectors.toList());
Integer pageInt = countNum.intValue() / search.getSize();
pageResult.setDataList(list);
pageResult.setCurrPage(search.getPage());
......@@ -708,19 +708,20 @@ public class UserService {
* 将map转换为POJO对象
*
* @param map map
* @param beanClass class
* @return r
*/
public static <T> T mapConvertToObject(Map<String, Object> map, Class<T> beanClass) {
map.remove("password");
map.remove("CREATED_BY");
map.remove("LAST_LOGIN_TIME");
map.remove("wechat_mini_program");
map.remove("CREATED_TIME");
map.remove("UPDATED_BY");
map.remove("UPDATED_TIME");
ObjectMapper mapper = new ObjectMapper();
return mapper.convertValue(map, beanClass);
public static UserInfoSearch mapConvertToObject(Map<String, Object> map) {
UserInfoSearch search = new UserInfoSearch();
search.setId(map.containsKey("id") ? map.get("id").toString() : null);
search.setAccount(map.containsKey("account") ? map.get("account").toString() : null);
search.setNickname(map.containsKey("nickname") ? map.get("nickname").toString() : null);
search.setBan(map.containsKey("ban") ? Integer.parseInt(map.get("ban").toString()) : null);
search.setSource(map.containsKey("source") ? Integer.parseInt(map.get("source").toString()) : null);
search.setEmail(map.containsKey("email") ? map.get("email").toString() : null);
search.setPhone(map.containsKey("phone") ? map.get("phone").toString() : null);
search.setEngineerCode(map.containsKey("engineer_code") ? map.get("engineer_code").toString() : null);
search.setRoleName(map.containsKey("roleName") ? map.get("roleName").toString() : null);
return search;
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!