提交 11406d11 作者: 刘明祎-运维用途

新增查找我的课程以及查看用户是否购买过此课程

上级 98eb84ea
流水线 #7508 已通过 于阶段
in 2 分 54 秒
...@@ -2,7 +2,6 @@ package com.mmc.csf.release.flyer.vo; ...@@ -2,7 +2,6 @@ package com.mmc.csf.release.flyer.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.mmc.csf.release.model.group.Insert; import com.mmc.csf.release.model.group.Insert;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -73,4 +72,7 @@ public class CurriculumInfoVO implements Serializable { ...@@ -73,4 +72,7 @@ public class CurriculumInfoVO implements Serializable {
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "用户是否购买过")
private boolean isBuy;
} }
...@@ -104,8 +104,8 @@ public class FlyerTrainingController extends BaseController { ...@@ -104,8 +104,8 @@ public class FlyerTrainingController extends BaseController {
@ApiOperation(value = "V1.0.1课程视频详情") @ApiOperation(value = "V1.0.1课程视频详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CurriculumInfoVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = CurriculumInfoVO.class)})
@GetMapping("/curriculumDetails") @GetMapping("/curriculumDetails")
public ResultBody curriculumDetails(@ApiParam(value = "课程id") @RequestParam(value = "id") Integer id) { public ResultBody curriculumDetails(HttpServletRequest request, @ApiParam(value = "课程id") @RequestParam(value = "id") Integer id) {
return flyerTrainingService.curriculumDetails(id); return flyerTrainingService.curriculumDetails(id, this.getUserLoginInfoFromRedis(request).getUserAccountId());
} }
@ApiOperation(value = "V1.0.1新增课程") @ApiOperation(value = "V1.0.1新增课程")
...@@ -155,6 +155,14 @@ public class FlyerTrainingController extends BaseController { ...@@ -155,6 +155,14 @@ public class FlyerTrainingController extends BaseController {
return flyerTrainingService.getCurriculumOrderList(param); return flyerTrainingService.getCurriculumOrderList(param);
} }
@ApiOperation(value = "小程序——获取我的课程列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CurriculumOrderDO.class)})
@PostMapping("getCurriculumOrderListByMini")
public ResultBody<List<CurriculumOrderDO>> selectCurriculumOrderList(HttpServletRequest request, @ApiParam(value = "订单查询QO", required = true) @Validated(Page.class) @RequestBody CurriculumOrderQO param) {
param.setUserAccountId(this.getUserLoginInfoFromRedis(request).getUserAccountId());
return flyerTrainingService.getCurriculumOrderList(param);
}
@ApiOperation(value = "后台——删除课程订单详情") @ApiOperation(value = "后台——删除课程订单详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CurriculumOrderDO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = CurriculumOrderDO.class)})
@GetMapping("deleteCurriculumOrderInfo") @GetMapping("deleteCurriculumOrderInfo")
......
package com.mmc.csf.release.dao; package com.mmc.csf.release.dao;
import java.util.List;
import com.mmc.csf.release.entity.curriculum.*; import com.mmc.csf.release.entity.curriculum.*;
import com.mmc.csf.release.flyer.vo.CurriculumClassifyVO;
import org.apache.ibatis.annotations.Mapper;
import com.mmc.csf.release.flyer.qo.CurriculumQo; import com.mmc.csf.release.flyer.qo.CurriculumQo;
import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO; import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* @Author LW * @Author LW
...@@ -139,5 +137,7 @@ public interface FlyerTrainingDao { ...@@ -139,5 +137,7 @@ public interface FlyerTrainingDao {
*/ */
CurriculumInfoDO selectCurriculumInfoById(Integer id); CurriculumInfoDO selectCurriculumInfoById(Integer id);
int selectCountCurriculumOrder(Integer id,Integer userId);
int insertCurriculumOrder(CurriculumOrderDO record); int insertCurriculumOrder(CurriculumOrderDO record);
} }
...@@ -36,6 +36,7 @@ public class CurriculumOrderQO implements Serializable { ...@@ -36,6 +36,7 @@ public class CurriculumOrderQO implements Serializable {
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private Integer userAccountId; private Integer userAccountId;
public void buildCurrentPage() { public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
......
...@@ -58,7 +58,7 @@ public interface FlyerTrainingService { ...@@ -58,7 +58,7 @@ public interface FlyerTrainingService {
*/ */
ResultBody licenseOrSkillQueryCurriculum(Integer type); ResultBody licenseOrSkillQueryCurriculum(Integer type);
ResultBody curriculumDetails(Integer id); ResultBody curriculumDetails(Integer id,Integer userId);
/** /**
* 添加课程 * 添加课程
......
...@@ -137,12 +137,16 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService { ...@@ -137,12 +137,16 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService {
} }
@Override @Override
public ResultBody curriculumDetails(Integer id) { public ResultBody curriculumDetails(Integer id,Integer userId) {
CurriculumInfoDO curriculumInfoDO = flyerTrainingDao.selectCurriculumInfoById(id); CurriculumInfoDO curriculumInfoDO = flyerTrainingDao.selectCurriculumInfoById(id);
int i = flyerTrainingDao.selectCountCurriculumOrder(id, userId);
boolean isBuy = i > 0;
if (curriculumInfoDO == null) { if (curriculumInfoDO == null) {
return ResultBody.error("课程不存在或已下架!"); return ResultBody.error("课程不存在或已下架!");
} else { } else {
CurriculumInfoVO curriculumInfoVO = curriculumInfoDO.buildCurriculumInfoVO(); CurriculumInfoVO curriculumInfoVO = curriculumInfoDO.buildCurriculumInfoVO();
curriculumInfoVO.setBuy(isBuy);
return ResultBody.success(curriculumInfoVO); return ResultBody.success(curriculumInfoVO);
} }
} }
......
...@@ -294,4 +294,8 @@ ...@@ -294,4 +294,8 @@
resultType="com.mmc.csf.release.entity.curriculum.CurriculumClassifyDO"> resultType="com.mmc.csf.release.entity.curriculum.CurriculumClassifyDO">
select * from course_classify where id = #{id} and is_deleted = 0 select * from course_classify where id = #{id} and is_deleted = 0
</select> </select>
<select id="selectCountCurriculumOrder" resultType="java.lang.Integer">
select count(id) from curriculum_order
where user_account_id = #{userId} and id = #{id}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论