要根据compCode的值进行动态的SQL查询,可以使用MySQL的FIND_IN_SET函数来实现。以下是修改后的SQL语句:

<if test="compCode != null">
    and DELETED_ = 0
    and (FIND_IN_SET(COMP_CODE, #{compCode}) > 0 or FIND_IN_SET(SIGN_COMP_CODE, #{compCode}) > 0)
</if>

这样,当compCode的值为(C0014,D38A070100,C0015,D0013A00000,D0012A00000,1623861300952780801,C0000,D00A230000,D00A002800,D00A002900,D00A001800,D00A113500,D00A001000,D0010A00000,D0010A00001,D0011A00000,D00A000100,D00A084300)时,就可以正确执行查询语句,不会报错。


原文地址: https://www.cveoy.top/t/topic/ixgz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录