本文运用注意事项:

(1)使用阶段:测试阶段,上生产前需去掉。

(2)作用:通过 系统 执行SQL,绕开权限的控制。

1. Controller 

1     @ApiOperation(value = "test")
2     @PostMapping("/executeSql")
3     public Result<List<LinkedHashMap>> executeSql(@RequestParam("sql") String sql) {
4         return popReconciliationDomain.executeSql(sql);
5     }
6  

2. Demon

1  
2     @Transactional
3     public Result<List<LinkedHashMap>> executeSql(String sql){
4         List<LinkedHashMap> integers = reconciliationPayRuleMapper.executeSql(sql);
5         return new Result(ResultCodeEnum.OK, integers);
6     }

3.Mapper.java

    List<LinkedHashMap> executeSql(String sql);

4.mapper.xml

1   <select  id="executeSql" parameterType="java.lang.String" resultType="java.util.LinkedHashMap" >
2     ${value}
3   </select>
4   

通过post 请求,参数 key:sql;value: 具体的 SQL 语句。

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2021-11-26
  • 2021-08-27
  • 2022-02-02
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案