• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
漫椿
博客园    首页    新随笔    联系   管理    订阅  订阅
springMVC实现多表联查+标签属性讲解

<mapper namespace="com.imooc.o2o.dao.ShopDao">
<resultMap id="shopMap" type="com.imooc.o2o.entity.Shop">
<id column="shop_id" property="shopId"/>
<result column="shop_name" property="shopName"/>
<result column="shop_desc" property="shopDesc"/>
<result column="shop_addr" property="shopAddr"/>
<result column="phone" property="phone"/>
<result column="shop_img" property="shopImg"/>
<result column="priority" property="priority"/>
<result column="create_time" property="createTime"/>
<result column="last_edit_time" property="lastEditTime"/>
<result column="enable_status" property="enableStatus"/>
<result column="advice" property="advice"/>
<association property="area" column="area_id" javaType="com.imooc.o2o.entity.Area">
<id column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
</association>
<association property="shopCategory" column="shop_category_id" javaType="com.imooc.o2o.entity.ShopCategory">
<id column="shop_category_id" property="shopCategoryId"/>
<result column="shop_category_name" property="shopCategoryName"/>
</association>
<association property="owner" column="user_id" javaType="com.imooc.o2o.entity.PersonInfo">
<id column="user_id" property="userId"/>
<result column="name" property="name"/>
</association>
</resultMap>
<select id="QueryByShopId" resultMap="shopMap" parameterType="Long">
select
s.shop_id,
s.shop_name,
s.shop_desc,
s.shop_addr,
s.phone,
s.shop_img,
s.priority,
s.create_time,
s.last_edit_time,
s.enable_status,
s.advice,
a.area_id,
a.area_name,
sc.shop_category_id,
sc.shop_category_name
from
tb_shop s,
tb_area,
tb_shop_category sc
where
s.area_id=a.area_id
and
s.shop_category_id=sc.shop_category_id
and
s.shop_id=#{shopId}
</select>
</mapper>
posted on 2022-03-08 09:01  编程耽误的厨子  阅读(212)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3