|
|
@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="emailAllowedFlag" column="email_allowed_flag"/>
|
|
|
<result property="lastPurchaseMonth" column="last_purchase_month"/>
|
|
|
<result property="fcBrandCode" column="fc_brand_code"/>
|
|
|
+ <result property="brandCode" column="brand_code"/>
|
|
|
<result property="fcBrandName" column="fc_brand_name"/>
|
|
|
<result property="businessTypeCode" column="business_type_code"/>
|
|
|
<result property="businessTypeName" column="business_type_name" />
|
|
|
@@ -36,6 +37,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="memberLevel" column="member_level"/>
|
|
|
<result property="email" column="email"/>
|
|
|
<result property="gender" column="gender"/>
|
|
|
+ <result property="purchaseProductName" column="purchase_product_name"/>
|
|
|
+ <result property="purchaseMonth" column="purchase_month"/>
|
|
|
+ <result property="purchaseCost" column="purchase_cost"/>
|
|
|
+ <result property="purchaseQuantity" column="purchase_quantity"/>
|
|
|
+ <result property="purchaseAmount" column="purchase_amount"/>
|
|
|
+ <result property="validPurchaseFlag" column="valid_purchase_flag"/>
|
|
|
+ <result property="validPurchaseFlagName" column="valid_purchase_flag_name"/>
|
|
|
</resultMap>
|
|
|
<sql id="selectYmdfCustomerListVo">
|
|
|
SELECT
|
|
|
@@ -44,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.customer_name_kana AS customer_name_kana,
|
|
|
s.store_name AS store_name,
|
|
|
s.store_code AS store_code,
|
|
|
+ s.brand_code AS brand_code,
|
|
|
-- ブランド辞書テーブルを結合してブランド名を取得
|
|
|
fc_dict.dict_label AS brand_name,
|
|
|
c.prefecture AS prefecture,
|
|
|
@@ -249,10 +258,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="storeCode != null and storeCode != ''">
|
|
|
AND t.store_code = #{storeCode}
|
|
|
</if>
|
|
|
- <if test="brandNames != null and brandNames != ''">
|
|
|
- AND t.brand_name IN
|
|
|
- <foreach collection="brandNames" item="brandName" open="(" separator="," close=")">
|
|
|
- #{brandName}
|
|
|
+ <if test="brandCodes != null and brandCodes != ''">
|
|
|
+ AND t.brand_code IN
|
|
|
+ <foreach collection="brandCodes" item="brandCode" open="(" separator="," close=")">
|
|
|
+ #{brandCode}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</where>
|
|
|
@@ -300,4 +309,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c.del_flag = 0
|
|
|
AND c.customer_id = #{customerId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectYmdfCustomerHistoryList" parameterType="YmdfCustomer" resultMap="YmdfCustomerResult">
|
|
|
+ SELECT
|
|
|
+ cph.purchase_product_name AS purchase_product_name,
|
|
|
+ cph.purchase_month AS purchase_month,
|
|
|
+ cph.purchase_cost AS purchase_cost,
|
|
|
+ s.store_name AS store_name,
|
|
|
+ fc_dict.dict_label AS brand_name,
|
|
|
+ cph.purchase_quantity AS purchase_quantity,
|
|
|
+ cph.purchase_amount AS purchase_amount,
|
|
|
+ cph.valid_purchase_flag AS valid_purchase_flag,
|
|
|
+ flag_dict.dict_label AS valid_purchase_flag_name,
|
|
|
+ c.customer_name AS customer_name,
|
|
|
+ c.customer_name_kana AS customer_name_kana
|
|
|
+ FROM
|
|
|
+ ymdf_customer c
|
|
|
+ INNER JOIN ymdf_customer_purchase_history cph
|
|
|
+ ON c.customer_id = cph.customer_id
|
|
|
+ AND cph.del_flag = 0
|
|
|
+ INNER JOIN ymdf_fc_store s
|
|
|
+ ON cph.fc_store_id = s.fc_store_id
|
|
|
+ AND s.del_flag = 0
|
|
|
+ LEFT JOIN sys_dict_data fc_dict
|
|
|
+ ON s.brand_code = fc_dict.dict_value
|
|
|
+ AND fc_dict.dict_type = 'yamada_fc_brand'
|
|
|
+ LEFT JOIN sys_dict_data flag_dict
|
|
|
+ ON cph.valid_purchase_flag = flag_dict.dict_value
|
|
|
+ AND flag_dict.dict_type = 'valid_purchase_flag'
|
|
|
+ WHERE
|
|
|
+ c.del_flag = 0
|
|
|
+ AND cph.customer_id = #{customerId}
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ AND c.customer_name LIKE CONCAT('%', #{customerName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="customerNameKana != null and customerNameKana != ''">
|
|
|
+ AND c.customer_name_kana LIKE CONCAT('%', #{customerNameKana}, '%')
|
|
|
+ </if>
|
|
|
+ ORDER BY
|
|
|
+ cph.purchase_month DESC
|
|
|
+ </select>
|
|
|
</mapper>
|