1, java接口类:
List<BdUserRegisterCompany> findByProductTypeAnd(@Param("typeIdArray") String[] typeIdArray,
@Param("industryArray") String[] industryArray);
2,mapper.xml:
SELECT t.NAME ,t.REGISTER_TYPE, t.MEMBER_CODE,t.USERID FROM bd_user_register t join bd_user_register_company c on t.USERID=c.register_id where 1=1 <if test="typeIdArray != null and typeIdArray != ''">
<foreach collection="typeIdArray" item="typeId" index="index" >
and find_in_set(#{typeId},c.product_type_sub)
</foreach>
</if>
collection="java方法的数组名" item="随便起的名字,遍历时的变量“ index="index"
函数 find_in_set(参数,字段名),应该相当于 字段c.product_type_sub 包含参数typeId,
比如字段值1000,10002,1223,234 参数是个数组1000,1223
那么就查出了一条,因为字段包含了这两个参数