增 返回id
// 增 返回id <insert id="addPic" useGeneratedKeys="true" keyProperty="id"> INSERT INTO table (photo_address,photo_description) VALUES (#{paramCondition.photoAddress},#{paramCondition.photoDescription}) </insert>
批量添加
<insert id="insertBatch"> insert into table (photo_address,photo_description) values <foreach collection="param" separator="," item="item"> (#{item.photoAddress},#{item.photoDescription}) </foreach> </insert>
删
<delete id="delPic" parameterType="int"> DELETE FROM table WHERE id=#{id} </delete>
批量删
<delete id="delPic" > DELETE FROM table WHERE id IN (${ids}) </delete>
改
<update id="updPic" > UPDATE table SET photo_address=#{paramCondition.photoAddress},photo_description=#{paramCondition.photoDescription} WHERE id=#{paramCondition.id} </update>
批量改
<update id="updateBatch" parameterType="java.util.List"> <foreach collection="list" item="item" separator=";"> update table set photo_address=#{item.photoAddress},photo_description=#{item.photoDescription} where id=#{item.id} </foreach> </update>
查
<select id="customMapList" resultType="cn.stylefeng.guns.modular.DemoPro.model.result.DemoResult" parameterType="cn.stylefeng.guns.modular.DemoPro.model.params.DemoParam"> select <include refid="Base_Column_List"/> from table where 1 = 1 </select>