基于javaweb+SpringBoot的课程信息管理系统(java+springboot+FreeMarker+maven+mysql)

一、项目运行
环境配置:

Jdk1.8 + Tomcat8.0 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

Springboot + SpringMVC + MyBatis + FreeMarker + JavaScript + JQuery + Ajax + maven等等。请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

		Role role = new Role();
		String powerid = String.valueOf(Math.random()).substring(2, 8);
		role.setRoleid(String.valueOf(Math.random()).substring(2, 6));
		role.setPowerid(powerid);
		role.setRolename(rolename);
		power1.setPower(powerContent);
		power1.setRoleid(powerid);
		power1.setId(String.valueOf(Math.random()).substring(2, 8));
		powerService.insert(power1);
		depotService.insert(role);
		return "redirect:/Role/queryAll";
	}
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String ID){
		JSONObject json = new JSONObject();
		Role depot = new Role();
		user.setPassword(passWord);
		user.setType(Constans.STUDENT);
		userService.insert(user);
		return "redirect:/User/student";
	}
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String ID){
		User user = new User();
		user.setId(ID);
		List<User> list = userService.QueryAll(user);
		user = list.get(0);
		JSONObject json = new JSONObject();
	@RequestMapping("/queryOne")
	public String queryOne(String ID){
		JSONObject json = new JSONObject();
		Role depot = new Role();
		Power power = new Power();
		power.setId(ID);
		System.out.println(ID);
		depot.setRoleid(ID);
		List<Role> list = depotService.QueryAll(depot);
		Role role1 = list.get(0);
		Power power1 = powerService.selectByPrimaryKey(role1.getPowerid());
		String name = role1.getRolename();
		role1.setPowerid(power1.getPower());
		String data = json.toJSONString(role1);
		}else{
			Role role = new Role();
			role.setRoleid(user1.getRoleid());
			List<Role> list =roleService.QueryAll(role);
			role =list.get(0);
			request.getSession().setAttribute("roleName", role.getRolename());
			Power power = powerService.selectByPrimaryKey(role.getPowerid());
			if(!StringUtil.isNullOrEmpty(power.getPower())){
				request.getSession().setAttribute("power", power.getPower());
			}
			String time = DateUtil.getStringToday();
			request.getSession().setAttribute("time", time);
			request.getSession().setAttribute("user", user1);
			mav.setViewName("redirect:/User/Main");
		}
		return mav;
	}
	@RequestMapping("/updateStudent")
	public String update(User user){
		userService.updateByPrimaryKey(user);
		return "redirect:/User/student";
        request.setAttribute("list",list);
        return "course";
    }
    @RequestMapping("/receive")
    public String receive(HttpServletRequest request, HttpServletResponse response, MultipartFile file){
        try {
            //也可以用request获取上传文件
            //MultipartFile  fileFile = request.getFile("file"); //这里是页面的name属性
            //转换成输入流
            InputStream is = file.getInputStream();
            //得到excel
            Workbook workbook = Workbook.getWorkbook(is);
            //得到sheet
        JSONObject json = new JSONObject();
        return json.toJSONString(course);
    }
    @RequestMapping("add")
    public String addCourse(Course course){
        course.setId(String.valueOf(Math.random()).substring(2, 10));
        System.out.println(course.toString());
        courseService.insert(course);
        return "redirect:/Course/queryAll";
    }
}
公告控制层: 
@Controller
		request.setAttribute("list", list);
	   if(null != user.getName()){
			request.setAttribute("name", user.getName());
		}
	   if(null != user.getMobile()){
			request.setAttribute("mobile", user.getMobile());
		}
		return "teacher";
	}
	@ResponseBody
	@RequestMapping("/jsonteacher")
	public String QueryAllTeacherjson(HttpServletRequest request,User user){
		List<User> list = userService.QueryAllTeacher(user);
		JSONObject json = new JSONObject();
		return json.toJSONString(list);
	}
	@RequestMapping("/student")
	public String QueryAllStudent(HttpServletRequest request,User user){
		List<User> list = userService.QueryAllStudent(user);
		request.setAttribute("list", list);
		if(null != user.getName()){
			request.setAttribute("name", user.getName());
		}
		if(null != user.getMobile()){
			request.setAttribute("mobile", user.getMobile());
        return "course";
    }
    @RequestMapping("/receive")
    public String receive(HttpServletRequest request, HttpServletResponse response, MultipartFile file){
        try {
            //也可以用request获取上传文件
            //MultipartFile  fileFile = request.getFile("file"); //这里是页面的name属性
            //转换成输入流
            InputStream is = file.getInputStream();
            //得到excel
            Workbook workbook = Workbook.getWorkbook(is);
            //得到sheet
            Sheet sheet = workbook.getSheet(0);
            //得到列数
            int colsNum = sheet.getColumns();
            //得到行数
            int rowsNum = sheet.getRows();
            //单元格
            Cell cell;
            Cell cell1;
            List<Map> list = new ArrayList<>();
            Map<Integer, String> map = new HashMap<Integer, String>();
}
用户管理控制层:
@Controller
@RequestMapping("/User")
public class UserController {
	@Autowired
	private UserService userService;
	@Autowired
	private PowerService powerService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private NoticeService noticeService;
	@RequestMapping("/Main")
	public String res(HttpServletRequest request){
	}
	@RequestMapping("/delete1")
	public String delete1(String ID){
		noticeService.delete(ID);
		return "redirect:/Notice/delete";
	}
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String id){
		System.out.println("=================="+id);
		Notice notice = new Notice();
		notice.setId(id);
		List<Notice> noticeList = noticeService.queryAll(notice);
		JSONObject json = new JSONObject();
		return json.toJSONString(noticeList.get(0));
	}
	@RequestMapping("/add1")
	public String  add(HttpServletRequest request,String Content,String biaoti) throws Exception{
		User user = (User) request.getSession().getAttribute("user");
		Notice notice = new Notice();
		notice.setContent(Content);
		notice.setTitle(biaoti);
		notice.setCreatdate(DateUtil.Date2String(new Date()));
    @Transactional
    @RequestMapping("update1")
    public String update1(HttpServletRequest request,Course course){
        course.setStatus("1");
        courseService.updateByPrimaryKey(course);
        User user = (User) request.getSession().getAttribute("user");
        Curelation curelation1 = new Curelation();
        curelation1.setCourseid(course.getId());
        curelation1.setUserid(user.getId());
        List<Curelation> curelationList = curelationService.queryAll(curelation1);
        if(curelationList.size()==0){
            Curelation curelation = new Curelation();
            curelation.setUserid(user.getId());
	public String queryOne(String id){
		System.out.println("=================="+id);
		Notice notice = new Notice();
		notice.setId(id);
		List<Notice> noticeList = noticeService.queryAll(notice);
		JSONObject json = new JSONObject();
		return json.toJSONString(noticeList.get(0));
	}
	@RequestMapping("/add1")
	public String  add(HttpServletRequest request,String Content,String biaoti) throws Exception{
		User user = (User) request.getSession().getAttribute("user");
		Notice notice = new Notice();
		notice.setContent(Content);
		notice.setTitle(biaoti);
		notice.setCreatdate(DateUtil.Date2String(new Date()));
		notice.setId(String.valueOf(Math.random()).substring(2, 8));
		notice.setUserid(user.getId());

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值