合同模版优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@@ -21,6 +22,6 @@ public class TmplInscDatBsnSaveReqVO {
|
||||
private String inscFldId;
|
||||
|
||||
@Schema(description = "用户填写的值")
|
||||
private String fldVal;
|
||||
private Object fldVal;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.zt.plat.module.base.dal.mysql.tmpltp;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnPageReqVO;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务实例字段值 Mapper
|
||||
@@ -26,5 +27,15 @@ public interface TmplInscDatBsnMapper extends BaseMapperX<TmplInscDatBsnDO> {
|
||||
.betweenIfPresent(TmplInscDatBsnDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(TmplInscDatBsnDO::getId));
|
||||
}
|
||||
|
||||
//物理删除
|
||||
@Delete({
|
||||
"<script>",
|
||||
"DELETE FROM bse_tmpl_insc_dat_bsn",
|
||||
"WHERE bsn_id IN",
|
||||
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
|
||||
"#{id}",
|
||||
"</foreach>",
|
||||
"</script>"
|
||||
})
|
||||
int physicalDeleteByBsnIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscItmBsnDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 业务实例条款值 Mapper
|
||||
@@ -26,4 +28,14 @@ public interface TmplInscItmBsnMapper extends BaseMapperX<TmplInscItmBsnDO> {
|
||||
.orderByDesc(TmplInscItmBsnDO::getId));
|
||||
}
|
||||
|
||||
@Delete({
|
||||
"<script>",
|
||||
"DELETE FROM bse_tmpl_insc_itm_bsn",
|
||||
"WHERE bsn_id IN",
|
||||
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
|
||||
"#{id}",
|
||||
"</foreach>",
|
||||
"</script>"
|
||||
})
|
||||
int physicalDeleteByBsnIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
||||
TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class);
|
||||
tmplInscBsnRel.setRelativityId(createReqVO.getBsnId());
|
||||
// tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid()));
|
||||
tmplInscBsnRelMapper.insert(tmplInscBsnRel);
|
||||
tmplInscBsnRelMapper.insertOrUpdate(tmplInscBsnRel);
|
||||
// 返回
|
||||
return BeanUtils.toBean(tmplInscBsnRel, TmplInscBsnRelRespVO.class);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
package com.zt.plat.module.base.service.tmpltp;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.zt.plat.framework.tenant.core.aop.CompanyVisitIgnore;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnPageReqVO;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnRespVO;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReqVO;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
|
||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscDatBsnMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static com.zt.plat.module.base.enums.ErrorCodeConstants.*;
|
||||
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_EXISTS;
|
||||
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_NOT_EXISTS;
|
||||
|
||||
@@ -44,7 +37,10 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
|
||||
//判断存在
|
||||
validateTmplInscDatBsnExistsByKey(createReqVO);
|
||||
// 插入
|
||||
String fldVal=createReqVO.getFldVal().toString();
|
||||
createReqVO.setFldVal(null);// 兼容前端传入数组或者字符串
|
||||
TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class);
|
||||
tmplInscDatBsn.setFldVal(fldVal);
|
||||
tmplInscDatBsnMapper.insert(tmplInscDatBsn);
|
||||
// 返回
|
||||
return BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
|
||||
@@ -59,10 +55,13 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
|
||||
@Override
|
||||
public void updateTmplInscDatBsn(TmplInscDatBsnSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTmplInscDatBsnExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TmplInscDatBsnDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscDatBsnDO.class);
|
||||
tmplInscDatBsnMapper.updateById(updateObj);
|
||||
// validateTmplInscDatBsnExists(updateReqVO.getId());
|
||||
// 物理删除旧记录
|
||||
tmplInscDatBsnMapper.physicalDeleteByBsnIds(List.of(updateReqVO.getBsnId()));
|
||||
|
||||
TmplInscDatBsnDO saveObj = BeanUtils.toBean(updateReqVO, TmplInscDatBsnDO.class);
|
||||
saveObj.setId(null);
|
||||
tmplInscDatBsnMapper.insert(saveObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
|
||||
|
||||
void validateTmplInscItmBsnExistsByKey(TmplInscItmBsnSaveReqVO createReqVO) {
|
||||
List<TmplInscItmBsnDO> tmplInscItmBsnDOS = tmplInscItmBsnMapper.selectList(TmplInscItmBsnDO::getBsnId, createReqVO.getBsnId(), TmplInscItmBsnDO::getInscItmId, createReqVO.getBsnId());
|
||||
if (!tmplInscItmBsnDOS.isEmpty()){
|
||||
if (!tmplInscItmBsnDOS.isEmpty()) {
|
||||
throw exception(TMPL_INSC_ITM_BSN_EXISTS);
|
||||
}
|
||||
}
|
||||
@@ -61,10 +61,14 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
|
||||
@Override
|
||||
public void updateTmplInscItmBsn(TmplInscItmBsnSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTmplInscItmBsnExists(updateReqVO.getId());
|
||||
// validateTmplInscItmBsnExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TmplInscItmBsnDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscItmBsnDO.class);
|
||||
tmplInscItmBsnMapper.updateById(updateObj);
|
||||
tmplInscItmBsnMapper.physicalDeleteByBsnIds(List.of(updateReqVO.getBsnId()));
|
||||
TmplInscItmBsnDO saveObj = BeanUtils.toBean(updateReqVO, TmplInscItmBsnDO.class);
|
||||
saveObj.setInscItmId(updateReqVO.getInstceItmId());
|
||||
// tmplInscItmBsnMapper.updateById(updateObj);
|
||||
saveObj.setId(null);
|
||||
tmplInscItmBsnMapper.insert(saveObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user