Commit 29b82810 by 章家宝

feat:客户画像表建档前先将现有的删除掉

1 parent 4fd0b4ca
......@@ -24,4 +24,13 @@ public interface CustomerTagProfileMapper extends OreMapper<CustomerTagProfile>
* @return 客户画像列表
*/
List<CustomerTagProfile> selectByPhoneList(@Param("phoneList") List<String> phoneList);
/**
* 根据手机号和类别代码物理删除记录
*
* @param phone 手机号
* @param categoryCode 类别代码
* @return 删除数量
*/
int deleteByPhoneAndCategoryCode(@Param("phone") String phone, @Param("categoryCode") String categoryCode);
}
......@@ -81,6 +81,9 @@ public class CustomerTagProfileService {
profile.setSourceRefId(String.valueOf(carSeriesId));
profile.setDeletedFlag("N");
// 先删除该用户已有的建档标签(物理删除)
customerTagProfileMapper.deleteByPhoneAndCategoryCode(phone, CATEGORY_CODE_INIT);
// 保存到数据库
customerTagProfileMapper.insertSelective(profile);
log.info("建档生成客户画像完成:phone={}, tagEnum={}, avgPrice={}", phone, tagEnum.getEnumCode(), avgPrice);
......
......@@ -33,4 +33,11 @@
</foreach>
</select>
<!-- 根据手机号和类别代码物理删除记录 -->
<delete id="deleteByPhoneAndCategoryCode">
DELETE FROM dj_car_life_customer_tag_profile
WHERE phone = #{phone}
AND category_code = #{categoryCode}
</delete>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!