jinpengyong
2020-10-21 d3c5982218db1413c8f609f1f51b49c49a2db496
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));
      }
}