Jelajahi Sumber

新增接口修改

yuzijian 2 tahun lalu
induk
melakukan
58180636a6
1 mengubah file dengan 18 tambahan dan 13 penghapusan
  1. 18 13
      src/main/java/com/syjy/calculate/conotroller/JarCalculate.java

+ 18 - 13
src/main/java/com/syjy/calculate/conotroller/JarCalculate.java

@@ -1,7 +1,7 @@
 package com.syjy.calculate.conotroller;
 
 
-import com.syjy.calculate.entity.tCalculationFormula;
+import com.syjy.calculate.entity.CalculationFormula;
 import com.syjy.calculate.repository.CalculationFormulaRepository;
 import com.syjy.calculate.service.AccuracyPassRateCalculateService;
 import com.syjy.calculate.vo.ResponseVO;
@@ -41,9 +41,9 @@ public class JarCalculate {
     public ResponseVO select() {
       String sql = "SELECT * from t_calculation_formula";
 
-      List<tCalculationFormula> calculationFormulaList = new ArrayList<>();
+      List<CalculationFormula> calculationFormulaList = new ArrayList<>();
       try {
-          calculationFormulaList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(tCalculationFormula.class));
+          calculationFormulaList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(CalculationFormula.class));
       } catch (DataAccessException e) {
           e.printStackTrace();
       }
@@ -51,7 +51,7 @@ public class JarCalculate {
     }
     @PostMapping("edit")
     @ResponseBody
-    public ResponseVO edit(@RequestBody tCalculationFormula calculationFormula ) {
+    public ResponseVO edit(@RequestBody CalculationFormula calculationFormula ) {
         Integer id =calculationFormula.getId();
         String type =calculationFormula.getType();
         Integer orderNo =calculationFormula.getOrderNo();
@@ -67,26 +67,31 @@ public class JarCalculate {
     }
     @PostMapping("add")
     @ResponseBody
-    public ResponseVO add(@RequestBody tCalculationFormula calculationFormula ) {
-        Integer id =calculationFormula.getId();
+    public ResponseVO add(@RequestBody CalculationFormula calculationFormula) {
+        System.out.println("sss"+calculationFormula);
+
         String type =calculationFormula.getType();
         Integer orderNo =calculationFormula.getOrderNo();
         String formula =calculationFormula.getFormula();
-        String province =calculationFormula.getProvinceEnum();
-        String state =calculationFormula.getState();
+        String province_enum =calculationFormula.getProvinceEnum();
+
+
+
         try {
-            jdbcTemplate.execute("insert into t_calculation_formula(id,type,orderNo,formula,province_enum,state) values (id,type,orderNo,formula,province,state)");
+            jdbcTemplate.update(
+                    "INSERT INTO t_calculation_formula(TYPE,ORDERNO,FORMULA,PROVINCE_ENUM) VALUES (?, ?,?,?)",type,orderNo,formula,province_enum
+               );
         } catch (DataAccessException e) {
             e.printStackTrace();
         }
         return ResponseVO.success("新增成功");
     }
 
-    @PostMapping("delete")
+    @PostMapping( "delet")
     @ResponseBody
-    public ResponseVO delete(@RequestBody tCalculationFormula calculationFormula ) {
-        Integer id =calculationFormula.getId();
-
+    public ResponseVO delete(@RequestBody CalculationFormula calculationFormula) {
+        System.out.println("id"+calculationFormula.getId());
+    Integer id =calculationFormula.getId();
         try {
             jdbcTemplate.update("delete from t_calculation_formula where id=?", id);
         } catch (DataAccessException e) {