</collection>
<collection property="deviceImgs" column="id" select="getDeviceImg" ofType="com.iotmars.entity.DeviceImg"
javaType="java.util.List">
</collection>
</resultMap>
<!-- 查询菜谱烹饪步骤-->
<select id="getCookStep" resultType="com.iotmars.entity.CookStep">
select *
from cook_steps cs
where cs.menu_id = #{menuId}
</select>
<!-- 菜谱多设备-->
<select id="getDeviceImg" resultType="com.iotmars.entity.DeviceImg">
select *
from device_img di
where di.menu_id = #{menuId}
</select>
<!-- 主查询-->
<select id="findCheckMenuListByName" resultMap="MenuMap">
SELECT *
FROM menu m
WHERE (m.publish_status = 1 OR m.publish_status = 2)
<if test="name != null and name != '' ">
and m.name LIKE concat(
'%', #{name}, '%')
</if>
</select>
<select id="findMenuDraftsListByName" resultMap="MenuMap">
SELECT *
FROM menu m
WHERE m.publish_status = 0
<if test="name != null and name != '' ">
and m.name LIKE concat(
'%', #{name}, '%')
</if>
</select>
<select id="findMenuDetail" resultMap="MenuMap">
SELECT *
FROM menu m
LEFT JOIN cook_steps cs ON m.id = cs.menu_id
LEFT JOIN device_img di ON m.id = di.menu_id
WHERE m.id = #{menuId}
and m.publish_status = 2
</select>
mybatis plus 一对多分页查询
猜你喜欢
转载自blog.csdn.net/qq_43054241/article/details/106192917
今日推荐
周排行