<!--根据板块id查询所有主题->指标->维度--> <resultmap id="titledimensionmap" type="com.etouch.admincenter.bean.zhmddiagnosistitlebean"> <id column="title_id" property="id"/> <result column="title_name" property="titlename"/> <collection property="diagnosiskpibeanlist" oftype="com.etouch.admincenter.bean.zhmddiagnosiskpibean"> <id column="kpi_id" property="id"/> <result column="kpi_name" property="kpiname"/> <result column="kpi_type" property="kpitype"/> <result column="calculate_method" property="calculatemethod"/> <result column="is_add_description" property="isadddescription"/> <result column="descripti奥黛丽赫本简介on_remind" property="房屋平面图descriptionremind"/> <result column="input_description" property="inputdescription"/> <result column="kpi_industry_standard" property="kpiindustrystandard"/> <result column="kpi_brand_standard" property="kpibrandstandard"/> <result column="kpi_industry_standard_diff" property="kpiindustrystandarddiff"/> <result column="kpi_brand_standard_diff" property="kpibrandstandarddiff"/> <result column="input_description" property="inputdescription"/> <result column="kpi_description" property="kpidescription"/> <collection property="dimensionbeans" oftype="com.etouch.admincenter.bean.zhmddiagnosiskpidimensionbean"> <id column="kpi_dimension_id" property="id"/> <result column="diagnosis_id" property="diagnosisid"/> <result column="dimension_name" property="dimensionname"/> <result column="dimension_value" property="dimensionvalue"/> </collection> </collection> </resultmap>
可设置多个排序规则,这样展示到前端页面时,解决每次打开页面显示顺序都不一样的问题
<lect id="getdimensiononestep" resultmap="titledimensionmap"> lect zdt.id as title_id,zdt.title_name, zdk.id as kpi_id,zdk.kpi_name,zdk.kpi_type,zdk.calculate_method,zdk.is_add_description,zdk.description_remind,zdk.kpi_description, zdkd.id as kpi_dimension_id, zdkd.dimension_name,zdd.dimension_value, zdkpd.input_descr美容会所iption from zhmd_diagnosis_title zdt left join zhmd_diagnosis_kpi zdk on zdk.diagnosis_title_id = zdt.id left join zhmd_diagnosis_kpi_dimension zdkd on zdkd.diagnosis_kpi_id = zdk.id left join zhmd_dimension_diagnosis zdd on zdd.dimension_id = zdkd.id and zdd.diagnosis_id = #{diagnosisid} left join zhmd_diagnosis_kpi_problem_desc zdkpd on zdkpd.中英文简历kpi_id = zdk.id and zdkpd.diagnosis_id =#{diagnosisid半真半假打一字} where zdt.diagnosis_model_id = #{modelid} order by zdt.create_date desc,zdk.create_date desc,zdkd.dimension_sort asc</lect>
postman查询结果
在很多业务场景中,会有多排序问题,mybatis支持多排序,写法如下:
order by contract.contractcount desc, reward.rewardtotal desc, new_job.newjobcount desc
这种写法是根据最左边的字段进行第一排序,如果第一排序字段有并列的,则根据第二字段再去排一次,依次类推。
以上为个人经验,希望能给大家一个参考,也希望大家多多支持www.887551.com。
本文发布于:2023-04-04 13:50:00,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/a7cbe43f3f09476f656c1271278609b3.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:基于mybatis一对多查询内层排序的问题.doc
本文 PDF 下载地址:基于mybatis一对多查询内层排序的问题.pdf
留言与评论(共有 0 条评论) |