Commit 652c8f95 authored by liqin's avatar liqin 💬

bug fixed

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