模糊查询如何解决sql语句注入问题
模糊查询解决sql语句注入问题的示例:
使用mysql中concat函数可以解决sql注入又能够在位置文件中写%,代码如下:
<selectid="selectByName"resultType="cn.test.domain.Employee">select
id,emp_nameasempName,
sex,email,birthday,address
from
t_employee
where
emp_namelikeconcat(‘%‘,#{empName},‘%‘)
</select>