Commit b895beab authored by huyuchen's avatar huyuchen

失败原因配置

parent 96e6236d
......@@ -75,5 +75,13 @@ public class FailReasonConfig extends BaseEntity {
@ExcelProperty("状态")
@Schema(description = "状态")
private String status;
/**
* 更新人
*/
@ExcelAttribute(name = "更新人")
@ExcelProperty("更新人")
@Schema(description = "更新人")
private String updateName;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.FailReasonConfig;
import com.yifu.cloud.plus.v1.yifu.social.service.FailReasonConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
/**
* 失败原因配置
*
......@@ -58,6 +64,16 @@ public class FailReasonConfigController {
@SysLog("新增失败原因配置" )
@PostMapping
public R<Boolean> save(@RequestBody FailReasonConfig failReasonConfig) {
FailReasonConfig failReasonCount = failReasonConfigService.getOne(Wrappers.<FailReasonConfig>query().lambda()
.eq(FailReasonConfig::getReasonKey,failReasonConfig.getReasonKey())
.last(CommonConstants.LAST_ONE_SQL));
if(Optional.ofNullable(failReasonCount).isPresent()) {
return R.failed("已存在对应的关键字的失败原因配置!");
}
YifuUser user = SecurityUtils.getUser();
if (Common.isNotNull(user)) {
failReasonConfig.setUpdateName(user.getNickname());
}
return R.ok(failReasonConfigService.save(failReasonConfig));
}
......@@ -70,6 +86,10 @@ public class FailReasonConfigController {
@SysLog("修改失败原因配置" )
@PutMapping
public R<Boolean> updateById(@RequestBody FailReasonConfig failReasonConfig) {
YifuUser user = SecurityUtils.getUser();
if (Common.isNotNull(user)) {
failReasonConfig.setUpdateName(user.getNickname());
}
return R.ok(failReasonConfigService.updateById(failReasonConfig));
}
......
......@@ -13,6 +13,7 @@
<result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateName" column="UPDATE_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -25,7 +26,8 @@
a.CREATE_NAME,
a.CREATE_BY,
a.UPDATE_TIME,
a.UPDATE_BY
a.UPDATE_BY,
a.UPDATE_NAME
</sql>
<sql id="failReasonConfig_where">
<if test="failReasonConfig != null">
......
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