Browse Source

用户管理

master
xyiege 4 years ago
parent
commit
af2480bfa7
  1. 23
      src/main/java/cn/chjyj/szwh/controller/admin/AdminUserController.java
  2. 10
      src/main/java/cn/chjyj/szwh/service/UserService.java
  3. 9
      src/main/java/cn/chjyj/szwh/service/impl/UserServiceImpl.java

23
src/main/java/cn/chjyj/szwh/controller/admin/AdminUserController.java

@ -1,22 +1,43 @@
package cn.chjyj.szwh.controller.admin;
import cn.chjyj.szwh.bean.User;
import cn.chjyj.szwh.controller.BaseController;
import cn.chjyj.szwh.service.UserService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/admin/user.User")
public class AdminUserController extends BaseController {
@Autowired
private UserService userService;
@PostMapping("/getUserFind")
public JSONObject getUserFind(){
return jsonObject;
}
/**
* 用户列表
* @param spage
* @param limit
* @return
*/
@PostMapping("/list")
public JSONObject list(){
public JSONObject list(@RequestParam(value = "page",defaultValue = "1") String spage,
@RequestParam(value = "limit",defaultValue = "20")String limit){
int page=Integer.valueOf(spage);
int pagesize=Integer.valueOf(limit);
List<User> userList = userService.getUserList(page,pagesize);
jsonObject.put("data",userList);
jsonObject.put("code",200);
jsonObject.put("msg","操作成功");
return jsonObject;
}
}

10
src/main/java/cn/chjyj/szwh/service/UserService.java

@ -1,11 +1,21 @@
package cn.chjyj.szwh.service;
import cn.chjyj.szwh.bean.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户服务接口
*/
public interface UserService {
/**
* 分页查询用户列表
* @param page
* @param pagesize
* @return
*/
List<User> getUserList(int page, int pagesize);
/**
* 用户isli标识码查询用户
* @param userIsli

9
src/main/java/cn/chjyj/szwh/service/impl/UserServiceImpl.java

@ -1,6 +1,7 @@
package cn.chjyj.szwh.service.impl;
import cn.chjyj.szwh.bean.User;
import cn.chjyj.szwh.constant.ChConstant;
import cn.chjyj.szwh.mapper.UserMapper;
import cn.chjyj.szwh.service.UserService;
import cn.chjyj.szwh.utils.ApiTokenUtils;
@ -12,11 +13,19 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public List<User> getUserList(int page, int pagesize) {
int startrs = page>1?(page-1)*pagesize:0;
return userMapper.getUserList(startrs,pagesize);
}
/**
* 本地库中查找用户信息
* @param userIsli

Loading…
Cancel
Save