//package com.yonge.cooleshow.admin.controller;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import javax.validation.Valid;
//import com.yonge.cooleshow.biz.dal.dto.VideoLessonPurchaseRecordDto;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import com.yonge.cooleshow.common.controller.BaseController;
//import com.yonge.cooleshow.common.entity.HttpResponseResult;
//import com.yonge.cooleshow.biz.dal.entity.VideoLessonPurchaseRecord;
//import com.yonge.cooleshow.biz.dal.service.VideoLessonPurchaseRecordService;
//import com.yonge.cooleshow.auth.api.entity.SysUser;
//import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
//
///**
// * 视频课购买记录表 web 控制层
// * @author yzp
// * @date 2022-03-26 00:21:46
// * @version v1.0
// **/
//@RestController
//@RequestMapping("/video/lesson/purchase/record")
//@Api(tags = "视频课购买记录表 API接口")
//public class VideoLessonPurchaseRecordController extends BaseController {
//    @Autowired
//    private SysUserFeignService sysUserFeignService;
//
//	@Autowired
//	private VideoLessonPurchaseRecordService videoLessonPurchaseRecordService;
//
//	@ApiOperation(value = "新增", httpMethod="POST", consumes="application/json", produces="application/json")
//    @PostMapping(value="/create", consumes="application/json", produces="application/json")
//    public HttpResponseResult<Object> create(@Valid @RequestBody VideoLessonPurchaseRecord videoLessonPurchaseRecord) {
//        SysUser sysUser = sysUserFeignService.queryUserInfo();
//        if (sysUser == null) {
//            return failed("用户信息获取失败");
//        }
//
//        //videoLessonPurchaseRecord.setCreateBy(sysUser.getId());
//        //videoLessonPurchaseRecord.setCreateTime(new Date());
//        videoLessonPurchaseRecordService.save(videoLessonPurchaseRecord);
//        return succeed();
//    }
//
//    @ApiOperation(value = "删除", httpMethod="POST", consumes="application/json", produces="application/json")
//    @PostMapping("/delete/{id}")
//    public Object delete(@PathVariable Long id) {
//        SysUser sysUser = sysUserFeignService.queryUserInfo();
//        if (sysUser == null) {
//            return failed("用户信息获取失败");
//        }
//
//        videoLessonPurchaseRecordService.removeById(id);
//        return succeed();
//    }
//
//    @ApiOperation(value = "修改", httpMethod="POST", consumes="application/json", produces="application/json")
//    @PostMapping(value="/update", consumes="application/json", produces="application/json")
//    public HttpResponseResult<Object> update(@Valid @RequestBody VideoLessonPurchaseRecord videoLessonPurchaseRecord) {
//        SysUser sysUser = sysUserFeignService.queryUserInfo();
//        if (sysUser == null) {
//            return failed("用户信息获取失败");
//        }
//        if (videoLessonPurchaseRecord.getId()==null){
//            return failed("缺少ID");
//        }
//
//        //videoLessonPurchaseRecord.setUpdateBy(sysUser.getId());
//        //videoLessonPurchaseRecord.setUpdateTime(new Date());
//        videoLessonPurchaseRecordService.updateById(videoLessonPurchaseRecord);
//        return succeed();
//    }
//
//    @ApiOperation(value = "分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
//    @PostMapping(value="/list", consumes="application/json", produces="application/json")
//    public HttpResponseResult<Object> list(@RequestBody VideoLessonPurchaseRecordDto videoLessonPurchaseRecordDto) {
//        SysUser sysUser = sysUserFeignService.queryUserInfo();
//        if (sysUser == null) {
//            return failed("用户信息获取失败");
//        }
//
//        int pageNo = videoLessonPurchaseRecordDto.getPageNo();
//        int pageSize = videoLessonPurchaseRecordDto.getPageSize();
//
//        try {
//            if (pageNo==0) {
//                pageNo = 1;
//            }
//            if (pageSize==0) {
//                pageSize = 10;
//            }
//
//            LambdaQueryWrapper<VideoLessonPurchaseRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
//            //lambdaQueryWrapper.like(VideoLessonPurchaseRecord::getName , "k");
//
//            Page<VideoLessonPurchaseRecord> page = new Page<>(pageNo,pageSize);
//            return succeed(videoLessonPurchaseRecordService.page(page, lambdaQueryWrapper));
//        } catch (Exception e) {
//            e.printStackTrace();
//            return HttpResponseResult.failed(e.getMessage());
//        }
//    }
//}
