|
|
@@ -1,10 +1,10 @@
|
|
|
package com.izouma.nineth.web;
|
|
|
+
|
|
|
import com.izouma.nineth.domain.TestClass;
|
|
|
-import com.izouma.nineth.service.TestClassService;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.TestClassRepo;
|
|
|
-import com.izouma.nineth.utils.ObjUtils;
|
|
|
+import com.izouma.nineth.service.TestClassService;
|
|
|
import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -19,19 +19,18 @@ import java.util.List;
|
|
|
@AllArgsConstructor
|
|
|
public class TestClassController extends BaseController {
|
|
|
private TestClassService testClassService;
|
|
|
- private TestClassRepo testClassRepo;
|
|
|
+ private TestClassRepo testClassRepo;
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
- public TestClass save(@RequestBody TestClass record) {
|
|
|
- if (record.getId() != null) {
|
|
|
- TestClass orig = testClassRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
|
|
|
- ObjUtils.merge(orig, record);
|
|
|
- return testClassRepo.save(orig);
|
|
|
- }
|
|
|
- return testClassRepo.save(record);
|
|
|
+ public TestClass save() {
|
|
|
+ return testClassRepo.save(new TestClass("aaa"));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/save1")
|
|
|
+ public void save1() {
|
|
|
+ testClassRepo.nativeSave("aaa");
|
|
|
+ }
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
|
@@ -44,11 +43,6 @@ public class TestClassController extends BaseController {
|
|
|
return testClassRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/del/{id}")
|
|
|
- public void del(@PathVariable Long id) {
|
|
|
- testClassRepo.softDelete(id);
|
|
|
- }
|
|
|
-
|
|
|
@GetMapping("/excel")
|
|
|
@ResponseBody
|
|
|
public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|