package com.tuoheng.api.controller; | package com.tuoheng.api.controller; | ||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | import com.tuoheng.api.entity.domain.WestreamActivityApply; | ||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.service.IWestreamActivityApplyService; | import com.tuoheng.api.service.IWestreamActivityApplyService; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import org.springframework.beans.factory.annotation.Autowired; | 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.*; | |||||
/** | /** | ||||
* 全民护河志愿者活动 前端控制器 | * 全民护河志愿者活动 前端控制器 | ||||
public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ | public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ | ||||
return westreamActivityApplyService.submit(westreamActivityApply); | return westreamActivityApplyService.submit(westreamActivityApply); | ||||
} | } | ||||
/** | |||||
* 查询活动申请 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getApply") | |||||
public JsonResult getApply(WestreamActivityQuery query) { | |||||
return westreamActivityApplyService.getApply(query); | |||||
} | |||||
} | } | ||||
*/ | */ | ||||
private Integer tenantId; | private Integer tenantId; | ||||
/** | |||||
* 活动id | |||||
*/ | |||||
private Integer activityId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
} | } |
package com.tuoheng.api.service; | package com.tuoheng.api.service; | ||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | import com.tuoheng.api.entity.domain.WestreamActivityApply; | ||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.common.common.IBaseService; | import com.tuoheng.common.common.IBaseService; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
public interface IWestreamActivityApplyService extends IBaseService<WestreamActivityApply> { | public interface IWestreamActivityApplyService extends IBaseService<WestreamActivityApply> { | ||||
JsonResult submit(WestreamActivityApply westreamActivityApply); | JsonResult submit(WestreamActivityApply westreamActivityApply); | ||||
JsonResult getApply(WestreamActivityQuery query); | |||||
} | } |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | import com.tuoheng.api.entity.domain.WestreamActivityApply; | ||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.mapper.WestreamActivityApplyMapper; | import com.tuoheng.api.mapper.WestreamActivityApplyMapper; | ||||
import com.tuoheng.api.service.IWestreamActivityApplyService; | import com.tuoheng.api.service.IWestreamActivityApplyService; | ||||
import com.tuoheng.common.common.BaseServiceImpl; | import com.tuoheng.common.common.BaseServiceImpl; | ||||
return JsonResult.success(); | 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); | |||||
} | |||||
} | } |