@@ -1,13 +1,11 @@ | |||
package com.tuoheng.api.controller; | |||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||
import com.tuoheng.api.service.IWestreamActivityApplyService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 全民护河志愿者活动 前端控制器 | |||
@@ -33,4 +31,16 @@ public class WestreamActivityApplyController { | |||
public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ | |||
return westreamActivityApplyService.submit(westreamActivityApply); | |||
} | |||
/** | |||
* 查询活动申请 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getApply") | |||
public JsonResult getApply(WestreamActivityQuery query) { | |||
return westreamActivityApplyService.getApply(query); | |||
} | |||
} | |||
@@ -19,4 +19,14 @@ public class WestreamActivityQuery extends BaseQuery { | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 活动id | |||
*/ | |||
private Integer activityId; | |||
/** | |||
* openid | |||
*/ | |||
private String openid; | |||
} |
@@ -1,10 +1,13 @@ | |||
package com.tuoheng.api.service; | |||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
public interface IWestreamActivityApplyService extends IBaseService<WestreamActivityApply> { | |||
JsonResult submit(WestreamActivityApply westreamActivityApply); | |||
JsonResult getApply(WestreamActivityQuery query); | |||
} |
@@ -2,6 +2,7 @@ package com.tuoheng.api.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||
import com.tuoheng.api.mapper.WestreamActivityApplyMapper; | |||
import com.tuoheng.api.service.IWestreamActivityApplyService; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
@@ -40,4 +41,24 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpl<WestreamAc | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getApply(WestreamActivityQuery query) { | |||
if (null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())) { | |||
return JsonResult.error("参数为空!"); | |||
} | |||
if (null == query.getActivityId()) { | |||
return JsonResult.error("活动ID为空!"); | |||
} | |||
WestreamActivityApply westreamActivityApply = westreamActivityApplyMapper.selectOne(new LambdaQueryWrapper<WestreamActivityApply>() | |||
.eq(WestreamActivityApply::getActivityId, query.getActivityId()) | |||
.eq(WestreamActivityApply::getTenantId, query.getTenantId()) | |||
.eq(WestreamActivityApply::getOpenid, query.getOpenid()) | |||
.eq(WestreamActivityApply::getMark, 1) | |||
.orderByDesc(WestreamActivityApply::getCreateTime) | |||
.last("limit 1")); | |||
return JsonResult.success(westreamActivityApply); | |||
} | |||
} |