When I use Mybatis, the DAO interface specifies that the parameter passed is called "param", which is a POJO with two attributes inside. Now I need to make different queries based on the existence of these two attributes. I don't know How to do.
I know that dynamic SQL should be used, but I can only judge whether the POJO exists, and not whether its properties exist, otherwise MyBatis will prompt me that It can't find this property.
/This is the DAO interface, which specifies the parameter name./ public List findByPage(@Param("param")T o,Page page);
/This is its corresponding Mapper file, I can only judge whether one attribute exists, but not whether another attribute exists./
SELECT * FROM ps_jzg j,ps_bm b j.BM_DM = b.DM AND j.BM_DM = #{param.bmDm}
Now, this parameter called "param" has two attributes: bmDm and processid. I need to determine whether these two parameters exist, and then make different queries. Now I can only judge whether the POJO "param" exists. I can't change the DAO interface because it's prescribed by the upper layer.This has been bothering me for a long time. I really need your help. Thank you.