关于javaweb pawj系统

package com.pinganwj.clinic.web.test.controller;


import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;






import com.pinganwj.clinic.web.test.service.TestStuService;
import com.pinganwj.common.model.db.test.TestStudent;
import com.pinganwj.common.utils.ReturnMsg;
import com.pinganwj.common.web.constants.AppConstants;
import com.pinganwj.common.web.constants.AppConstantsMsg;


@Controller
@RequestMapping("/Student")
public class TestStuController {
@Resource
TestStuService testStuService;


Logger logger = LoggerFactory.getLogger(getClass());
private String backMsg;


/**

*/
@RequestMapping("/getAllStudent")
public void getAllStudent(HttpServletRequest request, HttpServletResponse response) {
try {
backMsg = ReturnMsg.plusMsg(testStuService.getAllStudent(), AppConstants.ERROR_CODE_E0000000, AppConstantsMsg.ERROR_MSG_E0000000);
} catch (Exception e) {
logger.error("TestStuController getAllStudent() 异常:[{}]", e.getMessage());
backMsg = ReturnMsg.plusMsg("", AppConstants.ERROR_CODE_E1SP0001, "系统异常");
}
ReturnMsg.sendMsg(backMsg, response, request);
}


/**
* 删除

* @Description: delStudentById
* @param id
* @param request
* @param response
*            void

*/
@RequestMapping("/delStudentById")
public void delStudentById(String id, HttpServletRequest request, HttpServletResponse response) {
try {
backMsg = ReturnMsg.plusMsg(testStuService.delStudentById(id), AppConstants.ERROR_CODE_E0000000, AppConstantsMsg.ERROR_MSG_E0000000);
} catch (Exception e) {
logger.error("TestStuController delStudentById() 异常:[{}]", e.getMessage());
backMsg = ReturnMsg.plusMsg("", AppConstants.ERROR_CODE_E1SP0001, "系统异常");
}
ReturnMsg.sendMsg(backMsg, response, request);
}
 
/**
* 保存

* @Description: save
* @param id
* @param request
* @param response
*            void

*/
@RequestMapping("/save")
public void save(@RequestBody TestStudent TestStudent, HttpServletRequest request, HttpServletResponse response) {
try {
backMsg = ReturnMsg.plusMsg(testStuService.insertStudent(TestStudent), AppConstants.ERROR_CODE_E0000000, AppConstantsMsg.ERROR_MSG_E0000000);
} catch (Exception e) {
logger.error("TestStuController save() 异常:[{}]", e.getMessage());
backMsg = ReturnMsg.plusMsg("", AppConstants.ERROR_CODE_E1SP0001, "系统异常");
}
ReturnMsg.sendMsg(backMsg, response, request);


}


/**
 * 更新
 * 
 * @Description: update
 * @param id
 * @param request
 * @param response
 *            void
 * 
 */
@RequestMapping("/updateStudentById")
public void update(@RequestBody TestStudent TestStudent, HttpServletRequest request, HttpServletResponse response) {
try {
backMsg = ReturnMsg.plusMsg(testStuService.updateStudentById(TestStudent), AppConstants.ERROR_CODE_E0000000, AppConstantsMsg.ERROR_MSG_E0000000);
} catch (Exception e) {
logger.error("TestStuController updateStudentById() 异常:[{}]", e.getMessage());
backMsg = ReturnMsg.plusMsg("", AppConstants.ERROR_CODE_E1SP0001, "系统异常");
}
ReturnMsg.sendMsg(backMsg, response, request);


}




}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值