You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.8 KiB
81 lines
2.8 KiB
package com.example.demo.controller;
|
|
|
|
|
|
import com.example.demo.domain.entity.Detail;
|
|
import com.example.demo.domain.entity.DetailY;
|
|
import com.example.demo.domain.entity.UserDetailExport;
|
|
import com.example.demo.domain.vo.*;
|
|
import com.example.demo.serviceImpl.DetailYServiceImpl;
|
|
import com.example.demo.sevice.DetailService;
|
|
import com.example.demo.sevice.DetailYService;
|
|
//import com.example.demo.sevice.OtherService;
|
|
import com.example.demo.sevice.OtherService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
@RequestMapping("/detailY")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
@CrossOrigin
|
|
public class DetailYController {
|
|
private final DetailYServiceImpl detailYService;
|
|
private final OtherService otherService;
|
|
@PostMapping("/add")
|
|
public Result add(@RequestBody DetailY detailY) {
|
|
try {
|
|
detailYService.add(detailY);
|
|
return Result.success();
|
|
} catch (Exception e) {
|
|
log.warn(Arrays.toString(e.getStackTrace()));
|
|
return Result.error(e.getMessage());
|
|
}
|
|
}
|
|
@PostMapping
|
|
public Result search(@RequestBody Page page) {
|
|
if(ObjectUtils.isEmpty(page.getPageNum())){
|
|
return Result.success(detailYService.getCount(page.getDetailY()));
|
|
}
|
|
else {
|
|
System.out.println(page.getPageNum());
|
|
System.out.println(page.getPageSize());
|
|
System.out.println(page.getDetailY().getSortField());
|
|
return Result.success(detailYService.getDetailByPage(page.getPageNum(), page.getPageSize(), page.getDetailY()));
|
|
}
|
|
}
|
|
@PostMapping("/select")
|
|
public Result searchgold(@RequestBody Page page) {
|
|
if(ObjectUtils.isEmpty(page.getPageNum())){
|
|
return Result.success(detailYService.getgold(page.getDetailYgold()));
|
|
}
|
|
else {
|
|
return Result.success(detailYService.selectgold(page.getPageNum(), page.getPageSize(), page.getDetailYgold()));
|
|
}
|
|
}
|
|
@PostMapping("/searchAll")
|
|
public Result searchAll(@RequestBody DetailExport detailExport) {
|
|
return Result.success(detailYService.searchAll(detailExport));
|
|
}
|
|
@PostMapping("/ERP")
|
|
public Result addERP(@RequestBody ERP erp) throws Exception {
|
|
log.info("erp:{}", erp);
|
|
return Result.success(otherService.addERP(erp));
|
|
}
|
|
@PostMapping("/getDetailY")
|
|
public Result getDetailY(@RequestBody SumDetailY sumDetailY) {
|
|
List<SumDetailY> result = detailYService.getDetailY(sumDetailY);
|
|
return Result.success(result);
|
|
}
|
|
|
|
@PostMapping("/getarea")
|
|
public Result getarea() {
|
|
List<String> result = detailYService.getarea();
|
|
return Result.success(result);
|
|
}
|
|
}
|