Commit 652c8f95 authored by liqin's avatar liqin 💬

bug fixed

parent 730274bc
......@@ -48,7 +48,7 @@ public class LearningContent implements Serializable {
@NotBlank(message = "学习内容宣传图不能为空", groups = {Add.class, Update.class})
private String cover;
@ApiModelProperty("适用范围")
@ApiModelProperty(value = "适用范围", allowableValues = "ALL_PLAT, THIS_ORGAN, THIS_ORGAN_SUB")
@TableField("applicable_scope")
@NotBlank(message = "适用范围不能为空", groups = {Add.class, Update.class})
private String applicableScope;
......
......@@ -95,8 +95,7 @@ public class CopyrightOwnerController extends BaseController {
@PutMapping("/update")
@RequiresPermissions("copyright:owner:update")
@ApiOperation(value = "修改版权方信息", notes = "修改版权方信息")
public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner, @RequestParam("copyrightOwnerType") CopyrightOwnerTypeEnum copyrightOwnerTypeEnum) {
copyrightOwner.setOwnerType(copyrightOwnerTypeEnum.name());
public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner) {
boolean flag = copyrightOwnerService.updateById(copyrightOwner);
List<String> assetTypeIdList = copyrightOwner.getAssetTypeIdList();
......
......@@ -5,10 +5,12 @@ import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.LearningContent;
import cn.wisenergy.chnmuseum.party.service.LearningContentBoardCatService;
import cn.wisenergy.chnmuseum.party.service.LearningContentBoardService;
import cn.wisenergy.chnmuseum.party.service.LearningContentCopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.service.LearningContentService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -22,7 +24,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
......@@ -42,28 +43,30 @@ public class LearningContentController extends BaseController {
@Resource
private LearningContentService learningContentService;
@PostMapping("/batchSave")
@RequiresPermissions("learning:content:batch:save")
@ApiOperation(value = "批量添加学习内容", notes = "批量添加学习内容")
public Map<String, Object> batchSaveLearningContent(@Validated(value = {Add.class}) List<LearningContent> learningContentList) {
// 保存业务节点信息
boolean result = learningContentService.saveBatch(learningContentList);
// 返回操作结果
if (result) {
return getSuccessResult();
} else {
// 保存失败
return getFailResult();
}
}
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@PostMapping("/save")
@RequiresPermissions("learning:content:save")
@ApiOperation(value = "添加学习内容", notes = "添加学习内容")
public Map<String, Object> saveLearningContent(@Validated(value = {Add.class}) LearningContent learningContent) {
@RequiresPermissions("learning:content:save")
@ApiOperation(value = "添加学习内容", notes = "添加学习内容")
public Map<String, Object> saveLearningContent(@Validated(value = {Add.class}) LearningContent learningContent) {
// 保存业务节点信息
boolean result = learningContentService.save(learningContent);
// 返回操作结果
if (result) {
return getSuccessResult();
......@@ -74,40 +77,22 @@ public class LearningContentController extends BaseController {
}
@PutMapping("/update")
@RequiresPermissions("learning:content:update")
@ApiOperation(value = "修改学习内容信息", notes = "修改学习内容信息")
@RequiresPermissions("learning:content:update")
@ApiOperation(value = "修改学习内容信息", notes = "修改学习内容信息")
public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) {
boolean flag = learningContentService.updateById(learningContent);
if (flag) {
boolean flag = learningContentService.updateById(learningContent);
if (flag) {
return getSuccessResult();
}
return getFailResult();
}
@PutMapping("/updateAuditStatus/{id}")
@RequiresPermissions("learning:content:update:audit:status")
@ApiOperation(value = "更新学习内容审核状态", notes = "更新学习内容审核状态")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataType = "String")
})
public Map<String, Object> updateStatus(@NotNull(message = "学习内容ID不能为空") @PathVariable("id") String id, @RequestParam("status") AuditStatusEnum status) {
UpdateWrapper<LearningContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id);
updateWrapper.eq("audit_status", status.name());
boolean flag = learningContentService.update(updateWrapper);
if (flag) {
return getSuccessResult();
}
return getFailResult();
}
@DeleteMapping("/delete/{id}")
@RequiresPermissions("learning:content:delete")
@ApiOperation(value = "根据ID删除学习内容", notes = "根据ID删除学习内容")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
@RequiresPermissions("learning:content:delete")
@ApiOperation(value = "根据ID删除学习内容", notes = "根据ID删除学习内容")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteLearningContent(@PathVariable("id") String id) {
boolean result = learningContentService.removeById(id);
if (result) {
......@@ -117,51 +102,51 @@ public class LearningContentController extends BaseController {
}
@GetMapping("/getList")
@RequiresPermissions("learning:content:list")
@ApiOperation(value = "获取学习内容全部列表(无分页)", notes = "获取学习内容全部列表(无分页)")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "auditStatus", value = "审核状态", paramType = "query", dataType = "String")
})
@RequiresPermissions("learning:content:list")
@ApiOperation(value = "获取学习内容全部列表(无分页)", notes = "获取学习内容全部列表(无分页)")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "auditStatus", value = "审核状态", paramType = "query", dataType = "String")
})
public Map<String, Object> getLearningContentList(@RequestParam(value = "auditStatus", defaultValue = "APPROVED_FINAL", required = false) AuditStatusEnum auditStatus) {
List<LearningContent> learningContentList = learningContentService.list(Wrappers.<LearningContent>lambdaQuery().eq(LearningContent::getAuditStatus, auditStatus.name()));
return getResult(learningContentList);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@PostMapping("/getPageList")
@RequiresPermissions("learning:content:page")
@ApiOperation(value = "获取学习内容分页列表", notes = "获取学习内容分页列表")
@RequiresPermissions("learning:content:page")
@ApiOperation(value = "获取学习内容分页列表", notes = "获取学习内容分页列表")
public Map<String, Object> getLearningContentPageList(GenericPageParam genericPageParam) {
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(LearningContent::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(LearningContent::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(LearningContent::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(LearningContent::getCreateTime);
// 设置查询内容
queryWrapper.select(
LearningContent::getId,
LearningContent::getName,
LearningContent::getAuditStatus,
LearningContent::getCreateTime,
LearningContent::getUpdateTime);
Page<LearningContent> page = this.learningContentService.page(getPage(), queryWrapper);
for (LearningContent learningContent : page.getRecords()) {
}
return getResult(page);
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(LearningContent::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(LearningContent::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(LearningContent::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(LearningContent::getCreateTime);
// 设置查询内容
queryWrapper.select(
LearningContent::getId,
LearningContent::getName,
LearningContent::getAuditStatus,
LearningContent::getCreateTime,
LearningContent::getUpdateTime);
Page<LearningContent> page = this.learningContentService.page(getPage(), queryWrapper);
for (LearningContent learningContent : page.getRecords()) {
}
return getResult(page);
}
@ApiOperation(value = "获取学习内容详情", notes = "获取学习内容详情")
......@@ -169,10 +154,10 @@ public class LearningContentController extends BaseController {
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/get/{id}")
@RequiresPermissions("learning:content:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
@RequiresPermissions("learning:content:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
LearningContent learningContent = learningContentService.getById(id);
return getResult(learningContent);
return getResult(learningContent);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment