今天遇到两次,在navicat中sql运行正常,但是在项目框架中运行不通。记录一次。
https://blog.csdn.net/drose29/article/details/103893228
//原始记录查询 @SqlParser(filter=true) List<JdEquipmentstandardVO> selectRecordDatas(JdEquipmentstandardVO jdEquipmentstandard);
<select id="selectRecordDatas" resultMap="jdEquipmentstandardVOResultMap">
select eqsd.*,st.item_name,result.result_json,result.reviewer,result.tester,result.weather,result.opinion from jd_equipmentstandard eqsd
left JOIN jd_standard st on eqsd.standard_id = st.id
left JOIN jd_result result on eqsd.equipment_id = result.equipment_id and eqsd.id= result.standard_id
where eqsd.is_deleted = 0
and eqsd.equipment_id = #{equipmentId} and result.is_deleted = 0 order by CAST(replace(st.item_no, '△', '') as SIGNED);//2△ 去掉三角后排序,在navicat中没问题,在持久层框架出现问题
</select>
https://www.cnblogs.com/cndarren/p/13218290.html
https://blog.csdn.net/weixin_38158541/article/details/103369159
@SqlParser(filter=true)
List<JdStandard> getStandardChilds(JdStandard jdStandard); //递归查询一个父节点下所有子节点 下面sql在navicat中没问题,在持久层框架出现问题 另外在下面sql中不能出现注释,有注释也会报错
<select id="getStandardChilds" parameterType="com.jxlx.entity.JdStandard" resultMap="jdStandardResultMap"> select * from jd_standard where id in( select id from ( select t1.id, if(find_in_set(parent_id, @pids) > 0, @pids := concat(@pids, ',', id), 0) as ischild from ( select id,parent_id from jd_standard t where t.is_deleted = 0 order by parent_id, id ) t1, (select @pids := #{parentId}) t2 ) t3 where ischild != 0 ) </select>