xiaoyong931011
2021-04-12 a13a93a493e7e94e28b2225c26e7e13b52d3288c
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
@@ -42,6 +42,10 @@
        <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>
@@ -80,6 +84,9 @@
        <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">
@@ -113,7 +120,11 @@
         is_service,
         service_time,
         shop_ids,
         company_id
         company_id,
        able_score_pay,
        able_sales,
        score_category_id
   </sql>
    <!-- 属性sql -->
@@ -148,7 +159,11 @@
         #{item.isService},
         #{item.serviceTime},
         #{item.shopIds},
         #{item.companyId}
         #{item.companyId},
         #{item.ableScorePay},
         #{item.ableSales},
         #{item.scoreCategoryId}
   </sql>
    <!-- where sql -->
    <sql id="where_sql">
@@ -237,6 +252,15 @@
                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>
@@ -311,6 +335,17 @@
                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>
@@ -418,6 +453,16 @@
            <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}
@@ -500,6 +545,15 @@
                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}
@@ -588,6 +642,9 @@
      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
@@ -628,6 +685,9 @@
      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}
@@ -665,6 +725,9 @@
        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
@@ -730,6 +793,9 @@
        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
@@ -771,6 +837,18 @@
            <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">
@@ -828,6 +906,9 @@
         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
@@ -846,6 +927,16 @@
        </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">