12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-11-29 10:08:30
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
xml问价中查询数据中包含list,需要使用collection<resultMap id="XX" type="com.XXX.XXXX"><id column="o_id" jdbcType="BIGINT" property="id" /><result column="o_user_i
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
xml问价中查询数据中包含list,需要使用collection
<resultMap id="XX" type="com.XXX.XXXX"><id column="o_id" jdbcType="BIGINT" property="id" /><result column="o_user_id" jdbcType="BIGINT" property="userId" />....<collection property="orderProductList" ofType="com.XXXXXX.XXXXX"><id column="p_id" jdbcType="BIGINT" property="id" /><result column="p_order_id" jdbcType="BIGINT" property="orderId" />....</collection></resultMap>
这样的查询系统封装的通用分页查询是不对的,所以需要自己sql中加入分页解决
<select id="XXX" resultMap="OrderListMap">SELECTyou.nick_name,yo.id o_id,yo.user_id o_user_idFROM(SELECT * FROMyoupin_orderWHERE1 = 1<if test="status != null">and `status` = #{status}</if><if test="page != null and limit != null">LIMIT #{page},#{limit}</if>) yoLEFT JOIN XXX yop ON yo.id = yop.order_idLEFT JOIN XXXX you ON yo.user_id = you.id</select>
传入参数的时候需要计算
(offset - 1) * limit, limit
总结
以上所述是小编给大家介绍的mysql一对多关联查询分页错误问题的解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19