kaiyu
2020-09-30 3bf4a89e8470abf09ca61db5a5e8e8e84f45455b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.moral.controller;
 
import com.moral.common.bean.ResultBean;
import com.moral.entity.Profession;
import com.moral.service.ProfessionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;
 
@RestController
@RequestMapping("profession")
public class ProfessionController {
      @Resource
      ProfessionService professionService;
      @GetMapping(value = "getall")
     public ResultBean<List<Profession>> getALL(Optional<String> name){
          String queryName = name.isPresent()?name.get():null;
          return  new ResultBean<>(professionService.queryByName(queryName));
      }
}