com.lcw.one.util.constant.YesOrNoEnum类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中com.lcw.one.util.constant.YesOrNoEnum类的一些代码示例,展示了YesOrNoEnum类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YesOrNoEnum类的具体详情如下:
包路径:com.lcw.one.util.constant.YesOrNoEnum
类名称:YesOrNoEnum

YesOrNoEnum介绍

暂无

代码示例

代码示例来源:origin: lcw2004/one

public void fetchTableInfo(String tableId) {
  Map<String, CodeGenTableFieldEO> map = ObjectUtils.asMapByFiled(dao.listByTableId(tableId), "fieldId");
  List<TableFieldMetaInfo> tableFieldMetaInfoList = tableMetaInfoService.listTableField(tableId);
  int index = 1;
  for (TableFieldMetaInfo tableFieldMetaInfo : tableFieldMetaInfoList) {
    if (!(map != null && map.containsKey(tableFieldMetaInfo.getTableField()))) {
      CodeGenTableFieldEO codeGenTableFieldEO = new CodeGenTableFieldEO();
      codeGenTableFieldEO.setFieldId(tableFieldMetaInfo.getTableField());
      codeGenTableFieldEO.setTableId(tableId);
      codeGenTableFieldEO.setFieldName(tableFieldMetaInfo.getComment());
      codeGenTableFieldEO.setFieldType(tableFieldMetaInfo.getTableFieldType());
      codeGenTableFieldEO.setIsPrimaryKey(YesOrNoEnum.valueOf(tableFieldMetaInfo.getIsPrimaryKey()).getValue());
      codeGenTableFieldEO.setIsAutoincrement(YesOrNoEnum.valueOf(tableFieldMetaInfo.getIsAutoincrement()).getValue());
      codeGenTableFieldEO.setIsRequired(YesOrNoEnum.valueOf(tableFieldMetaInfo.getIsRequired()).getValue());
      codeGenTableFieldEO.setIsEdit(YesOrNoEnum.YES.getValue());
      codeGenTableFieldEO.setIsInsert(YesOrNoEnum.YES.getValue());
      codeGenTableFieldEO.setIsList(YesOrNoEnum.YES.getValue());
      codeGenTableFieldEO.setIsQuery(YesOrNoEnum.NO.getValue());
      codeGenTableFieldEO.setJavaFieldName(tableFieldMetaInfo.getClassField());
      codeGenTableFieldEO.setJavaType(tableFieldMetaInfo.getJavaType());
      codeGenTableFieldEO.setJavaFieldInclude(tableFieldMetaInfo.getInclude());
      codeGenTableFieldEO.setShowType("1");
      codeGenTableFieldEO.setQueryType("1");
      codeGenTableFieldEO.setOrderIndex(index);
      index++;
      this.save(codeGenTableFieldEO);
    }
  }
}

代码示例来源:origin: lcw2004/one

private void logInDb(HttpServletRequest request, ProceedingJoinPoint joinPoint, int executeTime, String userId, Exception exception) {
  try {
    SysLogEO sysLog = initFromRequest(request, joinPoint);
    // 设置执行时间
    sysLog.setExecuteTime(executeTime);
    // 如果未设置用户ID,则再设置一次(退出的时候,需要先保存用户ID才能正确设置到)
    if (StringUtils.isEmpty(sysLog.getUserId())) {
      sysLog.setUserId(userId);
    }
    // 记录异常信息
    if (exception != null) {
      sysLog.setIsFail(YesOrNoEnum.YES.getValue());
      sysLog.setIsError(isError(exception) ? YesOrNoEnum.YES.getValue() : YesOrNoEnum.NO.getValue());
      if (isError(exception)) { // 如果是非受检异常,记录所有的异常信息
        sysLog.setRemark(Exceptions.getStackTraceAsString(exception));
      } else { // 记录简单异常信息
        sysLog.setRemark(exception.getClass().getSimpleName() + ":" + exception.getMessage());
      }
    }
    if (!isIgnore(sysLog)) {
      sysLogEOService.save(sysLog);
    }
    logger.info("---- Http LogId: {}", sysLog.getLogId());
  } catch (Exception e) {
    logger.error("记录日志失败:{}", e.getMessage());
  }
}

代码示例来源:origin: lcw2004/one

public List<CodeGenTableEO> list(String[] tableList) {
  List<CodeGenTableEO> codeGenTableEOList = dao.list(tableList);
  Map<String, CodeGenTableEO> codeGenTableEOMap = ObjectUtils.asMapByFiled(codeGenTableEOList, "tableId");
  for (String tableId : tableList) {
    if (codeGenTableEOMap == null || !codeGenTableEOMap.containsKey(tableId)) {
      TableMetaInfo table = tableMetaInfoService.getTableByTableName(tableId);
      CodeGenTableEO codeGenTableEO = new CodeGenTableEO();
      codeGenTableEO.setTableName(getTableName(table.getTableNameCn()));
      codeGenTableEO.setTableId(tableId);
      codeGenTableEO.setIsBean(YesOrNoEnum.YES.getValue());
      codeGenTableEO.setIsDao(YesOrNoEnum.YES.getValue());
      codeGenTableEO.setIsService(YesOrNoEnum.YES.getValue());
      Integer yesOrNo = YesOrNoEnum.YES.getValue();
      if (table.getIsJointKey()) {
        // 联合主键的数据不生成Rest接口,应该依托于其他页面
        yesOrNo = YesOrNoEnum.NO.getValue();
      }
      codeGenTableEO.setIsRest(yesOrNo);
      codeGenTableEO.setIsPageList(yesOrNo);
      codeGenTableEO.setIsPageForm(yesOrNo);
      codeGenTableEO.setIsPageModal(yesOrNo);
      this.save(codeGenTableEO);
      codeGenTableEOList.add(codeGenTableEO);
      codeGenTableFieldEOService.fetchTableInfo(tableId);
    }
  }
  return codeGenTableEOList;
}

代码示例来源:origin: lcw2004/one

private SysLogEO initFromRequest(HttpServletRequest request, ProceedingJoinPoint joinPoint) {
  Map<String, String> headers = RequestUtils.getHeaderMap(request);
  SysLogEO sysLog = new SysLogEO();
  sysLog.setLogId(UUID.randomUUID());
  sysLog.setIsFail(YesOrNoEnum.NO.getValue());
  sysLog.setCreateTime(new Date());
  sysLog.setHttpMethod(request.getMethod());
  sysLog.setHttpUri(StringUtils.limitLength(request.getRequestURI(), 200));
  sysLog.setHttpParamters(StringUtils.limitLength(GsonUtil.t2Json(RequestUtils.getParameterMapSafe(request)), 500));
  sysLog.setHttpUserAgent(StringUtils.limitLength(headers.get("user-agent"), 200));
  sysLog.setHttpRemoteHost(RequestUtils.getClientIp(request));
  sysLog.setUserId(LoginUserUtils.getLoginUserIdNoException(request));
  sysLog.setClassName(joinPoint.getSignature().getDeclaringTypeName());
  sysLog.setMethodName(joinPoint.getSignature().getName());
  ApiOperation apiOperation = AspectHelper.getMethodAnnotation(joinPoint, ApiOperation.class);
  if (apiOperation != null) {
    sysLog.setOperationName(apiOperation.value());
  }
  return sysLog;
}

相关文章