|  |  |  | 
|---|
|  |  |  | <result property="couponId" column="couponId"></result> | 
|---|
|  |  |  | <result property="serviceTime" column="service_time"></result> | 
|---|
|  |  |  | <result property="companyId" column="company_id"/> | 
|---|
|  |  |  | <result property="ableScorePay" column="able_score_pay"/> | 
|---|
|  |  |  | <result property="ableSales" column="able_sales"/> | 
|---|
|  |  |  | <result property="scoreCategoryId" column="score_category_id"/> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <association property="shopCoupon" select="com.matrix.system.shopXcx.dao.ShopCouponDao.selectById" | 
|---|
|  |  |  | column="{id=couponId}"></association> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | 
|---|
|  |  |  | <result property="couponId" column="couponId"></result> | 
|---|
|  |  |  | <result property="serviceTime" column="service_time"></result> | 
|---|
|  |  |  | <result property="companyId" column="company_id"/> | 
|---|
|  |  |  | <result property="ableScorePay" column="able_score_pay"/> | 
|---|
|  |  |  | <result property="ableSales" column="able_sales"/> | 
|---|
|  |  |  | <result property="scoreCategoryId" column="score_category_id"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="columns"> | 
|---|
|  |  |  | 
|---|
|  |  |  | is_service, | 
|---|
|  |  |  | service_time, | 
|---|
|  |  |  | shop_ids, | 
|---|
|  |  |  | company_id | 
|---|
|  |  |  | company_id, | 
|---|
|  |  |  | able_score_pay, | 
|---|
|  |  |  | able_sales, | 
|---|
|  |  |  | score_category_id | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 属性sql --> | 
|---|
|  |  |  | 
|---|
|  |  |  | #{item.isService}, | 
|---|
|  |  |  | #{item.serviceTime}, | 
|---|
|  |  |  | #{item.shopIds}, | 
|---|
|  |  |  | #{item.companyId} | 
|---|
|  |  |  | #{item.companyId}, | 
|---|
|  |  |  | #{item.ableScorePay}, | 
|---|
|  |  |  | #{item.ableSales}, | 
|---|
|  |  |  | #{item.scoreCategoryId} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <!-- where sql --> | 
|---|
|  |  |  | <sql id="where_sql"> | 
|---|
|  |  |  | 
|---|
|  |  |  | and a.company_id = #{record.companyId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="record.ableScorePay != null and record.ableScorePay !='' "> | 
|---|
|  |  |  | and a.able_score_pay = #{record.ableScorePay} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.ableSales != null and record.ableSales !='' "> | 
|---|
|  |  |  | and a.able_sales = #{record.ableSales} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.scoreCategoryId != null and record.scoreCategoryId "> | 
|---|
|  |  |  | and a.score_category_id = #{record.scoreCategoryId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | and b.attr_full_path like concat('%/',#{record.attrs},'/%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="record.ableScorePay != null and record.ableScorePay !='' "> | 
|---|
|  |  |  | and a.able_score_pay = #{record.ableScorePay} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.ableSales != null and record.ableSales !='' "> | 
|---|
|  |  |  | and a.able_sales = #{record.ableSales} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.scoreCategoryId != null and record.scoreCategoryId "> | 
|---|
|  |  |  | and a.score_category_id = #{record.scoreCategoryId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="_parameter.containsKey('companyId')"> | 
|---|
|  |  |  | company_id = #{companyId}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="_parameter.containsKey('scoreCategoryId')"> | 
|---|
|  |  |  | score_category_id = #{scoreCategoryId}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="_parameter.containsKey('ableSales')"> | 
|---|
|  |  |  | able_sales = #{ableSales}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="_parameter.containsKey('ableScorePay')"> | 
|---|
|  |  |  | able_score_pay = #{ableScorePay}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | WHERE id=#{id} | 
|---|
|  |  |  | 
|---|
|  |  |  | shop_ids = #{record.shopIds}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="record.ableScorePay != null and record.ableScorePay !='' "> | 
|---|
|  |  |  | able_score_pay = #{record.ableScorePay}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.ableSales != null and record.ableSales !='' "> | 
|---|
|  |  |  | able_sales = #{record.ableSales}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.scoreCategoryId != null and record.scoreCategoryId "> | 
|---|
|  |  |  | score_category_id = #{record.scoreCategoryId}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | WHERE id=#{record.id} | 
|---|
|  |  |  | 
|---|
|  |  |  | a.marked_price, | 
|---|
|  |  |  | b.attr_full_path, | 
|---|
|  |  |  | a.couponId, | 
|---|
|  |  |  | a.able_score_pay, | 
|---|
|  |  |  | a.able_sales, | 
|---|
|  |  |  | a.score_category_id, | 
|---|
|  |  |  | (SELECT ROUND(SUM(ss.stock),2) from shop_sku  ss where ss.p_id = a.id) as stockNum, | 
|---|
|  |  |  | GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid | 
|---|
|  |  |  | from shop_product a left join shop_product_attr_ref b on a.id = b.p_id | 
|---|
|  |  |  | 
|---|
|  |  |  | a.marked_price, | 
|---|
|  |  |  | a.service_time, | 
|---|
|  |  |  | a.couponId, | 
|---|
|  |  |  | a.able_score_pay, | 
|---|
|  |  |  | a.able_sales, | 
|---|
|  |  |  | a.score_category_id, | 
|---|
|  |  |  | (SELECT ROUND(SUM(ss.stock),2) from shop_sku  ss where ss.p_id = a.id) as stockNum | 
|---|
|  |  |  | from shop_product a | 
|---|
|  |  |  | where  a.id in (${productIds}) and shop_ids=#{shopId} | 
|---|
|  |  |  | 
|---|
|  |  |  | a.marked_price, | 
|---|
|  |  |  | b.attr_full_path, | 
|---|
|  |  |  | a.couponId, | 
|---|
|  |  |  | a.able_score_pay, | 
|---|
|  |  |  | a.able_sales, | 
|---|
|  |  |  | a.score_category_id, | 
|---|
|  |  |  | a.service_time, | 
|---|
|  |  |  | (SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum, | 
|---|
|  |  |  | GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid | 
|---|
|  |  |  | 
|---|
|  |  |  | b.attr_full_path, | 
|---|
|  |  |  | a.service_time, | 
|---|
|  |  |  | a.couponId, | 
|---|
|  |  |  | a.able_score_pay, | 
|---|
|  |  |  | a.able_sales, | 
|---|
|  |  |  | a.score_category_id, | 
|---|
|  |  |  | (SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum, | 
|---|
|  |  |  | (SELECT COUNT(p.com_id) from shop_product_comment p where p.product_id=a.id and p.del_flag=2 and p.com_audit_status=1 and p.com_score=5) as comment | 
|---|
|  |  |  | from shop_product a | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="(record.shopIds!=null and record.shopIds!='') or  (record.shopIds!='' and record.shopIds==0)  "> | 
|---|
|  |  |  | and find_in_set(#{record.shopIds}, a.shop_ids) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="record.ableScorePay != null and record.ableScorePay !='' "> | 
|---|
|  |  |  | and a.able_score_pay = #{record.ableScorePay} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.ableSales != null and record.ableSales !='' "> | 
|---|
|  |  |  | and a.able_sales = #{record.ableSales} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.scoreCategoryId != null and record.scoreCategoryId "> | 
|---|
|  |  |  | and a.score_category_id = #{record.scoreCategoryId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | GROUP BY a.id | 
|---|
|  |  |  | <if test="record.queryType != null and record.queryType == 1"> | 
|---|
|  |  |  | 
|---|
|  |  |  | is_special_price, | 
|---|
|  |  |  | marked_price, | 
|---|
|  |  |  | couponId, | 
|---|
|  |  |  | a.able_score_pay, | 
|---|
|  |  |  | a.able_sales, | 
|---|
|  |  |  | a.score_category_id, | 
|---|
|  |  |  | (SELECT SUM(s.stock) from shop_sku  s where s.p_id = a.id) as stockNum, | 
|---|
|  |  |  | (SELECT ROUND(SUM(s.stock),2) from shop_sku  s where s.p_id = a.id) as stockNum, | 
|---|
|  |  |  | shop_ids | 
|---|
|  |  |  | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectProductNameByIds" resultType="java.lang.String"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | title | 
|---|
|  |  |  | from shop_product | 
|---|
|  |  |  | where id in | 
|---|
|  |  |  | <foreach collection="ids" item="item" separator="," open="(" close=")"> | 
|---|
|  |  |  | #{item} | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 根据id 锁表查询--> | 
|---|
|  |  |  | <select id="selectForUpdate" resultMap="ShopProductMap"> | 
|---|