@@ -123,6 +123,12 @@ public interface CmBehaviorRecordMapper {
*/
List<Integer> shopIds(@Param("strList") List<String> strList);
+ /**
+ * 获取是否关联供应商
+ * @param ShopId
+ * @return
+ */
+ Integer selShopId(@Param("shopId") Integer ShopId);
/**
* 添加惯量供应商
* @param recordId 用户行为记录id
@@ -245,7 +245,10 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
}
} else {
- recordMapper.insertShopId(recordId, cmBehaviorRecordPo.getShopId());
+ Integer id = recordMapper.selShopId(cmBehaviorRecordPo.getShopId());
+ if (id != null) {
+ recordMapper.insertShopId(recordId, cmBehaviorRecordPo.getShopId());
+ }
@@ -405,6 +405,9 @@
</if>
</where>
</select>
+ <select id="selShopId" resultType="java.lang.Integer">
+ select id from cm_shop_relevance where delFlag = 0 and shopID = #{shopId}
+ </select>
<insert id="insertShopId">
insert into cm_behavior_shopId (recordID, shopID) values (#{recordId}, #{shopId})
</insert>