|  |  |  | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectAgentAchieveListInPage" resultType="cc.mrbird.febs.mall.vo.AdminMallAgentRecordVo"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | a.province, | 
|---|
|  |  |  | a.city, | 
|---|
|  |  |  | a.name, | 
|---|
|  |  |  | a.phone, | 
|---|
|  |  |  | d.name nickname, | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select ifnull(sum(e.amount),0) | 
|---|
|  |  |  | from mall_money_flow e | 
|---|
|  |  |  | where e.flow_type = 1 | 
|---|
|  |  |  | and e.type = 20 | 
|---|
|  |  |  | and e.member_id = a.member_id | 
|---|
|  |  |  | ) rechargeSendAmount, | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select count(b.id) | 
|---|
|  |  |  | from mall_order_info b | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | b.member_id = a.member_id | 
|---|
|  |  |  | and (b.status = 4) | 
|---|
|  |  |  | <if test="record != null" > | 
|---|
|  |  |  | <if test="record.startTime != null and record.startTime != ''"> | 
|---|
|  |  |  | and b.order_time >= #{record.startTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.endTime != null and record.endTime != ''"> | 
|---|
|  |  |  | and b.order_time <= #{record.endTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ) orderCnt, | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select ifnull(sum(c.amount),0) | 
|---|
|  |  |  | from mall_order_info c | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | c.member_id = a.member_id | 
|---|
|  |  |  | and (c.status = 4) | 
|---|
|  |  |  | <if test="record != null" > | 
|---|
|  |  |  | <if test="record.startTime != null and record.startTime != ''"> | 
|---|
|  |  |  | and c.order_time >= #{record.startTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.endTime != null and record.endTime != ''"> | 
|---|
|  |  |  | and c.order_time <= #{record.endTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ) orderAmount | 
|---|
|  |  |  | FROM mall_agent_record a | 
|---|
|  |  |  | inner join mall_member d on a.member_id = d.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="record != null" > | 
|---|
|  |  |  | <if test="record.province != null and record.province != ''"> | 
|---|
|  |  |  | and a.province = #{record.province} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.city != null and record.city != ''"> | 
|---|
|  |  |  | and a.city = #{record.city} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.name != null and record.name != ''"> | 
|---|
|  |  |  | and a.name like concat('%',  #{record.name},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.nickname != null and record.nickname != ''"> | 
|---|
|  |  |  | and d.name like concat('%',  #{record.nickname},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY orderAmount desc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectAgentAddressProvince" resultType="cc.mrbird.febs.mall.vo.AdminMallAgentRecordVo"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | a.province | 
|---|
|  |  |  | FROM mall_agent_record a | 
|---|
|  |  |  | group by a.province | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectAgentAddressCity" resultType="java.lang.String"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | a.city | 
|---|
|  |  |  | FROM mall_agent_record a | 
|---|
|  |  |  | where a.province = #{province} | 
|---|
|  |  |  | group by a.city | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|