mybatis 的查询某个字段的特定位数(模糊查询)
获取特定的几位:
1、取url字段后三位字符
select SUBSTRING(url, -3) from link;
2、取url字段前三位字符
select SUBSTRING(url, 3) from link;
配合模糊查询:模糊查询查询顶单后六位
<select id="selectByCode" resultMap="BaseResultMap" parameterType="String" >
select
<include refid="Base_Column_List" />
from wx_order
where SUBSTRING(order_id, -6) like CONCAT('%',#{code},'%')
</select>