<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.pz.system.mapper.CityMapper"> <select id="selectAppCity" resultType="com.pz.system.domain.vo.CityVo"> SELECT * FROM city sy <if test="name != null and name != ''"> where sy.name LIKE CONCAT('%', #{name}, '%') </if> GROUP BY sy </select> </mapper>