修改文档对比-修改比对信息发布状态

This commit is contained in:
gaosong
2022-08-08 12:01:36 +08:00
parent daf58eb9d5
commit e48068c3ec
4 changed files with 16 additions and 30 deletions
@@ -54,12 +54,16 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
@AutoLog(value = "文档对比信息表-分页列表查询")
@ApiOperation(value = "文档对比信息表-分页列表查询", notes = "文档对比信息表-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(SarFileCompareInfo sarFileCompareInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
public Result<?> queryPageList(SarFileCompareInfo sarFileCompareInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpServletRequest req) {
QueryWrapper<SarFileCompareInfo> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareInfo, req.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("create_by", sysUser.getUsername()).or().eq("release_state", ReleaseConditionEnum.DRAFT.getValue());
Page<SarFileCompareInfo> page = new Page<SarFileCompareInfo>(pageNo, pageSize);
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
for (SarFileCompareInfo info : pageList.getRecords()) {
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
}
return Result.OK(pageList);
}
@@ -208,12 +212,13 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
@ApiOperation(value = "文档对比信息表-更改发布状态", notes = "文档对比信息表-更改发布状态")
@RequestMapping(value = "/changeState", method = RequestMethod.POST)
public Result<?> changeState(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
if (sarFileCompareInfo.getReleaseState().equals(ReleaseConditionEnum.DRAFT.getValue())) {
sarFileCompareInfo.setReleaseState(ReleaseConditionEnum.PUBLISHED.getValue());
SarFileCompareInfo info = sarFileCompareInfoService.queryById(sarFileCompareInfo.getId());
if (ReleaseConditionEnum.DRAFT.getValue().equals(sarFileCompareInfo.getReleaseState())) {
info.setReleaseState(ReleaseConditionEnum.PUBLISHED.getValue());
} else {
sarFileCompareInfo.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
info.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
}
sarFileCompareInfoService.editById(sarFileCompareInfo);
sarFileCompareInfoService.editById(info);
return Result.OK("更改成功!");
}
@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -126,6 +127,10 @@ public class SarFileCompareInfo implements Serializable {
@ApiModelProperty(value = "发布状态")
private String releaseState;
/**发布状态-翻译后*/
@TableField(exist = false)
private String releaseStateTitle;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
@@ -1,24 +0,0 @@
package com.jero.modules.compare.enums;
/**
* 对比信息发布状态
*/
public enum ComparesInfoStateEnum {
DRAFT(0, "草稿"), RELEASE(1, "发布");
private int value;
private String lable;
private ComparesInfoStateEnum(int value, String lable) {
this.value = value;
this.lable = lable;
}
public int getValue() {
return value;
}
public String getLable() {
return lable;
}
}
@@ -160,7 +160,7 @@ public class SarFileCompareInfoServiceImpl extends ServiceImpl<SarFileCompareInf
}
if (j >= rightItemList.size() - 1) {
int ts = leftItemList.get(i).getTargetStand();
if(ts > -1){
if (ts > -1) {
rightItemList.get(ts).setTargetStand(i);
}
}