|
@@ -0,0 +1,72 @@
|
|
|
|
+package cn.iocoder.yudao.module.learn.controller.admin.PersonList;
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
+import cn.iocoder.yudao.module.learn.api.person.PersonApi;
|
|
|
|
+import cn.iocoder.yudao.module.learn.api.person.PersonApiImpl;
|
|
|
|
+import cn.iocoder.yudao.module.learn.controller.admin.PersonList.vo.PersonVo;
|
|
|
|
+import cn.iocoder.yudao.module.learn.dal.dataobject.person.PersonDO;
|
|
|
|
+import cn.iocoder.yudao.module.learn.service.personlist.PersonListService;
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
+
|
|
|
|
+@Tag(name = "yudao-lean 模块 - Test")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/demo/test")
|
|
|
|
+@Validated
|
|
|
|
+public class DemoTestController {
|
|
|
|
+ @Resource
|
|
|
|
+ private PersonListService personListService;
|
|
|
|
+ @Resource
|
|
|
|
+ private PersonApi personApi;
|
|
|
|
+
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
+ @Operation(summary = "获取 test 信息")
|
|
|
|
+ public CommonResult<String> get() {
|
|
|
|
+ return success("获取 test 信息 成功!!!!!!!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getPerson")
|
|
|
|
+ @Operation(summary = "获取测试人员信息")
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
+ public CommonResult<PersonDO>getPerson(@Validated @RequestParam("id") Integer id){
|
|
|
|
+ return success(personListService.getPerson(id));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/addPerson")
|
|
|
|
+ @Operation(summary = "新增测试人员信息")
|
|
|
|
+ public CommonResult<Integer>addPerson(@Valid @RequestBody PersonVo personVo){
|
|
|
|
+
|
|
|
|
+ int id = personListService.createPerson(personVo);
|
|
|
|
+ return success(id,"添加成功");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/delPerson")
|
|
|
|
+ @Operation(summary = "删除测试人员信息")
|
|
|
|
+ public CommonResult<Integer>delPerson(@Valid @RequestBody PersonVo personVo){
|
|
|
|
+
|
|
|
|
+ boolean del = personListService.deletePerson(personVo);
|
|
|
|
+ return success((del == true) ? 0:500 ,"删除成功");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 测试api分离
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/ceshiApi")
|
|
|
|
+ @Operation(summary = "测试api封装与biz层分离")
|
|
|
|
+ public CommonResult<String> ceshiApi() {
|
|
|
|
+ return success( personApi.getPerson(2).getName() );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|