例子店铺表和店铺图片表是一对多的关系
店铺对应实体:
public class StoreVo implements Serializable {
private static final long serialVersionUID = 1L;
//
private Long id;
//会员id
private Long userId;
//主体类型 1.个人 2.个体工商户
private Integer registrationType;
//店铺名称
private String storeName;
//店铺地址
private String storeAddress;
//工商注册号
private String registrationNo;
//营业执照
private String registrationImgUrl;
//主营产品
private String storeProduct;
//负责人
private String principalName;
//联系电话
private String telNumber;
//认证状态:1.已认证 0未认证 2已驳回
private Integer authStatus;
//创建时间
private Date createDate;
//店铺图片列表
private List<StoreImgVo> storeImgVos;
}
店铺图片实体:
public class StoreImgVo implements Serializable {
private static final long serialVersionUID = 1L;
//
private Long id;
//店铺Id
private Long storeId;
//店铺图片
private String storeImgUrl;
}
店铺
<resultMap type=\"com.snserver.entity.StoreVo\" id=\"storeMap\">
<result property=\"id\" column=\"id\"/>
<result property=\"userId\" column=\"user_id\"/>
<result property=\"registrationType\" column=\"registration_type\"/>
<result property=\"storeName\" column=\"store_name\"/>
<result property=\"storeAddress\" column=\"store_address\"/>
<result property=\"registrationNo\" column=\"registration_no\"/>
<result property=\"registrationImgUrl\" column=\"registration_img_url\"/>
<result property=\"storeProduct\" column=\"store_product\"/>
<result property=\"principalName\" column=\"principal_name\"/>
<result property=\"telNumber\" column=\"tel_number\"/>
<result property=\"authStatus\" column=\"auth_status\"/>
<result property=\"createDate\" column=\"create_date\"/>
</resultMap>
<resultMap type=\"com.snserver.entity.StoreVo\" id=\"stortImgMap\"
extends=\"storeMap\">
<collection property=\"storeImgVos\" ofType=\"com.snserver.entity.StoreImgVo\">
<id property=\"id\" column=\"sid\" />
<result property=\"storeId\" column=\"storeId\" />
<result property=\"storeImgUrl\" column=\"storeImgUrl\"/>
</collection>
</resultMap>
<select id=\"queryUserId\" resultMap=\"stortImgMap\">
select
a.`id`,
a.`user_id`,
a.`registration_type`,
a.`store_name`,
a.`store_address`,
a.`registration_no`,
a.`registration_img_url`,
a.`store_product`,
a.`principal_name`,
a.`tel_number`,
a.`auth_status`,
a.`create_date`,
b.`id` as sid,
b.`store_id` as storeId,
b.`store_img_url` as storeImgUrl
from tbl_store as a left join tbl_store_img as b on a.id = b.store_id
where user_id = #{userId}
</select>
</mapper>
继续阅读与本文标签相同的文章
上一篇 :
如何找到实惠又好用的物业收费软件?
-
一年一度的硬核科技盛会——杭州云栖大会就要来了! | 开发者必读(059期)
2026-05-18栏目: 教程
-
在QQ空间保存着的明明很清楚照片放时间长了为何会变模糊?
2026-05-18栏目: 教程
-
吹爆这五款APP,每一款手机必备,不知道蛮可惜的
2026-05-18栏目: 教程
-
报销内容大同小异,可以直接套用模板数据吗?
2026-05-18栏目: 教程
-
美国男性机器人诞生,满足用户“硬需”,96%的女性用户都满意
2026-05-18栏目: 教程
