基本信息
源码名称:jsp选课成绩管理系统(源码+数据库脚本)
源码大小:1.72M
文件格式:.zip
开发语言:Java
更新时间:2021-03-23
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


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 "操作失败!";
    }
    
    
}