Browse Source

查询活动申请 接口

tags/V1.8.0^2
wanghaoran 1 year ago
parent
commit
b2f906d0a2
4 changed files with 48 additions and 4 deletions
  1. +14
    -4
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java
  2. +10
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java
  3. +3
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java
  4. +21
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java

+ 14
- 4
tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java View File

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);
}

} }


+ 10
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java View File

*/ */
private Integer tenantId; private Integer tenantId;


/**
* 活动id
*/
private Integer activityId;

/**
* openid
*/
private String openid;

} }

+ 3
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java View File

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);
} }

+ 21
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java View File



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);
}
} }

Loading…
Cancel
Save