Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Online代码生成不支持多级包名 #6703

Open
SLiGe opened this issue Jul 5, 2024 · 5 comments
Open

Online代码生成不支持多级包名 #6703

SLiGe opened this issue Jul 5, 2024 · 5 comments

Comments

@SLiGe
Copy link

SLiGe commented Jul 5, 2024

版本号:

v 3.7.0

问题描述:

Online代码生成不支持多级包名,
例如bussi_package配置为com.xxx ,表名为emr_ns_record_config
生成的包名是com.xxx.emr.ns.recordconf.
目前只能通过手动修改bussi_package实现,还要重启项目,比较麻烦

错误截图:

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
@zhangdaiscott
Copy link
Member

有计划优化

@SLiGe
Copy link
Author

SLiGe commented Jul 5, 2024

贴一下临时解决办法:

@Aspect
@Component
public class CodeGenAspect {
    @Around("execution(* org.jeecg.modules.online.cgform.c.a.b(..))")
    public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        // 修改参数值
        JSONObject arg = (JSONObject) joinPoint.getArgs()[0];
        org.jeecg.modules.online.cgform.model.d var2 = JSONObject.parseObject(arg.toJSONString(), org.jeecg.modules.online.cgform.model.d.class);
        String entityPackage = var2.getEntityPackage();
        String[] packages = entityPackage.split("_");
        ResourceBundle bundle = ResourceBundle.getBundle("jeecg/jeecg_config");
        String bussiPackage = bundle.getString("bussi_package");
        if (packages.length > 1) {
           arg.put("entityPackage",packages[packages.length - 1]);
            StringBuilder finalBussiPackage = new StringBuilder(bussiPackage);
            for (int i = 0; i < packages.length - 1; i  ) {
                finalBussiPackage.append(".").append(packages[i]);
            }
            org.jeecgframework.codegenerate.a.a.g = finalBussiPackage.toString();
        } else {
            org.jeecgframework.codegenerate.a.a.g = bussiPackage;
        }
        // 调用原始方法
        return joinPoint.proceed(joinPoint.getArgs());
    }
}

@SLiGe
Copy link
Author

SLiGe commented Jul 5, 2024

贴一下临时解决办法:

@Aspect
@Component
public class CodeGenAspect {
    @Around("execution(* org.jeecg.modules.online.cgform.c.a.b(com.alibaba.fastjson.JSONObject))")
    public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        // 修改参数值
        JSONObject arg = (JSONObject) joinPoint.getArgs()[0];
        org.jeecg.modules.online.cgform.model.d var2 = JSONObject.parseObject(arg.toJSONString(), org.jeecg.modules.online.cgform.model.d.class);
        String entityPackage = var2.getEntityPackage();
        String[] packages = entityPackage.split("_");
        ResourceBundle bundle = ResourceBundle.getBundle("jeecg/jeecg_config");
        String bussiPackage = bundle.getString("bussi_package");
        if (packages.length > 1) {
           arg.put("entityPackage",packages[packages.length - 1]);
            StringBuilder finalBussiPackage = new StringBuilder(bussiPackage);
            for (int i = 0; i < packages.length - 1; i  ) {
                finalBussiPackage.append(".").append(packages[i]);
            }
            org.jeecgframework.codegenerate.a.a.g = finalBussiPackage.toString();
        } else {
            org.jeecgframework.codegenerate.a.a.g = bussiPackage;
        }
        // 调用原始方法
        return joinPoint.proceed(joinPoint.getArgs());
    }
}

不支持RequestMapping多级路由

@zhangdaiscott
Copy link
Member

还有其他地方需要改

@SLiGe
Copy link
Author

SLiGe commented Jul 5, 2024

还有其他地方需要改

其他的地方我也没法追踪了,等着优化了,或者是否可以告知下还需要改动哪里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants