Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.base.controller.admin.templtp;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
|
||||
import com.zt.plat.module.base.service.tmpltp.TmplInscDatBsnService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -82,7 +83,9 @@ public class TmplInscDatBsnController implements BusinessControllerMarker {
|
||||
@PreAuthorize("@ss.hasPermission('base:tmpl-insc-dat-bsn:query')")
|
||||
public CommonResult<TmplInscDatBsnRespVO> getTmplInscDatBsn(@RequestParam("id") String id) {
|
||||
TmplInscDatBsnDO tmplInscDatBsn = tmplInscDatBsnService.getTmplInscDatBsn(id);
|
||||
return success(BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class));
|
||||
TmplInscDatBsnRespVO tmplInscDatBsnRespVO = BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
|
||||
tmplInscDatBsnRespVO.setFldVal(CollUtil.toList(tmplInscDatBsn.getFldVal().split(",")));
|
||||
return success(tmplInscDatBsnRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
||||
@@ -26,12 +26,12 @@ public class TmplInscDatBsnRespVO {
|
||||
|
||||
@Schema(description = "用户填写的值")
|
||||
@ExcelProperty("用户填写的值")
|
||||
private String fldVal;
|
||||
private List<String> fldVal;
|
||||
|
||||
|
||||
@Schema(description = "字段标识")
|
||||
@ExcelProperty("字段标识")
|
||||
private String fldKy;
|
||||
private List<String> fldKy;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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.*;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,24 @@
|
||||
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 jodd.util.ArraysUtil;
|
||||
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.Arrays;
|
||||
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,10 +39,13 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
|
||||
//判断存在
|
||||
validateTmplInscDatBsnExistsByKey(createReqVO);
|
||||
// 插入
|
||||
createReqVO.setFldVal(null);// 兼容前端传入数组或者字符串
|
||||
TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class);
|
||||
tmplInscDatBsnMapper.insert(tmplInscDatBsn);
|
||||
// 返回
|
||||
return BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
|
||||
TmplInscDatBsnRespVO tmplInscDatBsnRespVO = BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
|
||||
tmplInscDatBsnRespVO.setFldVal(CollUtil.toList(tmplInscDatBsn.getFldVal().split(",")));
|
||||
return tmplInscDatBsnRespVO;
|
||||
}
|
||||
private void validateTmplInscDatBsnExistsByKey(TmplInscDatBsnSaveReqVO createReqVO) {
|
||||
List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getInscFldId, createReqVO.getInscFldId(),TmplInscDatBsnDO::getBsnId, createReqVO.getBsnId());
|
||||
@@ -59,10 +57,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