|
@@ -1,15 +1,87 @@
|
|
|
package com.syjy.calculate.conotroller;
|
|
|
|
|
|
+import com.syjy.calculate.entity.CalculationFormula;
|
|
|
+import com.syjy.calculate.mapper.CalculationFormulaMapper;
|
|
|
+import com.syjy.calculate.repository.CalculationFormulaRepository;
|
|
|
+import com.syjy.calculate.service.AccuracyPassRateCalculateService;
|
|
|
+import com.syjy.calculate.vo.ResponseVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DataAccessException;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Controller
|
|
|
+@RequestMapping("jarCalculate")
|
|
|
public class JarCalculate {
|
|
|
- @PostMapping("/jarCalculate/add")
|
|
|
+ @Resource
|
|
|
+ CalculationFormulaMapper calculationFormulaMapper;
|
|
|
+ @Autowired
|
|
|
+ CalculationFormulaRepository calculationFormulaRepository;
|
|
|
+
|
|
|
+ @GetMapping("test")
|
|
|
@ResponseBody
|
|
|
public String test() {
|
|
|
String aa = "1112";
|
|
|
return aa;
|
|
|
}
|
|
|
+ /* @GetMapping("select")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseVO select() {
|
|
|
+ List<CalculationFormula> calculationFormulaList = new ArrayList<>();
|
|
|
+ calculationFormulaList =calculationFormulaMapper.findAll();
|
|
|
+ System.out.println("测试"+calculationFormulaList);
|
|
|
+ return ResponseVO.success(calculationFormulaList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("add")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseVO add(@RequestBody CalculationFormula calculationFormula ) {
|
|
|
+ String type =calculationFormula.getType();
|
|
|
+ Integer order =calculationFormula.getOrder();
|
|
|
+ String formula =calculationFormula.getFormula();
|
|
|
+ String province =calculationFormula.getProvinceEnum();
|
|
|
+ String state =calculationFormula.getState();
|
|
|
+ try {
|
|
|
+
|
|
|
+ calculationFormulaMapper.add(type,order,formula,province,state);
|
|
|
+ } catch (DataAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseVO.fail("添加失败");
|
|
|
+ }
|
|
|
+ return ResponseVO.success("添加成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("edit")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseVO edit(@RequestBody CalculationFormula calculationFormula){
|
|
|
+ Integer id =calculationFormula.getId();
|
|
|
+ String type =calculationFormula.getType();
|
|
|
+ Integer order =calculationFormula.getOrder();
|
|
|
+ String formula =calculationFormula.getFormula();
|
|
|
+ String province =calculationFormula.getProvinceEnum();
|
|
|
+ String state =calculationFormula.getState();
|
|
|
+ try {
|
|
|
+ calculationFormulaMapper.edit(id,type,order,formula,province,state);
|
|
|
+ } catch (DataAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseVO.fail("修改失败");
|
|
|
+ }
|
|
|
+ return ResponseVO.success("修改成功");
|
|
|
+ }
|
|
|
+ @PostMapping("delete")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseVO delete(@RequestBody CalculationFormula calculationFormula){
|
|
|
+ try {
|
|
|
+ calculationFormulaMapper.delete(calculationFormula.getId());
|
|
|
+ } catch (DataAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseVO.fail("删除失败");
|
|
|
+ }
|
|
|
+ return ResponseVO.success("删除成功");
|
|
|
+ }*/
|
|
|
}
|