package com.cms.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.cms.entity.Auth;
import com.cms.service.AuthService;
import com.cms.utils.StrUtil;
import com.cms.utils.page.Pagination;
@Controller
@RequestMapping(value="/auth")
public class AuthController {
@Autowired
AuthService authService;
@ResponseBody
@RequestMapping(value="/list")
public String getAuthList(@RequestParam(defaultValue="0")int curr,@RequestParam(defaultValue="10")int nums,
@RequestParam(defaultValue="")String searchKey) {
Pagination<Auth> page = new Pagination<Auth>();
page.setTotalItemsCount(authService.getTotalItemsCount(searchKey));
page.setPageSize(nums);
page.setPageNum(curr);
List<Auth> list = authService.getAuthList(page, searchKey);
String jsonStr = StrUtil.RETURN_JONS_PRE_STR + page.getTotalItemsCount()
+ StrUtil.RETURN_JONS_MID_STR
+ JSON.toJSONString(list) + StrUtil.RETURN_JONS_END_STR;
return jsonStr;
}
@ResponseBody
@RequestMapping(value="/setting")
public String setting(Auth auth, String type, Byte val) {
if ("teacherAuth".equals(type)) {
auth.setTeacherAuth(val);
} else {
auth.setStudentAuth(val);
}
System.out.println(auth.toString());
if (authService.update(auth) > 0) return StrUtil.RESULT_TRUE;
return "操作失败!";
}
}
最近下载更多
甜心冰淇淋 LV4
6月22日
zolscy LV24
2024年11月27日
赵鑫cdsaljkdfsa LV11
2024年7月1日
lsglsg9 LV23
2024年6月6日
Mr_VVcat LV9
2024年4月30日
wanglinddad LV55
2024年4月2日
WBelong LV8
2024年3月7日
houhanlin33 LV3
2024年1月8日
xutao0523 LV2
2023年12月18日
zxcfgh LV4
2023年11月21日

最近浏览