管理端新增证书
This commit is contained in:
@@ -4,12 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.modules.common.entity.MyUserEntity;
|
import com.peanut.modules.common.entity.*;
|
||||||
import com.peanut.modules.common.entity.UserCertificate;
|
import com.peanut.modules.common.service.ClassEntityService;
|
||||||
import com.peanut.modules.common.entity.UserCertificateLabel;
|
|
||||||
import com.peanut.modules.common.service.MyUserService;
|
import com.peanut.modules.common.service.MyUserService;
|
||||||
import com.peanut.modules.common.service.UserCertificateLabelService;
|
import com.peanut.modules.common.service.UserCertificateLabelService;
|
||||||
import com.peanut.modules.common.service.UserCertificateService;
|
import com.peanut.modules.common.service.UserCertificateService;
|
||||||
|
import com.peanut.modules.master.service.CourseService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -34,6 +34,33 @@ public class UserCertificateController {
|
|||||||
private UserCertificateLabelService userCertificateLabelService;
|
private UserCertificateLabelService userCertificateLabelService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MyUserService myUserService;
|
private MyUserService myUserService;
|
||||||
|
@Autowired
|
||||||
|
private CourseService courseService;
|
||||||
|
|
||||||
|
//新增证书
|
||||||
|
@RequestMapping("/addCertificate")
|
||||||
|
public R addCertificate(@RequestBody UserCertificate userCertificate) {
|
||||||
|
CourseEntity courseEntity = courseService.getById(userCertificate.getCourseId());
|
||||||
|
if (courseEntity != null) {
|
||||||
|
userCertificate.setTitle(courseEntity.getTitle());
|
||||||
|
}
|
||||||
|
userCertificateService.save(userCertificate);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑证书
|
||||||
|
@RequestMapping("/editCertificate")
|
||||||
|
public R editCertificate(@RequestBody UserCertificate userCertificate) {
|
||||||
|
userCertificateService.updateById(userCertificate);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除证书
|
||||||
|
@RequestMapping("/delCertificate")
|
||||||
|
public R delCertificate(@RequestBody UserCertificate userCertificate) {
|
||||||
|
userCertificateService.removeById(userCertificate.getId());
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
//标签列表
|
//标签列表
|
||||||
@RequestMapping("/userCertificateLabelList")
|
@RequestMapping("/userCertificateLabelList")
|
||||||
@@ -60,6 +87,7 @@ public class UserCertificateController {
|
|||||||
if (params.containsKey("title")&&StringUtils.isNotBlank(params.get("title").toString())) {
|
if (params.containsKey("title")&&StringUtils.isNotBlank(params.get("title").toString())) {
|
||||||
wrapper.like(UserCertificate::getTitle,params.get("title"));
|
wrapper.like(UserCertificate::getTitle,params.get("title"));
|
||||||
}
|
}
|
||||||
|
wrapper.orderByDesc(UserCertificate::getCreateTime);
|
||||||
Page<UserCertificate> certificatePage = userCertificateService.page(new Page<>(
|
Page<UserCertificate> certificatePage = userCertificateService.page(new Page<>(
|
||||||
Long.parseLong(params.get("current").toString()),Long.parseLong(params.get("limit").toString())),wrapper);
|
Long.parseLong(params.get("current").toString()),Long.parseLong(params.get("limit").toString())),wrapper);
|
||||||
for (UserCertificate certificate:certificatePage.getRecords()){
|
for (UserCertificate certificate:certificatePage.getRecords()){
|
||||||
|
|||||||
Reference in New Issue
Block a user