current position:Home>About using Mybatis to precompile errors

About using Mybatis to precompile errors

2022-08-06 12:46:48CSDN Q&A

问题遇到的现象和发生背景

mysql的版本:5.7.24
mybatis的版本:3.5.5

Mybatis操作mysql数据库使用$Use it without any problem#却报错

问题相关代码,请勿粘贴截图

Mapper对应的接口

public interface ListDataMapper {    ArrayList
   
   
   
    
    selectThirteen 
    (@Param("table")String table, @Param("page")int page);} 
   

mapper对应的sql


   
   
   
   
     < 
    select id="selectThirteen" resultType="ListData"> 
    select 
    name,REPLACE(score, 
    '.', 
    '') 
    as score,num 
    from #{ 
     
    table} 
    order 
    by LPAD(score, 
    7, 
    0) 
    asc 
    limit #{(page 
    -1)* 
    13}, 
    13; 
    select> 
   

mybatis配置信息

 
    configuration        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"        "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration>     
        <typeAliases>        <package name="com.supercount.pojo"/>     
    typeAliases>    <environments default="development">        <environment id="development">            <transactionManager type="JDBC"/>            <dataSource type="POOLED">                <property name="driver" value="com.mysql.jdbc.Driver"/>                 
                    <property name="url" value="jdbc:mysql:///db1?useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&useUnicode=true&characterEncoding=UTF-8"/>                <property name="username" value="root"/>                <property name="password" value="1948"/>             
    dataSource>         
    environment>     
    environments>    <mappers>         
            <package name="com.supercount.mapper"/>     
    mappers> 
    configuration>
运行结果及报错内容

运行结果

img

我的解答思路和尝试过的方法

我使用了$It can be solved but not preventedsql注入

我想要达到的结果

使用#Doing precompiling prevents injection vulnerabilities

copyright notice
author[CSDN Q&A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/218/202207302132382467.html

Random recommended