package com.hai.dao; import com.hai.entity.HighCouponAgentCode; import com.hai.model.AgentSalesModel; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.type.JdbcType; import java.util.List; /** * mapper扩展类 */ public interface HighCouponAgentRelMapperExt { @Select(" select case when sum(1) is not null then sum(1) else 0 end count," + " case when sum(c.sales_price) is not null then sum(c.sales_price) else 0 end salesCountPrice " + " from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c" + " where c.id = a.coupon_agent_id and c.agent_id = #{agentId}" + " and a.status = 3 and a.coupon_code_id = b.id and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE}") AgentSalesModel getAgentSales(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE); @Select(" select a.* from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c " + " where c.id = a.coupon_agent_id and c.agent_id = #{agentId} and a.status = 3 and a.coupon_code_id = b.id " + " and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE} ORDER BY b.consume_time desc") @Results({ @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) }) List getAgentSalesCodeList(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE); @Select(" select count(1) from high_coupon_agent_code a where a.agent_id = #{agentId} and a.`status` in (${status}) and a.type = #{type} ") Integer getAgentCodeCount(@Param("agentId") Long agentId,@Param("status") String status,@Param("type") Integer type); }