添加逻辑删除,并改进代码
parent
4e834a4500
commit
cb2b9c0b54
|
@ -80,6 +80,10 @@ public class Firm extends BaseEntity {
|
|||
@TableField("firm_head")
|
||||
private String firmHead;
|
||||
|
||||
@Excel(name = "逻辑删除")
|
||||
@TableField("firm_tombstone")
|
||||
private Integer firmTombstone;
|
||||
|
||||
public static Firm addReqBuild(FirmRequest firmRequest){
|
||||
return Firm.builder()
|
||||
.firmName(firmRequest.getFirmName())
|
||||
|
@ -94,6 +98,7 @@ public class Firm extends BaseEntity {
|
|||
.remark(firmRequest.getRemark())
|
||||
.firmType(firmRequest.getFirmType())
|
||||
.firmHead(firmRequest.getFirmHead())
|
||||
.firmTombstone(firmRequest.getFirmTombstone())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,5 +70,9 @@ public class FirmRequest {
|
|||
@TableField("firm_head")
|
||||
private String firmHead;
|
||||
|
||||
@Excel(name = "逻辑删除")
|
||||
@TableField("firm_tombstone")
|
||||
private Integer firmTombstone;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,9 +39,7 @@ public class FirmTypeController extends BaseController {
|
|||
**/
|
||||
@GetMapping("/faultType")
|
||||
public Result<List<FirmType>> faultType(){
|
||||
log.info("功能:查询类型,URI:{},方法:{}",request.getRequestURI(),request.getMethod());
|
||||
List<FirmType> firmTypes = firmTypeService.list();
|
||||
log.info("功能:查询类型,URI:{},方法:{},响应:{}",request.getRequestURI(),request.getMethod(), JSON.toJSONString(firmTypes));
|
||||
return Result.success(firmTypes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.fate.firm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fate.common.core.domain.Result;
|
||||
import com.fate.common.core.utils.StringUtils;
|
||||
|
@ -45,10 +46,24 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
|
|||
@Override
|
||||
public Result addFirm(Firm firm) {
|
||||
firm.setCreateBy("1");
|
||||
if(StringUtils.isEmpty(firm.getFirmName())){
|
||||
throw new RuntimeException("企业的公司名不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(firm.getFirmAddress())){
|
||||
throw new RuntimeException("企业的地址不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(firm.getFirmPhone())){
|
||||
throw new RuntimeException("企业的电话不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(firm.getFirmHead())){
|
||||
throw new RuntimeException("企业的否则人不能为空");
|
||||
}
|
||||
if(0 == firm.getFirmType()){
|
||||
throw new RuntimeException("没有添加类型");
|
||||
}
|
||||
// 创建企业的时间需要进行一个
|
||||
firm.setCreateTime(new Date());
|
||||
firm.setUpdateBy(null);
|
||||
firm.setUpdateTime(null);
|
||||
firm.setFirmStaus(1); // 1提交 2 审核 3通过 4驳回
|
||||
firm.setFirmStaus(1); // 1提交中 2 审核 3通过 4驳回
|
||||
int insert = firmMapper.insert(firm);
|
||||
return insert > 0 ? Result.success("成功") : Result.error("失败");
|
||||
}
|
||||
|
@ -86,7 +101,7 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
|
|||
queryWrapper.like(Firm::getFirmHead, firm.getFirmHead());
|
||||
}
|
||||
// 逻辑删除 不显示状态为2的
|
||||
queryWrapper.eq(Firm::getFirmStaus,1);
|
||||
queryWrapper.eq(Firm::getFirmTombstone,1);
|
||||
List<Firm> list = firmMapper.selectList(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue