@MyBatisDao
public interface CityDao {
List<City> findByName(@Param("name")String name);
}
<select id="findByName" parameterType="java.lang.String" resultType="com.wanmait.demo.vo.City">
SELECT * FROM city where enable=1
<if test="name!= null and name!= ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
在接口参数里加上mybatis中的@param注解
例如: