dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Improvement][Dao] Further encapsulation of BaseDao avoids writing many conditional queries

Open ruanwenjun opened this issue 7 months ago • 2 comments

Search before asking

  • [x] I had searched in the issues and found no similar feature requirement.

Description

Avoid provide many query method in dao/mapper e.g. queryByName, queryByNameAndStatus

Are you willing to submit a PR?

  • [x] Yes I am willing to submit a PR!

Code of Conduct

ruanwenjun avatar Apr 30 '25 08:04 ruanwenjun

Hey, I have a idea with that. We can integrate the ServiceImpl class from MyBatis-Plus into the BaseDao. The ServiceImpl provides a lambdaQueryChain method that enables basic data querying with multiple conditions without writing new methods. Image

yingh0ng avatar May 09 '25 02:05 yingh0ng

Hey, I have a idea with that. We can integrate the ServiceImpl class from MyBatis-Plus into the BaseDao. The ServiceImpl provides a lambdaQueryChain method that enables basic data querying with multiple conditions without writing new methods. Image

I don't want to provide queryByCodes in Dao, since this still need to write a lot of query method in dao, and we can exposed queryByCondition in dao https://github.com/apache/dolphinscheduler/pull/17163.

This may cause the service to add some work when using the dao, but this is ok, since some query method is only used once.

ruanwenjun avatar May 09 '25 13:05 ruanwenjun