package com.mzl.flower.mapper.customer; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.customer.QueryCustomerDTO; import com.mzl.flower.dto.response.customer.CustomerDTO; import com.mzl.flower.entity.customer.Customer; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface CustomerMapper extends BaseMapper { List queryCustomer(@Param("dto") QueryCustomerDTO dto, Page page); CustomerDTO getCurrentCustomer(@Param("userId") String userId); void bindPartner(@Param("id") Long id, @Param("partnerId")Long partnerId, @Param("userId")String userId); @Select("select count(1) from t_customer_info where level_id = #{levelId} and deleted = '0' ") Integer getByLevelId(@Param("levelId") String levelId); @Update("UPDATE t_customer_info c " + "JOIN ( " + " SELECT user_id, " + " SUM(growth) as sumgrowthvalue " + " FROM t_member_growth_record " + " WHERE deleted = '0' " + " GROUP BY user_id " + " HAVING SUM(growth) > 0 " + ") t1 ON c.user_id = t1.user_id " + "SET c.level_id = #{levelId} " + "WHERE t1.sumgrowthvalue BETWEEN #{startPoint} AND #{endPoint} ") Boolean updateMemberLevelByPoint(@Param("levelId") Long levelId, @Param("startPoint") int startPoint, @Param("endPoint") int endPoint); }