|
@@ -1,12 +1,18 @@
|
|
|
package com.izouma.uwip.web;
|
|
package com.izouma.uwip.web;
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.izouma.uwip.domain.DomesticPatent;
|
|
import com.izouma.uwip.domain.DomesticPatent;
|
|
|
|
|
+import com.izouma.uwip.dto.DomesticPatentDTO;
|
|
|
|
|
+import com.izouma.uwip.dto.DomesticPatentVO;
|
|
|
import com.izouma.uwip.service.DomesticPatentService;
|
|
import com.izouma.uwip.service.DomesticPatentService;
|
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
|
import com.izouma.uwip.exception.BusinessException;
|
|
import com.izouma.uwip.exception.BusinessException;
|
|
|
import com.izouma.uwip.repo.DomesticPatentRepo;
|
|
import com.izouma.uwip.repo.DomesticPatentRepo;
|
|
|
import com.izouma.uwip.utils.ObjUtils;
|
|
import com.izouma.uwip.utils.ObjUtils;
|
|
|
|
|
+import com.izouma.uwip.utils.SecurityUtils;
|
|
|
import com.izouma.uwip.utils.excel.ExcelUtils;
|
|
import com.izouma.uwip.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -20,7 +26,7 @@ import java.util.List;
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
public class DomesticPatentController extends BaseController {
|
|
public class DomesticPatentController extends BaseController {
|
|
|
private final DomesticPatentService domesticPatentService;
|
|
private final DomesticPatentService domesticPatentService;
|
|
|
- private final DomesticPatentRepo domesticPatentRepo;
|
|
|
|
|
|
|
+ private final DomesticPatentRepo domesticPatentRepo;
|
|
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
@@ -33,6 +39,11 @@ public class DomesticPatentController extends BaseController {
|
|
|
return domesticPatentRepo.save(record);
|
|
return domesticPatentRepo.save(record);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/saveDTO")
|
|
|
|
|
+ public DomesticPatent saveDTO(@RequestBody DomesticPatentVO record) {
|
|
|
|
|
+ return domesticPatentService.saveDTO(record, SecurityUtils.getAuthenticatedUser().getId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
@PostMapping("/all")
|
|
@@ -45,6 +56,11 @@ public class DomesticPatentController extends BaseController {
|
|
|
return domesticPatentRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
return domesticPatentRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/getDTO/{id}")
|
|
|
|
|
+ public DomesticPatentDTO getDTO(@PathVariable Long id) {
|
|
|
|
|
+ return domesticPatentRepo.findDomesticDTO(id).orElseThrow(new BusinessException("无记录"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@PostMapping("/del/{id}")
|
|
@PostMapping("/del/{id}")
|
|
|
public void del(@PathVariable Long id) {
|
|
public void del(@PathVariable Long id) {
|
|
|
domesticPatentRepo.softDelete(id);
|
|
domesticPatentRepo.softDelete(id);
|