3. Query all teachers

controller

package com.gunsmoke.demo.eduservice.controller;

import com.gunsmoke.demo.eduservice.entity.EduTeacher;
import com.gunsmoke.demo.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/eduservice/edu-teacher")
public class EduTeacherController {
    @Autowired
    private EduTeacherService teacherService;

    @GetMapping("findAll")
    public List<EduTeacher> findAllTeacher()
    {
        List<EduTeacher> list = teacherService.list(null);
        return  list;
    }
}

mapper

package com.gunsmoke.demo.eduservice.mapper;

import com.gunsmoke.demo.eduservice.entity.EduTeacher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;


@Mapper // 注意这个注解不是自动生成的,后来加的,如果不加需要加配置类,配置包扫描mapperScan
public interface EduTeacherMapper extends BaseMapper<EduTeacher> {

}

Renderings

Here Insert Picture Description
There is a problem, not the return date format
Here Insert Picture Description
solution is configured in the configuration file, the date format and time zone

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8

Revisit after completion of normal
Here Insert Picture Description

Published 236 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/gunsmoke/article/details/105186574