一、常用SQL
1. 批量添加
/**
* 批量保存 关系
* @param addList
*/
void batchAdd(List<ObjectCommissionOfficeRelationship> addList);
<insert id="batchAdd" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
INSERT INTO tb_object_commission_office_relationship (id,commissionOfficeId, objectId, createUserId, createTime) VALUES
<foreach collection="list" index="index" item="item" separator=",">
(#{item.id},#{item.commissionOfficeId},#{item.objectId},#{item.createUserId},#{item.createTime})
</foreach>
</insert>
2. 根据ID集合查询数据
/**
* 根据id集合查询对象信息
*
* @param commissionOfficeIds
* @return
*/
List<ObjectCommissionOfficeRelationship> getObjectsByCommissionOfficeIds(List<String> commissionOfficeIds);
<select id="getObjectsByCommissionOfficeIds" parameterType="java.util.List" resultType="net.longjin.objectlibrary.entitys.objectLibrary.ObjectCommissionOfficeRelationship">
SELECT * FROM tb_object_commission_office_relationship WHERE commissionOfficeId IN
<foreach collection="list" item="coId" open="(" close=")" separator=",">
#{coId}
</foreach>
</select>