在mybatis中需要返回List<String>结果的话 resultType = "String" 即可
参数为多个对象时 例如一个对象是User 一个对象是list集合
1 此处是使用注解来完成参数区分
public List<ZbZbxx> selectZbZbxxListByZbbhs(@Param(value = "Zbxx") ZbZbxx zbZbxx,@Param(value = "zbbhs") List<String> zbbhs);
2 此处是注意每个对象中的属性需要加上对象名.属性
<where> <if test="Zbxx.yymk != null and Zbxx.yymk != ''"> and Zbxx.yymk = #{yymk}</if> <if test="Zbxx.yycj != null and Zbxx.yycj != ''"> and Zbxx.yycj = #{yycj}</if>
3 关于遍历集合参数 collection应该对应对象名
and zbbh in <foreach item="zbbh" collection="zbbhs" open="(" separator="," close=")"> #{zbbh} </foreach>
关于选中多行按住鼠标中间键选中多行即可
foreach用法复习 for(对象类型 对象名 : 集合名称)
int类型转String类型用 Integer.toString(num) String中取其中带索引的某个字符 用s.charAt(i)