|
@@ -3,8 +3,11 @@ package com.citu.module.menduner.reward.dal.mysql.config;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.framework.mybatis.core.mapper.BaseMapperX;
|
|
|
import com.citu.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
+import com.citu.framework.mybatis.core.query.MPJLambdaWrapperX;
|
|
|
import com.citu.module.menduner.reward.controller.base.config.PointRuleConfigPageReqVO;
|
|
|
+import com.citu.module.menduner.reward.controller.base.config.TaskRespVO;
|
|
|
import com.citu.module.menduner.reward.dal.dataobject.config.PointRuleConfigDO;
|
|
|
+import com.citu.module.menduner.reward.dal.dataobject.event.EventRecordDO;
|
|
|
import com.citu.module.menduner.reward.enums.config.PointRuleConfigStatusEnum;
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
|
|
|
@@ -22,6 +25,8 @@ public interface PointRuleConfigMapper extends BaseMapperX<PointRuleConfigDO> {
|
|
|
return selectPage(reqVO, new LambdaQueryWrapperX<PointRuleConfigDO>()
|
|
|
.likeIfPresent(PointRuleConfigDO::getUrl, reqVO.getUrl())
|
|
|
.eqIfPresent(PointRuleConfigDO::getType, reqVO.getType())
|
|
|
+ .eqIfPresent(PointRuleConfigDO::getTriggerType, reqVO.getTriggerType())
|
|
|
+ .likeIfPresent(PointRuleConfigDO::getMark, reqVO.getMark())
|
|
|
.likeIfPresent(PointRuleConfigDO::getTitle, reqVO.getTitle())
|
|
|
.eqIfPresent(PointRuleConfigDO::getOperation, reqVO.getOperation())
|
|
|
.eqIfPresent(PointRuleConfigDO::getStatus, reqVO.getStatus())
|
|
@@ -43,7 +48,7 @@ public interface PointRuleConfigMapper extends BaseMapperX<PointRuleConfigDO> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- default PointRuleConfigDO existByUrl(String url,Long id) {
|
|
|
+ default PointRuleConfigDO existByUrl(String url, Long id) {
|
|
|
return selectOne(new LambdaQueryWrapperX<PointRuleConfigDO>()
|
|
|
.eq(PointRuleConfigDO::getUrl, url)
|
|
|
.neIfPresent(PointRuleConfigDO::getId, id)
|
|
@@ -58,5 +63,39 @@ public interface PointRuleConfigMapper extends BaseMapperX<PointRuleConfigDO> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询任务
|
|
|
+ *
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param type 事件类型
|
|
|
+ * @param mark 标记
|
|
|
+ */
|
|
|
+ default List<TaskRespVO> selectTask(Long userId, String type,String mark) {
|
|
|
+ MPJLambdaWrapperX<PointRuleConfigDO> query = new MPJLambdaWrapperX<>();
|
|
|
+ query.selectAs(PointRuleConfigDO::getTitle, TaskRespVO::getTitle);
|
|
|
+ query.selectAs(PointRuleConfigDO::getUrl, TaskRespVO::getUrl);
|
|
|
+ query.selectAs(PointRuleConfigDO::getPoint, TaskRespVO::getPoint);
|
|
|
+ query.selectAs(PointRuleConfigDO::getSort, TaskRespVO::getSort);
|
|
|
+ query.selectAs(PointRuleConfigDO::getOperation, TaskRespVO::getOperation);
|
|
|
+ // 总数
|
|
|
+// query.selectFunc(" COALESCE(SUM(%s), 0)", arg -> arg.accept(EventRecordDO::getCount),"totalCount");
|
|
|
+ query.selectFunc("CASE WHEN COALESCE(SUM(%s), 0) > 0 THEN TRUE ELSE FALSE END",
|
|
|
+ arg -> arg.accept(EventRecordDO::getCount), TaskRespVO::isComplete);
|
|
|
+
|
|
|
+ query.leftJoin(EventRecordDO.class, on -> on
|
|
|
+ .eq(EventRecordDO::getUrl, PointRuleConfigDO::getUrl)
|
|
|
+ .eq(EventRecordDO::getUserId, userId)
|
|
|
+ );
|
|
|
+
|
|
|
+ // 增加条件
|
|
|
+ query.eq(PointRuleConfigDO::getStatus, PointRuleConfigStatusEnum.ENABLE.getStatus());
|
|
|
+ query.eq(PointRuleConfigDO::getType, type);
|
|
|
+ query.eqIfPresent(PointRuleConfigDO::getMark, mark);
|
|
|
+
|
|
|
+ query.orderByAsc(PointRuleConfigDO::getSort);
|
|
|
+ query.groupBy(PointRuleConfigDO::getId);
|
|
|
+
|
|
|
+ return selectJoinList(TaskRespVO.class, query);
|
|
|
+ }
|
|
|
|
|
|
}
|