mirror of
https://gitee.com/EMF/solon-manager.git
synced 2025-12-06 08:48:33 +08:00
feat: 构建自定义controller注解
This commit is contained in:
parent
e8c98366fd
commit
102f5ddc2e
@ -1,11 +1,18 @@
|
||||
package vip.fuck.sm.plugins.cms;
|
||||
|
||||
import org.noear.solon.annotation.Controller;
|
||||
import org.noear.solon.core.AppContext;
|
||||
import org.noear.solon.core.Plugin;
|
||||
import vip.fuck.sm.plugins.cms.routes.RouteMapping;
|
||||
|
||||
public class CmsPlugin implements Plugin {
|
||||
@Override
|
||||
public void start(AppContext context) throws Throwable {
|
||||
System.out.println("cms.test.plugins");
|
||||
context.beanBuilderAdd(RouteMapping.class, (clz, bw, anno) -> {
|
||||
if (context.app() != null) {
|
||||
context.app().router().add(bw);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import vip.fuck.sm.plugins.cms.Feedback;
|
||||
import vip.fuck.sm.plugins.cms.entity.Admin;
|
||||
import vip.fuck.sm.plugins.cms.entity.AdminRole;
|
||||
import vip.fuck.sm.plugins.cms.entity.Role;
|
||||
import vip.fuck.sm.plugins.cms.routes.RouteMapping;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@ -26,8 +27,7 @@ import java.util.HashMap;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapping(value = "/admin/admin")
|
||||
|
||||
@RouteMapping(url = "/admin/admin")
|
||||
public class AdminController extends BaseController {
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package vip.fuck.sm.plugins.cms.solon;
|
||||
|
||||
import org.noear.solon.core.BeanBuilder;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
import org.noear.solon.data.datasource.DsUtils;
|
||||
import vip.fuck.sm.plugins.cms.routes.RouteMapping;
|
||||
|
||||
public class DbBeanBuilderImpl implements BeanBuilder<RouteMapping> {
|
||||
public DbBeanBuilderImpl() {
|
||||
}
|
||||
|
||||
public void doBuild(Class<?> clz, BeanWrap bw, RouteMapping anno) throws Throwable {
|
||||
if (!clz.isInterface()) {
|
||||
DsUtils.observeDs(bw.context(), anno.url(), (dsWrap) -> {
|
||||
// this.create0(clz, dsWrap);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// private void create0(Class<?> clz, BeanWrap dsBw) {
|
||||
// Object raw = MybatisAdapterManager.get(dsBw).getMapper(clz);
|
||||
// dsBw.context().wrapAndPut(clz, raw);
|
||||
// }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user