|
@@ -18,26 +18,38 @@
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="findByParams" parameterType="map" resultType="com.cloudcross.ssp.model.Finance">
|
|
<select id="findByParams" parameterType="map" resultType="com.cloudcross.ssp.model.Finance">
|
|
- select a.id as id, a.name as advertiserName, (ifnull(sum(b.allocate), 0) - ifnull(sum(b.consume), 0)) as adBalance, ifnull(sum(b.allocate), 0) as sumAllocation, max(b.act_time) as upDated from t_advertiser a left join t_adv_balance b
|
|
|
|
- on a.id = b.advertiser_id
|
|
|
|
- <if test="agentId != null">
|
|
|
|
- and a.agent_id = #{agentId}
|
|
|
|
- </if>
|
|
|
|
|
|
+ select advertiserId , advertiserName, (ifnull(sum(allocate), 0) - ifnull(sum(consume), 0)) as adBalance,
|
|
|
|
+ ifnull(sum(allocate), 0) as sumAllocation, max(actTime) as upDated from
|
|
|
|
+ (select a.agent_id as agentId,a.id as advertiserId, a.name as advertiserName, b.allocate as allocate, b.consume as consume, b.act_time
|
|
|
|
+ as actTime
|
|
|
|
+ from t_advertiser as a left join t_adv_balance as b
|
|
|
|
+ on a.id = b.advertiser_id) aa
|
|
|
|
+ where
|
|
|
|
+ <if test="agentId != null">
|
|
|
|
+ agentId = #{agentId}
|
|
|
|
+ </if>
|
|
<if test="advertiserId != null">
|
|
<if test="advertiserId != null">
|
|
- and a.id = #{advertiserId}
|
|
|
|
|
|
+ and advertiserId = #{advertiserId}
|
|
</if>
|
|
</if>
|
|
|
|
+ group by advertiserId
|
|
limit #{pager.offset}, #{pager.limit}
|
|
limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByParams1" parameterType="map" resultType="com.cloudcross.ssp.model.Finance">
|
|
<select id="findByParams1" parameterType="map" resultType="com.cloudcross.ssp.model.Finance">
|
|
- select a.id as id, a.name as advertiserName, (ifnull(sum(b.allocate), 0) - ifnull(sum(b.consume), 0)) as adBalance, ifnull(sum(b.allocate), 0) as sumAllocation, max(b.act_time) as upDated from t_adv_balance b,t_advertiser a
|
|
|
|
- where a.id = b.advertiser_id
|
|
|
|
- <if test="agentId != null">
|
|
|
|
- and a.agent_id = #{agentId}
|
|
|
|
- </if>
|
|
|
|
|
|
+ select advertiserId , advertiserName, (ifnull(sum(allocate), 0) - ifnull(sum(consume), 0)) as adBalance,
|
|
|
|
+ ifnull(sum(allocate), 0) as sumAllocation, max(actTime) as upDated from
|
|
|
|
+ (select a.agent_id as agentId,a.id as advertiserId, a.name as advertiserName, b.allocate as allocate, b.consume as consume, b.act_time
|
|
|
|
+ as actTime
|
|
|
|
+ from t_advertiser as a left join t_adv_balance as b
|
|
|
|
+ on a.id = b.advertiser_id) aa
|
|
|
|
+ where
|
|
|
|
+ <if test="agentId != null">
|
|
|
|
+ agentId = #{agentId}
|
|
|
|
+ </if>
|
|
<if test="advertiserId != null">
|
|
<if test="advertiserId != null">
|
|
- and a.id = #{advertiserId}
|
|
|
|
|
|
+ and advertiserId = #{advertiserId}
|
|
</if>
|
|
</if>
|
|
|
|
+ group by advertiserId
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="countByParams" parameterType="map" resultType="int">
|
|
<select id="countByParams" parameterType="map" resultType="int">
|