src/main/java/com/whyc/controller/SOPFileTypeController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/SOPFileTypeService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/SOPFileTypeController.java
@@ -1,9 +1,13 @@ package com.whyc.controller; import com.whyc.dto.Response; import com.whyc.service.SOPFileTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; @RequestMapping("sopFileType") @@ -14,4 +18,16 @@ @Autowired private SOPFileTypeService service; @GetMapping("type1") @ApiOperation("查询所有的type1") public Response getType1List(){ return service.getType1List(); } @GetMapping("type2") @ApiOperation("查询所有的type2") public Response getType1List(@RequestParam String type1){ return service.getType2List(type1); } } src/main/java/com/whyc/service/SOPFileTypeService.java
@@ -1,5 +1,8 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.whyc.dto.Response; import com.whyc.mapper.SOPFileTypeMapper; import com.whyc.pojo.SOPFileType; import org.springframework.stereotype.Service; @@ -21,4 +24,18 @@ public void addBatch(List<SOPFileType> newRecordList) { mapper.insertBatchSomeColumn(newRecordList); } public Response getType1List() { QueryWrapper<SOPFileType> query = Wrappers.query(); query.select(" distinct type1"); List<SOPFileType> sopFileTypes = mapper.selectList(query); return new Response().set(1,sopFileTypes); } public Response getType2List(String type1) { QueryWrapper<SOPFileType> query = Wrappers.query(); query.select("type2").eq("type1",type1); List<SOPFileType> sopFileTypes = mapper.selectList(query); return new Response().set(1,sopFileTypes); } }