mybatis-Mysql like语句值不固定
程序员文章站
2022-06-04 15:57:37
...
mybatismysql
SELECT e.`ID`,e.`EmployeeID`,e.`CHNName`,e.`ENGName`,e.`Sex`,e.`Mobile` FROM tb_pcm_coach c,tb_sys_employee e,tb_sys_employeetype tt, tb_sys_department d WHERE c.ID=e.ID AND e.ID=tt.Employee AND e.dept = d.id AND e.STATUS='FDCAAF7C-8FE8-4340-993E-9E29000B6F14' and tt.EmployeeType= #{employeetype} and INSTR(d.TreeKey, #{dept}) = 1 and c.CoachLevel= #{coachlevel} and e.ID != #{eid} and e.CHNName like '%#{CHNName}%' 最下面like我想查e.CHNName包括传入的CHNName,也就是like的值不固定,请问应该怎么写?已解决,我从其他模块借鉴的 and INSTR(d.departmentname,#{departmentname}) > 0 mysql中有一个方法 INSTR可以比对两个字符串。