Microsoft Dynamic AX中多个Form传递参数方法

1.建立三个Form,命名为:Form1, Form2, Form3;

2.任意创建或者拖拽一个Table。

3.为三个Form分别添加Button。

4.将Table托拽到Form1>Data Source中

5. 为Form1添加Grid并将需要字段拖拽到Grid中:


…只是练习,所以做的简陋,见谅,低调!阿弥陀佛!!!

6. Form1>Methods

public class FormRun extends ObjectRun

{

    FormRun             formRun;

    zwStudents          student;

}

str testFunc(str _b = "abcd")

{

    return _b;

}

public void init()

{

    super();

}

public void create()

{

    Args        args;

    FormRun     formCreate;

    Container       con;

    Common          com;

    ;

    con = [6,7];

    args = new Args();

    args.name(formstr(Form2));

    args.caller(formRun);

    select firstonly student

        where student.StudentId == "123";

    args.record(student);

    formCreate = classfactory.formRunClass(args);

    formCreate.init();

    formCreate.run();

    formCreate.wait();

}

Design>Button>Methods

void clicked()

{

    element.create();

    super();

}

7. Form2>Methods

public class FormRun extends ObjectRun

{

    FormRun             formRun;

    zwStudents          student;

}

public void init()

{

    student = element.args().record();

    super();

}

public void create()

{

    Args        args;

    FormRun     formCreate;

    ;

    info(student.StudentId);

    args = new Args();

    args.name(formstr(Form3));

    args.caller(formRun);

    args.record(student);

    formCreate = classfactory.formRunClass(args);

    formCreate.init();

    formCreate.run();

    formCreate.wait();

}

Design>Button>Methods

void clicked()

{

    element.create();

    super();

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面我来详细介绍一下 SpringBoot+Dynamic 多数据源动态切换的实现方法。 1. 添加依赖 在 pom.xml 文件添加以下依赖: ```xml <!-- MyBatis Plus --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.2</version> </dependency> <!-- Druid 数据源 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.6</version> </dependency> <!-- Dynamic DataSource --> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>2.5.3</version> </dependency> ``` 2. 配置数据源 在 application.yml 文件配置数据源信息: ```yaml spring: datasource: druid: driver-class-name: com.mysql.jdbc.Driver initial-size: 5 max-active: 10 min-idle: 3 filters: stat,wall,slf4j # 主数据源 master: url: jdbc:mysql://localhost:3306/db_master?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC username: root password: 123456 # 从数据源 slave: url: jdbc:mysql://localhost:3306/db_slave?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC username: root password: 123456 ``` 3. 配置 DynamicDataSource 在 SpringBoot 启动类上添加 @EnableDynamicDataSource 注解,开启动态数据源功能: ```java @SpringBootApplication @EnableDynamicDataSource public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } ``` 4. 配置 MyBatis Plus 在 MyBatis Plus 的配置文件添加以下配置: ```java @Configuration @MapperScan("com.example.demo.mapper") public class MybatisPlusConfig { @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new DynamicTableNameInnerInterceptor(new TableNameParser() { @Override public String parse(String tableName) { // 根据业务需求动态返回表名 return tableName; } })); return interceptor; } } ``` 5. 编写动态数据源切换逻辑 在需要切换数据源的地方,通过 DynamicDataSourceContextHolder 切换数据源: ```java @Service public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper; @Override public List<User> getUserList() { // 切换到从数据源 DynamicDataSourceContextHolder.setDataSourceKey("slave"); List<User> userList = userMapper.selectList(null); // 切换回主数据源 DynamicDataSourceContextHolder.setDataSourceKey("master"); return userList; } } ``` 6. 测试 启动 SpringBoot 项目,调用 getUserList 方法,查看控制台输出日志,可以看到动态切换数据源的日志信息。 以上就是 SpringBoot+Dynamic 多数据源动态切换的详细实现方法

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值