idea中dubbo的使用

我叫小狐狸 2017-08-10 09:26:13
package com.lxy.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import com.lxy.entity.Clazz;
import com.lxy.entity.Teacher;
import com.lxy.service.ClazzService;
import com.lxy.utils.FilesUtils;
import com.lxy.utils.MD5;


@Controller
@RequestMapping("/clazz/")
public class ClazzController {

@Autowired
private ClazzService clazzService;

@RequestMapping("toGetClazzList")
public String toGetClazzList(){

return "/welcome";
}

@RequestMapping("home")
public String home(){

return "home";
}

/**
* 显示列表
*/
@RequestMapping("getClazzList")
public ModelAndView getClazzList(){
List<Clazz> clazzList = clazzService.getClazzList();
ModelAndView mv = new ModelAndView();
mv.setViewName("clazz/clazz_list");
mv.addObject("clazzList", clazzList);
return mv;
}
/**
* 删除
*/
@RequestMapping("deleteClazz")
@ResponseBody
public ModelMap deleteClazz(Integer classId){
int result = clazzService.deleteClazz(classId);
ModelMap mm = new ModelMap();
if(result==1){
mm.addAttribute("result", result);
}
return mm;
}
/**
* 批量删除
* @param ids
* @return
*/
@RequestMapping("deleClazzAll")
@ResponseBody
public boolean deleClazzAll(String ids){
clazzService.deleClazzAll(ids);
return true;
}
/**
* 跳转至讲师页面
*/
@RequestMapping("toTeacher")
public String toTeacher(Integer classId, HttpServletRequest request){
List<Teacher> teacherList = clazzService.getTeacherList();
request.setAttribute("teacherList", teacherList);
request.setAttribute("classId", classId);
return "clazz/teacher_list";
}
/**
* 选择讲师
*/
@RequestMapping("updateTeacher")
@ResponseBody
public int updateTeacher(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
//
int classCount = clazzService.getClassCount(classId);
if(classCount==1){
i = 1;
}else if(classCount==2){
i = 2;
}else{
clazzService.updateTeacher(classId,teachId);
i = 3;
}
return i;
}
@RequestMapping("updateTeacher2")
@ResponseBody
public int updateTeacher2(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
try {
clazzService.updateTeacher(classId,teachId);
i = 1;
} catch (Exception e) {
e.printStackTrace();
}
return i;
}
/**
* 跳转至班级列表
* @param request
* @return
*/
@RequestMapping("toClassList")
public String toClassList( HttpServletRequest request){
String redirectUrl = "admin/user/getClazzList";
request.setAttribute("redirectUrl", redirectUrl);
return "closeLayer";
}
/**
* 跳转至修改页面
*/
/*@RequestMapping("toUpdateClazz")
public String toUpdateClazz(Integer clazzId,HttpServletRequest request){
return "/user/user_update";
}*/
}



初学,搞不懂
...全文
650 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,151

社区成员

发帖
与我相关
我的任务
社区描述
该论坛主要探讨基于IBM云计算的开发技术,并为网友们提供自由交流的平台。
社区管理员
  • IBM云计算社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧