You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.7 KiB
Java
61 lines
1.7 KiB
Java
package com.jingcheng.cms.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.jingcheng.cms.service.PopularLabelService;
|
|
import com.jingcheng.cms.service.UsersService;
|
|
import com.jingcheng.cms.util.AjaxResult;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/users")
|
|
public class UsersController {
|
|
@Autowired
|
|
private UsersService usersService;
|
|
|
|
|
|
/**
|
|
* 用户列表
|
|
* @param jsonObject
|
|
* @return
|
|
*/
|
|
@RequestMapping("/users-list")
|
|
public AjaxResult getPopularLabelListByPage(@RequestBody JSONObject jsonObject) {
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
JSONObject pageJson= usersService.usersList(jsonObject);
|
|
ajaxResult.setData(pageJson);
|
|
return ajaxResult;
|
|
}
|
|
|
|
/**
|
|
* 删除用户
|
|
* @param jsonObject
|
|
* @return
|
|
*/
|
|
@RequestMapping("/del-users")
|
|
public AjaxResult delPopularLabel(@RequestBody JSONObject jsonObject) {
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
Long id = jsonObject.getLong("id");
|
|
if (null == id){
|
|
ajaxResult.setRetmsg("id不可为空");
|
|
return ajaxResult;
|
|
}
|
|
ajaxResult= usersService.delUsers(id);
|
|
return ajaxResult;
|
|
}
|
|
|
|
/**
|
|
* 新增或者更新用户
|
|
* @param jsonObject
|
|
* @return
|
|
*/
|
|
@RequestMapping("/save-users")
|
|
public AjaxResult saveUsers(@RequestBody JSONObject jsonObject) {
|
|
AjaxResult ajaxResult = usersService.saveUsers(jsonObject);
|
|
return ajaxResult;
|
|
}
|
|
}
|