|
@@ -2,13 +2,12 @@ package com.syjy.calculate.conotroller;
|
|
|
|
|
|
|
|
|
|
import com.syjy.calculate.entity.tCalculationFormula;
|
|
import com.syjy.calculate.entity.tCalculationFormula;
|
|
-import com.syjy.calculate.mapper.CalculationFormulaMapper;
|
|
|
|
-import com.syjy.calculate.mapper.CalculationFormulaService;
|
|
|
|
import com.syjy.calculate.repository.CalculationFormulaRepository;
|
|
import com.syjy.calculate.repository.CalculationFormulaRepository;
|
|
import com.syjy.calculate.service.AccuracyPassRateCalculateService;
|
|
import com.syjy.calculate.service.AccuracyPassRateCalculateService;
|
|
import com.syjy.calculate.vo.ResponseVO;
|
|
import com.syjy.calculate.vo.ResponseVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
+import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
import org.springframework.dao.DataAccessException;
|
|
import org.springframework.dao.DataAccessException;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@@ -16,6 +15,10 @@ import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.sql.Connection;
|
|
|
|
+import java.sql.DriverManager;
|
|
|
|
+import java.sql.SQLException;
|
|
|
|
+import java.sql.Statement;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -26,8 +29,7 @@ public class JarCalculate {
|
|
public JdbcTemplate jdbcTemplate;
|
|
public JdbcTemplate jdbcTemplate;
|
|
@Autowired
|
|
@Autowired
|
|
CalculationFormulaRepository calculationFormulaRepository;
|
|
CalculationFormulaRepository calculationFormulaRepository;
|
|
- @Autowired
|
|
|
|
- CalculationFormulaService calculationFormulaService;
|
|
|
|
|
|
+
|
|
@GetMapping("test")
|
|
@GetMapping("test")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String test() {
|
|
public String test() {
|
|
@@ -47,51 +49,50 @@ public class JarCalculate {
|
|
}
|
|
}
|
|
return ResponseVO.success(calculationFormulaList);
|
|
return ResponseVO.success(calculationFormulaList);
|
|
}
|
|
}
|
|
-/*
|
|
|
|
- @PostMapping("add")
|
|
|
|
|
|
+ @PostMapping("edit")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public ResponseVO add(@RequestBody CalculationFormula calculationFormula ) {
|
|
|
|
|
|
+ public ResponseVO edit(@RequestBody tCalculationFormula calculationFormula ) {
|
|
|
|
+ Integer id =calculationFormula.getId();
|
|
String type =calculationFormula.getType();
|
|
String type =calculationFormula.getType();
|
|
- Integer order =calculationFormula.getOrder();
|
|
|
|
|
|
+ Integer orderNo =calculationFormula.getOrderNo();
|
|
String formula =calculationFormula.getFormula();
|
|
String formula =calculationFormula.getFormula();
|
|
String province =calculationFormula.getProvinceEnum();
|
|
String province =calculationFormula.getProvinceEnum();
|
|
String state =calculationFormula.getState();
|
|
String state =calculationFormula.getState();
|
|
try {
|
|
try {
|
|
-
|
|
|
|
- calculationFormulaMapper.add(type,order,formula,province,state);
|
|
|
|
|
|
+ jdbcTemplate.update("update t_calculation_formula set type=?,orderNo=?,formula=?,province_enum=?,state=? where id=?", type, orderNo, formula,province,state,id);
|
|
} catch (DataAccessException e) {
|
|
} catch (DataAccessException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- return ResponseVO.fail("添加失败");
|
|
|
|
}
|
|
}
|
|
- return ResponseVO.success("添加成功");
|
|
|
|
|
|
+ return ResponseVO.success("修改成功");
|
|
}
|
|
}
|
|
-
|
|
|
|
- @PostMapping("edit")
|
|
|
|
|
|
+ @PostMapping("add")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public ResponseVO edit(@RequestBody CalculationFormula calculationFormula){
|
|
|
|
|
|
+ public ResponseVO add(@RequestBody tCalculationFormula calculationFormula ) {
|
|
Integer id =calculationFormula.getId();
|
|
Integer id =calculationFormula.getId();
|
|
String type =calculationFormula.getType();
|
|
String type =calculationFormula.getType();
|
|
- Integer order =calculationFormula.getOrder();
|
|
|
|
|
|
+ Integer orderNo =calculationFormula.getOrderNo();
|
|
String formula =calculationFormula.getFormula();
|
|
String formula =calculationFormula.getFormula();
|
|
String province =calculationFormula.getProvinceEnum();
|
|
String province =calculationFormula.getProvinceEnum();
|
|
String state =calculationFormula.getState();
|
|
String state =calculationFormula.getState();
|
|
try {
|
|
try {
|
|
- calculationFormulaMapper.edit(id,type,order,formula,province,state);
|
|
|
|
|
|
+ jdbcTemplate.execute("insert into t_calculation_formula(id,type,orderNo,formula,province_enum,state) values (id,type,orderNo,formula,province,state)");
|
|
} catch (DataAccessException e) {
|
|
} catch (DataAccessException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- return ResponseVO.fail("修改失败");
|
|
|
|
}
|
|
}
|
|
- return ResponseVO.success("修改成功");
|
|
|
|
|
|
+ return ResponseVO.success("新增成功");
|
|
}
|
|
}
|
|
|
|
+
|
|
@PostMapping("delete")
|
|
@PostMapping("delete")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public ResponseVO delete(@RequestBody CalculationFormula calculationFormula){
|
|
|
|
|
|
+ public ResponseVO delete(@RequestBody tCalculationFormula calculationFormula ) {
|
|
|
|
+ Integer id =calculationFormula.getId();
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- calculationFormulaMapper.delete(calculationFormula.getId());
|
|
|
|
|
|
+ jdbcTemplate.update("delete from t_calculation_formula where id=?", id);
|
|
} catch (DataAccessException e) {
|
|
} catch (DataAccessException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- return ResponseVO.fail("删除失败");
|
|
|
|
}
|
|
}
|
|
return ResponseVO.success("删除成功");
|
|
return ResponseVO.success("删除成功");
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|