idea+spring boot +mybatis+mysql (2)

實體類:

mapper.xml

mapper:

impl:

service:

package com.xingneng.lly.UserService;

import java.util.List;

public interface UserService {
    List findList();

    List findGoback();
}

controller:

package com.xingneng.lly.UserController;

import com.xingneng.lly.UserService.UserService;
import dingshirenwu.ScheduledService;
import dingshirenwu.TaskScheduleConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

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

@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("findList")
    public String findList(HttpServletRequest request){
        ScheduledService s=new ScheduledService();
        s.scheduled();
        s.scheduled1();
        s.scheduled2();
       // AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskScheduleConfig.class);
       List list= userService.findList();
        System.out.println(list);
        request.setAttribute("list",list);
        return "list";
    }

    @RequestMapping("findGoback")
    public String findGoback(HttpServletRequest request){

     //   AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TaskScheduleConfig.class);
        List list= userService.findGoback();
        System.out.println(list);
        request.setAttribute("list",list);
        return "list1";
    }
}

基本架構:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章