Home > Database > Mysql Tutorial > mybatis-Mysql like语句值不固定

mybatis-Mysql like语句值不固定

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:33:13
Original
1274 people have browsed it

mybatismysql

<code>    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 tt.EmployeeType='EB43871E-1E7C-48CB-B38D-9E3200D011F7}'-->        AND e.STATUS='FDCAAF7C-8FE8-4340-993E-9E29000B6F14'         <!--AND c.ID IN(SELECT coach FROM tb_mms_coachbuy) -->        <if test="employeetype != null and '' != employeetype">              and tt.EmployeeType= #{employeetype}        </if>        <if test="dept != null and '' != dept">              and INSTR(d.TreeKey, #{dept}) = 1        </if>        <if test="coachlevel != null and '' != coachlevel">              and c.CoachLevel= #{coachlevel}        </if>        <if test="eid != null and '' != eid">              and e.ID != #{eid}         </if>        <!-- Combobox精确查询 -->        <if test="CHNName != null and '' != CHNName">              and e.CHNName like '%#{CHNName}%'         </if>最下面like我想查e.CHNName包括传入的CHNName,也就是like的值不固定,请问应该怎么写?已解决,我从其他模块借鉴的<if test="departmentname != null and '' != departmentname">        and INSTR(d.departmentname,#{departmentname}) > 0</if>mysql中有一个方法 INSTR可以比对两个字符串。</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template