需求:查出三表中特定分类下,特定数据分别有多少个,返回一个Long类型的数字
查询主页规定的5大分类下,配方,产品,规范各有多少条
mybatis中resulttype如下定义即可
xml中返回一个map集合
SELECT '行业规范' as type,count(1) as sum FROM `t_biz_industry_spec` where type_id = #{typeId} union all SELECt '产品' as type, count(1) as sum FROM `t_biz_products` where type_id = #{typeId} union all SELECt '配方' as type, count(1) as sum FROM `t_biz_recipe_main` where type_id = #{typeId}
SQL的查询结果是这样的
type列是key,sum列是value
mapper层
List
直接给传一个typeId(5大分类)就可以获取相应的数据



