|
@@ -45,8 +45,8 @@
|
|
|
<result property="productBidPrice" column="product_bid_price"/>
|
|
|
</collection>
|
|
|
<collection property="productTypes" javaType="list" ofType="com.example.entity.ProductType">
|
|
|
- <id property="id" column="productId"/>
|
|
|
- <result property="productTypeName" column="productTypeName"/>
|
|
|
+ <!-- 这里使用 productTypeName 作为 id -->
|
|
|
+ <id property="productTypeName" column="productTypeName"/>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
|
|
@@ -67,23 +67,38 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectAll" resultMap="storeWithType">
|
|
|
- select
|
|
|
- store.*, product.*,address.*,adminstore.*,
|
|
|
- adminstore.id as adminstoreId ,
|
|
|
- address.id as addressId,
|
|
|
- product.id as productId,
|
|
|
- product_type.id as productId, product_type.product_type_name as productTypeName
|
|
|
- from store
|
|
|
- left join product_type on JSON_CONTAINS(store.product_type_ids,CAST(product_type.id as JSON),'$')
|
|
|
- left join product on JSON_CONTAINS(store.products_ids,CAST(product.id as JSON),'$')
|
|
|
- left join address on address.id = store.address_id
|
|
|
- left join adminstore on adminstore.id = store.owner_id
|
|
|
- <where>
|
|
|
- <if test="id!=null" >and store.id = #{id}</if>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
+<!-- <select id="selectAll" resultMap="storeWithType">-->
|
|
|
+<!-- select-->
|
|
|
+<!-- store.*, product.*,address.*,adminstore.*,-->
|
|
|
+<!-- adminstore.id as adminstoreId ,-->
|
|
|
+<!-- address.id as addressId,-->
|
|
|
+<!-- product.id as productId,-->
|
|
|
+<!-- product_type.id as productId, product_type.product_type_name as productTypeName-->
|
|
|
+<!-- from store-->
|
|
|
+<!-- left join product_type on JSON_CONTAINS(store.product_type_ids,CAST(product_type.id as JSON),'$')-->
|
|
|
+<!-- left join product on JSON_CONTAINS(store.products_ids,CAST(product.id as JSON),'$')-->
|
|
|
+<!-- left join address on address.id = store.address_id-->
|
|
|
+<!-- left join adminstore on adminstore.id = store.owner_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="id!=null" >and store.id = #{id}</if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- </select>-->
|
|
|
+ <select id="selectAll" resultMap="storeWithType">
|
|
|
+ select
|
|
|
+ store.*, product.*,address.*,adminstore.*,
|
|
|
+ adminstore.id as adminstoreId ,
|
|
|
+ address.id as addressId,
|
|
|
+ product.id as productId,
|
|
|
+ product_type.id as productId, product_type.product_type_name as productTypeName
|
|
|
+ from store
|
|
|
+ left join product_type on JSON_CONTAINS(store.product_type_ids,CAST(product_type.id as JSON),'$')
|
|
|
+ left join product on JSON_CONTAINS(store.products_ids,CAST(product.id as JSON),'$')
|
|
|
+ left join address on address.id = store.address_id
|
|
|
+ left join adminstore on adminstore.id = store.owner_id
|
|
|
+ <where>
|
|
|
+ <if test="id!=null" >and store.id = #{id}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
<select id="selectById" resultMap="storeWithType">
|