1.新增:--返回值为增加的的行数
int insertLableBatch(@Param("list")List list);
SQL语句
insert into ti_user_group_filter_label
(emp_group_id,label_type,label_code,label_name,label_symbol,label_content,label_valid,create_name,create_emp,create_time)
values
(
#{re.empGroupId,jdbcType=INTEGER},
#{re.labelType,jdbcType=VARCHAR},
#{re.labelCode,jdbcType=VARCHAR},
#{re.labelName,jdbcType=VARCHAR},
#{re.labelSymbol,jdbcType=VARCHAR},
#{re.labelContent,jdbcType=VARCHAR},
#{re.labelValid,jdbcType=INTEGER},
#{re.createName,jdbcType=VARCHAR},
#{re.createEmp,jdbcType=VARCHAR},
now()
)
2修改:
int updateLableBatch(@Param("list")List list);
SQL语句
update ti_user_group_filter_label
emp_group_id = #{item.empGroupId,jdbcType=INTEGER},
label_type = #{item.labelType,jdbcType=VARCHAR},
label_code = #{item.labelCode,jdbcType=VARCHAR},
label_name = #{item.labelName,jdbcType=VARCHAR},
label_symbol = #{item.labelSymbol,jdbcType=VARCHAR},
label_content = #{item.labelContent,jdbcType=VARCHAR},
label_valid = #{item.labelValid,jdbcType=INTEGER},
modify_emp = #{item.modifyEmp,jdbcType=VARCHAR},
modify_name = #{item.modifyName,jdbcType=VARCHAR},
modify_time = now()
where id = #{item.id,jdbcType=INTEGER}
3.批量删除
/**
*
* 方法描述:根据ids集合进行删除
* @return
*/
int deleteByIds(List ids);
二、Mapper.xml动态sql
collection:传递来的参数,可以是list,array(数组),还可以是map的key,可以是pojo中的属性
item:循环中的当前元素
index:当前元素的下标
open:循环的开始
close:循环的结束
separator:分隔符
delete from user where id in
#{id}
这段SQL最终会被自动组合成:delete from user where id in ( ? , ? )