您好,欢迎来到榕意旅游网。
搜索
您的当前位置:首页group_concat解决mybatis一对多的分页问题

group_concat解决mybatis一对多的分页问题

来源:榕意旅游网

mybatis一对多的分页问题

将从表以group_concat的方式进行分组,再从service层进行切割处理

sql示例

 select
        t1.id,contract_no,t1.contract_name,t1.begin_date,t1.end_date,t1.sign_date,
        t1.contract_status,t1.first_party_name,t1.second_party_name,t1.is_have_water,
        t1.is_have_electric,is_have_gas,t1.cancel_rent_detail_id,
        (select group_concat(ifnull(contract_word_no," ") separator '_') from witpark_contract_word_file where
        contract_id = t1.id) as contract_word_no,
        (select group_concat(ifnull(contract_word_name," ") separator '_') from witpark_contract_word_file where
        contract_id = t1.id) AS contract_word_name,
        (select group_concat(ifnull(contract_word_url," ") separator '_') from witpark_contract_word_file where
        contract_id = t1.id) AS contract_word_url,
        (select group_concat(ifnull(real_word_url," ") separator '_') from witpark_contract_word_file where contract_id
        = t1.id) AS real_word_url
        from witpark_contract_base t1

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- nryq.cn 版权所有 赣ICP备2024042798号-6

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务