关于JeecgBoot 的项目理解、使用心得和改进建议

      3年前,初进上家公司的时候了解到了jeecgboot这个开源框架。初期使用这个低代码平台时,就感觉功能强大。代码生成器让前后端代码一键生成,实现
   低代码开发,帮助Java项目解决70%的重复工作,让开发更多关注复杂业务的处理,甚至可以改成微服务项目。

	***使用心得:***
		我们通常自己手动建立数据库,然后导入之后根据数据库生成。然后Online表单字段控件配置,生前Vue前端页面格式,以及后端常用代码。
		而且jeecg一直在迭代新的版本,新版本也会适时的采用新的技术去实现,让技术开发者永远跟上时代(跳槽时候的痛苦谁知道)。

改进建议
但是呢,再好的工具有时候也会所不能及的地方,其主要原因是个人定制的多样化,而模板是符合大部分人要求的。在这里我也想提几点建议:
1:在字典模块中DictAspect.java ,能否增加选择配置,使其不止在IPage返回类中使用

在这里插入代码片
private void parseDictText(Object result) {
        if (result instanceof Result) {
            if (((Result) result).getResult() instanceof IPage) {
                List<JSONObject> items = new ArrayList<>();
                for (Object record : ((IPage) ((Result) result).getResult()).getRecords()) {
                    ObjectMapper mapper = new ObjectMapper();
                    String json="{}";
                    try {
                        //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
                         json = mapper.writeValueAsString(record);
                    } catch (JsonProcessingException e) {
                        log.error("json解析失败"+e.getMessage(),e);
                    }
                    JSONObject item = JSONObject.parseObject(json);
                    //update-begin--Author:scott -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                    //for (Field field : record.getClass().getDeclaredFields()) {
                    for (Field field : oConvertUtils.getAllFields(record)) {
                    //update-end--Author:scott  -- Date:20190603 ----for:解决继承实体字段无法翻译问题------
                        if (field.getAnnotation(Dict.class) != null) {
                            String code = field.getAnnotation(Dict.class).dicCode();
                            String text = field.getAnnotation(Dict.class).dicText();
                            String table = field.getAnnotation(Dict.class).dictTable();
                            String key = String.valueOf(item.get(field.getName()));

                            //翻译字典值对应的txt
                            String textValue = translateDictValue(code, text, table, key);

                            log.debug(" 字典Val : "+ textValue);
                            log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
                        }
                        //date类型默认转换string格式化日期
                        if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
                            SimpleDateFormat aDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
                        }
                    }
                    items.add(item);
                }
                ((IPage) ((Result) result).getResult()).setRecords(items);
            }
            //TODO:增加用户自由度 
			else if (((Result) result).getResult() instanceof List) {
					...
			} else ...

        }
	2:前端Vue项目中下拉选择框是否可以自定义一些初始选中项 抑或是默认选中第一个值

  <a-select
    v-else-if="tagType=='select'"
    :value="arrayValue"
    @change="onChange"
    :disabled="disabled"
    mode="multiple"
    :placeholder="placeholder"
    :getPopupContainer="getParentContainer"
    optionFilterProp="children"
    :filterOption="filterOption"
    allowClear>
    //TODO:
	<!----------增加初始  类似-----------------!>
	<a-select-option
      :value="">
      <span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
        -----------请选择---------- 
      </span>
    </a-select-option>
    <a-select-option
      v-for="(item,index) in dictOptions"
      :key="index"
      :value="item.value">
      <span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
        {{ item.text || item.label }}
      </span>
    </a-select-option>
  </a-select>

当然因为jeecgboot 版本升级通常都是大升级,所以在项目上线之后再去升级版本通常会失败抑或是非常困难,所以当有些重大BUG时是否可以为之前版本单独出一些升级JAR包解决方案。(之前工信部检查上线项目的时候,升级版本导致通宵,记忆犹新)尤其当前端还是VUE2,后端使用jeecgboot3时,一直配置项更新在文档中没有提及,一步步试错走过的痛苦是在不太想再次体验

最后当然就是希望jeecg能够越办越好,让更多人开发者享受快乐开发,从简单重复的工作中释放出来,专心解决程序中业务难点。
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值