Authored by LUOXC

Revert "fixbug"

This reverts commit a3e483be.
... ... @@ -34,13 +34,13 @@ public interface TradeBillsMapper {
List<TradeBills> selectByUidTradeStatusAndDealTime(@Param("uid") Integer uid, @Param("tradeStatus") Integer tradeStatus, @Param("dealTime") Integer dealTime);
int selectCountForAssetsDetailsView(@Param("uid") Integer uid, @Param("queryType") Integer queryType);
int selectCountForAssetsDetailsView(@Param("request") AssetsDetailsViewRequest request);
//根据用户uid ,获取流水(分页)
List<TradeBills> selectForAssetsDetailsView(@Param("uid") Integer uid, @Param("queryType") Integer queryType, @Param("start") Integer start, @Param("limit") Integer limit);
List<TradeBills> selectForAssetsDetailsView(@Param("request") AssetsDetailsViewRequest request);
//根据用户uid,获取用户总收入
List<AssetsDetailsViewIncomeAmount> selectIncomeAmountForAssetsDetailsView(@Param("uid") Integer uid);
List<AssetsDetailsViewIncomeAmount> selectIncomeAmountForAssetsDetailsView(@Param("request") AssetsDetailsViewRequest request);
}
... ...
... ... @@ -158,37 +158,35 @@
</select>
<sql id="Assets_Details_View_Query_Condition_Sql">
uid = #{uid,jdbcType=INTEGER} and income_outcome = 1 and deal_status != 1
and ((user_type =1 and trade_type = 3) or (user_type =2 and trade_type = 2) or (user_type =2 and trade_type = 3))
<if test="queryType != null">
<if test="queryType = 1">
and trade_status = 10
</if>
<if test="queryType = 2">
and trade_status != 10
</if>
</if>
</sql>
<select id="selectCountForAssetsDetailsView" resultType="java.lang.Integer" >
<sql id="Assets_Details_View_Query_Condition_Sql" >
uid = #{request.uid,jdbcType=INTEGER} and income_outcome = 1 and deal_status != 1
and ( (user_type =1 and trade_type = 3) or (user_type =2 and trade_type = 2) or (user_type =2 and trade_type = 3) )
<if test="request.queryType = 1" >
and trade_status = 10
</if>
<if test="request.queryType = 2" >
and trade_status != 10
</if>
</sql>
<select id="selectCountForAssetsDetailsView" parameterType="com.yohoufo.dal.order.model.AssetsDetailsViewRequest" resultType="java.lang.Integer" >
select
count(id)
from trade_bills
where <include refid="Assets_Details_View_Query_Condition_Sql" />
</select>
<select id="selectForAssetsDetailsView" resultMap="BaseResultMap">
<select id="selectForAssetsDetailsView" parameterType="com.yohoufo.dal.order.model.AssetsDetailsViewRequest" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from trade_bills
where <include refid="Assets_Details_View_Query_Condition_Sql" />
order by id desc
limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
limit #{request.start,jdbcType=INTEGER},#{request.limit,jdbcType=INTEGER}
</select>
<select id="selectIncomeAmountForAssetsDetailsView" resultType="com.yohoufo.dal.order.model.AssetsDetailsViewIncomeAmount">
<select id="selectIncomeAmountForAssetsDetailsView" parameterType="com.yohoufo.dal.order.model.AssetsDetailsViewRequest" resultType="com.yohoufo.dal.order.model.AssetsDetailsViewIncomeAmount">
select trade_status as tradeStatus, trade_type as tradeType ,sum(amount) as amount from trade_bills
where <include refid="Assets_Details_View_Query_Condition_Sql" />
group by trade_status, trade_type
... ...
... ... @@ -60,7 +60,7 @@ public class AssetsService {
return assetsDetailsViewCache.total(
AssetsDetailsViewRequest.builder().uid(uid).queryType(type).build(),
request -> {
int total = tradeBillsMapper.selectCountForAssetsDetailsView(request.getUid(),request.getQueryType());
int total = tradeBillsMapper.selectCountForAssetsDetailsView(request);
log.info("{} load total, with type {} result is {}", request.getUid(), request.getQueryType(), total);
return total;
});
... ... @@ -74,7 +74,7 @@ public class AssetsService {
}
List<TradeBillsBo> buildTradeBillsFromDb(AssetsDetailsViewRequest request) {
List<TradeBills> detailList = tradeBillsMapper.selectForAssetsDetailsView(request.getUid(),request.getQueryType(),request.getStart(),request.getLimit());
List<TradeBills> detailList = tradeBillsMapper.selectForAssetsDetailsView(request);
List<TradeBillsBo> rtnList = new ArrayList<>();
if (detailList.isEmpty()) {
return rtnList;
... ... @@ -118,7 +118,7 @@ public class AssetsService {
TradeBillsSummaryBo summary(int uid) {
return assetsDetailsViewCache.summary(AssetsDetailsViewRequest.builder().uid(uid).build(), request -> {
log.info("{} load summary", request.getUid());
List<AssetsDetailsViewIncomeAmount> incomeAmounts = tradeBillsMapper.selectIncomeAmountForAssetsDetailsView(request.getUid());
List<AssetsDetailsViewIncomeAmount> incomeAmounts = tradeBillsMapper.selectIncomeAmountForAssetsDetailsView(request);
log.info("{} load summary found {} items", request.getUid(), incomeAmounts.size());
BigDecimal goodsIncome = incomeAmounts.stream()
.filter(e -> TradeType.goods_income.getCode() == e.getTradeType().intValue())
... ...