Commit 00c2fbeb authored by zhangfeng's avatar zhangfeng

feat(member): 分享统计详情单独页面

parent 9e4fb7dd
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailReqVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordPageVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordQueryVO;
......@@ -22,9 +23,9 @@ public interface ScoreRuleShareRecordMapper extends AbstractMapper<ScoreRuleShar
int countScoreRuleShareRecord(@Param("query") ScoreRuleShareRecordQueryVO query);
List<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(@Param("start") int start, @Param("size") int size, @Param("id") Long id);
List<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(@Param("start") int start, @Param("size") int size, @Param("query") ScoreRuleShareRecordDetailReqVO query);
int countScoreRuleShareRecordDetail(@Param("id") Long id);
int countScoreRuleShareRecordDetail(@Param("query") ScoreRuleShareRecordDetailReqVO query);
String getCurrentMaxShareRecordCode();
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
public PageResult<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(ScoreRuleShareRecordDetailReqVO reqVO) {
int size = reqVO.getRows();
int start = (reqVO.getPage() - 1) * size;
List<ScoreRuleShareRecordDetailVO> list = scoreRuleShareRecordMapper.getRuleShareRecordDetail(start, size, reqVO.getId());
List<ScoreRuleShareRecordDetailVO> list = scoreRuleShareRecordMapper.getRuleShareRecordDetail(start, size, reqVO);
if (list.isEmpty()) {
return PageResult.empty();
}
......@@ -59,7 +59,7 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
item.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabel());
item.setTypeEn(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabelEn());
});
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecordDetail(reqVO.getId());
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecordDetail(reqVO);
return new PageResult<>(list, total, size, reqVO.getPage(), (total + size - 1) / size);
}
......
package cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
@Data
@ApiModel("管理后台 - 分享记录详情查询 VO")
public class ScoreRuleShareRecordDetailReqVO extends PageVO {
@EqualsAndHashCode(callSuper = true)
public class ScoreRuleShareRecordDetailReqVO extends ScoreRuleShareRecordQueryVO {
@ApiModelProperty(value = "分享记录id")
@NotNull(message = "分享记录id不能为空")
private Long id;
}
......@@ -50,7 +50,11 @@
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0 AND srsr.id = #{id}
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
order by srsr.create_time desc
limit #{start}, #{size}
</select>
......@@ -60,7 +64,13 @@
FROM
member_user_score_log msul
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
where srsr.deleted = 0 AND srsr.id = #{id}
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
</select>
<select id="getCurrentMaxShareRecordCode" resultType="java.lang.String">
SELECT code FROM score_rule_share_record ORDER BY code desc LIMIT 1
......@@ -94,4 +104,33 @@
</if>
</if>
</sql>
<sql id="shareRecordDetailCondition">
<if test="query.memberName != null and query.memberName != ''">
AND mu.nickname = #{query.memberName}
</if>
<if test="query.type != null">
AND sr.type = #{query.type}
</if>
<if test="query.title != null and query.title != ''">
AND ( sr.title_zh LIKE concat('%', #{query.title}, '%') OR sr.title_en LIKE concat('%', #{query.title}, '%') )
</if>
<if test="query.code != null and query.code != ''">
AND srsr.code = #{query.code}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null">
AND ( srsr.create_time BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime} )
</if>
<if test="query.relationSymbol != null and query.totalScore != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.relationSymbol == 1">
AND sr.get_score_once &gt; #{query.totalScore}
</if>
<if test="query.relationSymbol == 2">
AND sr.get_score_once = #{query.totalScore}
</if>
<if test="query.relationSymbol == 3">
AND sr.get_score_once &lt; #{query.totalScore}
</if>
</if>
</sql>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment