Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
@@ -232,7 +232,6 @@ </el-dialog> </el-dialog> </template> <script> @@ -420,7 +419,11 @@ cell: true, clearable: false, dicData: [ { { value: '_in', label: '存在于' },{ value: '_notin', label: '不存在于' },{ value: '_like', label: '包含' },{ value: "_notlike", label: "不包含", Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/SpecialCharacterConverter.java
@@ -3,7 +3,7 @@ import net.logstash.logback.encoder.org.apache.commons.lang3.StringEscapeUtils; /** * * 数据库查询时,一些特殊字符需要转义 * @author ludc * @date 2023/12/1 9:16 */ Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/UBCSCondition.java
@@ -6,14 +6,18 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.vci.ubcs.starter.web.constant.QueryOptionConstant; import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** @@ -24,6 +28,11 @@ * @date 2023/6/6 15:26 */ public class UBCSCondition { /** * 空格 */ public static final String SPACE = " "; public UBCSCondition() { } @@ -136,4 +145,90 @@ return qw; } public static String getWhereSqlByMap(Map<String, String> conditionMap){ List<String> whereSqlList = new ArrayList<>(); conditionMap.forEach((key,value)->{ String sql = ""; // 不为空才去拼接 if(!Func.hasEmpty(new Object[]{key, value}) && !key.endsWith("_ignore")){ if (key.endsWith("_like")) { String field = UBCSSqlKeyword.getColumn(key, "_like"); sql = field + SPACE + "LIKE" + SPACE + "'%" + value + "%'" + SPACE; } else if (key.endsWith("_notequal")) { String field = UBCSSqlKeyword.getColumn(key, "_notequal"); sql = field + SPACE + " != " + value + SPACE; } else if (key.endsWith("_likeleft")) { String field = UBCSSqlKeyword.getColumn(key, "_likeleft"); sql = field + SPACE + "LIKE" + SPACE + "%" + value + SPACE; } else if (key.endsWith("_likeright")) { String field = UBCSSqlKeyword.getColumn(key, "_likeright"); sql = field + SPACE + "LIKE" + SPACE + value + "%" + SPACE; } else if (key.endsWith("_notlike")) { String field = UBCSSqlKeyword.getColumn(key, "_notlike"); sql = field + SPACE + "NO LIKE" + SPACE + "%" + value + "%" + SPACE; } else if (key.endsWith("_ge")) { String field = UBCSSqlKeyword.getColumn(key, "_ge"); sql = field + SPACE + " >= " + value + SPACE; } else if (key.endsWith("_le")) { //说明是<=的。我们需要先获取一下 String field = UBCSSqlKeyword.getColumn(key, "_le"); sql = field + SPACE + " <= " + value + "" + SPACE; } else if (key.endsWith("_gt")) { String field = UBCSSqlKeyword.getColumn(key, "_gt"); sql = field + SPACE + "> " + value + SPACE; } else if (key.endsWith("_lt")) { String field = UBCSSqlKeyword.getColumn(key, "_lt"); sql = field + SPACE + "< " + value + SPACE; } else if (key.endsWith("_datege")) { String field = UBCSSqlKeyword.getColumn(key, "_datege"); sql = field + SPACE + ">= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_dategt")) { String field = UBCSSqlKeyword.getColumn(key, "_dategt"); sql = field + SPACE + "> '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_dateequal")) { String field = UBCSSqlKeyword.getColumn(key, "_dateequal"); sql = field + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_datele")) { String field = UBCSSqlKeyword.getColumn(key, "_datele"); sql = field + SPACE + "<= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_datelt")) { String field = UBCSSqlKeyword.getColumn(key, "_datelt"); sql = field + SPACE + "< '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_null")) { String field = UBCSSqlKeyword.getColumn(key, "_null"); sql = field + SPACE + "IS NULL" + SPACE; } else if (key.endsWith("_notnull")) { String field = UBCSSqlKeyword.getColumn(key, "_notnull"); sql = field + SPACE + "IS NOT NULL" + SPACE; } else if (key.endsWith("_dateequal")) { String field = UBCSSqlKeyword.getColumn(key, "_dateequal"); sql = field + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE; } else if (key.endsWith("_equal")) { String field = UBCSSqlKeyword.getColumn(key, "_equal"); sql = field + SPACE + "= '" + value + "'" + SPACE; } else if(key.endsWith("_in")) { String field = UBCSSqlKeyword.getColumn(key, "_in"); sql = VciBaseUtil.toInSql(field,value); } else if(key.endsWith("_notin")) { String field = UBCSSqlKeyword.getColumn(key, "_notin"); sql = VciBaseUtil.toInSql(field,value); } if(!sql.isEmpty()){ whereSqlList.add(sql); } } }); //组合起来 StringBuilder andSb = new StringBuilder(); whereSqlList.stream().forEach(s -> { andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE); }); String andString = andSb.toString().trim(); String endWithSql = QueryOptionConstant.AND; if (andString.endsWith(endWithSql)) { andString = andString.substring(0, andString.length() - endWithSql.length()); } return andString; } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeApplySwingController.java
@@ -180,7 +180,6 @@ return R.data(defaultReferTree); } /** * 默认的参照列表 * @param referConfigVO 参照的配置信息 @@ -188,7 +187,7 @@ */ @GetMapping("/defaultReferDataGrid") public R<IPage<BaseModelVO>> defaultReferDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject){ IPage<BaseModelVO> iPage= mdmEngineService.referDataGrid(referConfigVO,baseQueryObject); IPage<BaseModelVO> iPage = mdmEngineService.referDataGrid(referConfigVO,baseQueryObject); return R.data(iPage); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
@@ -365,4 +365,5 @@ public R flowingDependencyGen(String classifyOid) { return codeClassifyService.flowingDependencyGen(classifyOid); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
@@ -448,7 +448,7 @@ * @param baseModels 处理数据 * @return 处理状态 */ public R<Integer>updateBatchBtypeDatas(String btmType, List<BaseModel> baseModels); R<Integer>updateBatchBtypeDatas(String btmType, List<BaseModel> baseModels); /** * 默认列表 @@ -490,7 +490,7 @@ * 校验关键属性 * @param orderDTO 编码申请的相关的信息 */ public List<Map> checkKeyAttrOnOrderFordatas(CodeOrderDTO orderDTO) ; List<Map> checkKeyAttrOnOrderFordatas(CodeOrderDTO orderDTO) ; /** * 根据当前申请编码的分类,逐层往上校验是否符合属于配置的中的分类子节点的分 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -750,7 +750,6 @@ */ @Override public R flowingDependencyGen(String classifyOid) { //查询此分类下面的所有分类 List<CodeClassify> codeClassifyList=codeClassifyMapper.selectAllClassifyByOid(classifyOid,AuthUtil.getTenantId(),null); //查询码值表,获取最大流水 @@ -758,6 +757,17 @@ .map(classfiy -> classfiy.getOid()).collect(Collectors.joining("','")) + "'","'${sav}'"); //往流水表里面加数据,有则更新,无则添加数据。 for (CodeAllCode codeAllCodeVO : codeAllCodeVOS) { if(Func.isEmpty(codeAllCodeVO.getSerialUnit())){ throw new ServiceException("编码为:" + codeAllCodeVO.getId() + "的码值数据流水依赖不能为空!"); } try { CodeRuleVO codeRuleVO = codeRuleService.getObjectByOid(codeAllCodeVO.getCodeRuleOid()); if(Func.isEmpty(codeRuleVO)){ continue; } }catch (Exception e){ continue; } QueryWrapper<CodeBasicSec> secWrapper = new QueryWrapper<>(); secWrapper.eq("PKCODERULE",codeAllCodeVO.getCodeRuleOid()); secWrapper.eq("SECTYPE","codeserialsec"); Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -25,7 +25,6 @@ import com.vci.ubcs.code.vo.pagemodel.UITablePageVO; import com.vci.ubcs.code.vo.pagemodel.*; import com.vci.ubcs.code.wrapper.BaseMdodelWrapper; import com.vci.ubcs.code.wrapper.CodeAllcodeWrapper; import com.vci.ubcs.flow.core.dto.FlowStatusDTO; import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient; import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO; @@ -42,10 +41,7 @@ import com.vci.ubcs.starter.revision.model.TreeQueryObject; import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; import com.vci.ubcs.starter.revision.service.RevisionModelUtil; import com.vci.ubcs.starter.util.MdmBtmTypeConstant; import com.vci.ubcs.starter.util.SaveLogUtil; import com.vci.ubcs.starter.util.SpecialCharacterConverter; import com.vci.ubcs.starter.util.UBCSSqlKeyword; import com.vci.ubcs.starter.util.*; import com.vci.ubcs.starter.web.constant.QueryOptionConstant; import com.vci.ubcs.starter.web.constant.RegExpConstant; import com.vci.ubcs.starter.web.enumpck.BooleanEnum; @@ -60,13 +56,12 @@ import com.vci.ubcs.system.feign.ISysClient; import com.vci.ubcs.system.user.entity.User; import com.vci.ubcs.system.user.feign.IUserClient; import io.swagger.models.auth.In; import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; import oracle.sql.TIMESTAMP; import org.hibernate.validator.constraints.NotEmpty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.log.annotation.OperateLog; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.utils.AuthUtil; @@ -88,8 +83,6 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; @@ -306,6 +299,7 @@ * 空格 */ public static final String SPACE = " "; /** * 缓存key */ @@ -2522,7 +2516,6 @@ } else { return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE; } }else { // if (referFieldMap.containsKey(key)) { // //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题, @@ -4404,7 +4397,7 @@ throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); } // TODO:参照配置的模糊查询过滤条件暂未处理 String namesql = ""; /* String namesql = ""; if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) { String s = baseQueryObject.getConditionMap().get("name"); s = "%" + s + "%"; @@ -4421,20 +4414,21 @@ String lcstatusSql = ""; if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) { lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus")); } }*/ // String where = ""; // if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) { // where = "where "; // } String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap()); String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + ""; String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + ""; String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + ""; List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 " + lcstatusSql + namesql + codesql + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2) + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and " + whereSqlByMap + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2) )); List<BaseModel> baseModels = new ArrayList<>(); //将查询到的数据转换为basemodel,使用的反射方式来进行创建的 @@ -4482,8 +4476,8 @@ } int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 " + lcstatusSql + namesql + codesql + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and " + whereSqlByMap ); IPage<BaseModelVO> objectDataGrid = new Page<>(); objectDataGrid.setPages(baseQueryObject.getPage()); Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeALlCodeMapper.xml
@@ -10,8 +10,7 @@ select * from PL_CODE_ALLCODE </select> <select id="selectGroupByClassify" resultMap="CodeAllcodeResultMap"> select codeClassifyOid, codeRuleOid, select codeRuleOid, serialUnit, nvl(max(unFillSerial),0) unFillSerial from (select codeClassifyOid, @@ -19,7 +18,7 @@ serialUnit, to_number(replace(unFillSerial, ${replaceString}, '')) unFillSerial from PL_CODE_ALLCODE where codeClassifyOid in (${codeClassifyOid})) group by codeClassifyOid, codeRuleOid, serialUnit group by codeRuleOid, serialUnit </select> </mapper>