|
@@ -30,69 +30,58 @@ public class JarCalculate {
|
|
|
@Autowired
|
|
|
CalculationFormulaRepository calculationFormulaRepository;
|
|
|
|
|
|
- @GetMapping("test")
|
|
|
+ @GetMapping("select")
|
|
|
@ResponseBody
|
|
|
- public String test() {
|
|
|
- String aa = "1112";
|
|
|
- return aa;
|
|
|
- }
|
|
|
- @GetMapping("select")
|
|
|
- @ResponseBody
|
|
|
- public List<CalculationFormula> select() {
|
|
|
- String sql = "SELECT * from t_calculation_formula";
|
|
|
-
|
|
|
- List<CalculationFormula> calculationFormulaList = new ArrayList<>();
|
|
|
- try {
|
|
|
- calculationFormulaList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(CalculationFormula.class));
|
|
|
- } catch (DataAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ public List<CalculationFormula> select() {
|
|
|
+ String sql = "SELECT * from t_calculation_formula";
|
|
|
+ List<CalculationFormula> calculationFormulaList = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ calculationFormulaList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(CalculationFormula.class));
|
|
|
+ } catch (DataAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
return calculationFormulaList;
|
|
|
}
|
|
|
+
|
|
|
@PostMapping("edit")
|
|
|
@ResponseBody
|
|
|
- public String edit(@RequestBody CalculationFormula calculationFormula ) {
|
|
|
-
|
|
|
- Integer id =calculationFormula.getId();
|
|
|
- String type =calculationFormula.getType();
|
|
|
- Integer orderNo =calculationFormula.getOrderNo();
|
|
|
- String formula =calculationFormula.getFormula();
|
|
|
- String province =calculationFormula.getProvinceEnum();
|
|
|
- String state =calculationFormula.getState();
|
|
|
+ public String edit(@RequestBody CalculationFormula calculationFormula) {
|
|
|
+ Integer id = calculationFormula.getId();
|
|
|
+ String type = calculationFormula.getType();
|
|
|
+ Integer orderNo = calculationFormula.getOrderNo();
|
|
|
+ String formula = calculationFormula.getFormula();
|
|
|
+ String province = calculationFormula.getProvinceEnum();
|
|
|
+ String state = calculationFormula.getState();
|
|
|
try {
|
|
|
- jdbcTemplate.update("update t_calculation_formula set type=?,orderNo=?,formula=?,province_enum=?,state=? where id=?", type, orderNo, formula,province,state,id);
|
|
|
+ jdbcTemplate.update("update t_calculation_formula set type=?,orderNo=?,formula=?,province_enum=?,state=? where id=?", type, orderNo, formula, province, state, id);
|
|
|
} catch (DataAccessException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return "修改成功" ;
|
|
|
+ return "修改成功";
|
|
|
}
|
|
|
+
|
|
|
@PostMapping("add")
|
|
|
@ResponseBody
|
|
|
public String add(@RequestBody CalculationFormula calculationFormula) {
|
|
|
- System.out.println("sss"+calculationFormula);
|
|
|
-
|
|
|
- String type =calculationFormula.getType();
|
|
|
- Integer orderNo =calculationFormula.getOrderNo();
|
|
|
- String formula =calculationFormula.getFormula();
|
|
|
- String province_enum =calculationFormula.getProvinceEnum();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ String type = calculationFormula.getType();
|
|
|
+ Integer orderNo = calculationFormula.getOrderNo();
|
|
|
+ String formula = calculationFormula.getFormula();
|
|
|
+ String province_enum = calculationFormula.getProvinceEnum();
|
|
|
try {
|
|
|
jdbcTemplate.update(
|
|
|
- "INSERT INTO t_calculation_formula(TYPE,ORDERNO,FORMULA,PROVINCE_ENUM) VALUES (?, ?,?,?)",type,orderNo,formula,province_enum
|
|
|
- );
|
|
|
+ "INSERT INTO t_calculation_formula(TYPE,ORDERNO,FORMULA,PROVINCE_ENUM) VALUES (?, ?,?,?)", type, orderNo, formula, province_enum
|
|
|
+ );
|
|
|
} catch (DataAccessException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return "新增成功" ;
|
|
|
+ return "新增成功";
|
|
|
}
|
|
|
|
|
|
- @PostMapping( "delet")
|
|
|
+ @PostMapping("delet")
|
|
|
@ResponseBody
|
|
|
public String delete(@RequestBody CalculationFormula calculationFormula) {
|
|
|
- System.out.println("id"+calculationFormula.getId());
|
|
|
- Integer id =calculationFormula.getId();
|
|
|
+ System.out.println("id" + calculationFormula.getId());
|
|
|
+ Integer id = calculationFormula.getId();
|
|
|
try {
|
|
|
jdbcTemplate.update("delete from t_calculation_formula where id=?", id);
|
|
|
} catch (DataAccessException e) {
|
|
@@ -100,5 +89,4 @@ public class JarCalculate {
|
|
|
}
|
|
|
return "删除成功";
|
|
|
}
|
|
|
-
|
|
|
}
|