<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.edu.whu.boot.collection.mapper.UpdateMapper">

    <update id="updateSql" parameterType="java.lang.String">
        ${updateSql}
    </update>

    <delete id="delete" parameterType="java.lang.String">
        ${deleteSql}
    </delete>

    <update id="updateStatus">
        UPDATE ${tableName}
        SET status = #{status},
            reason = #{reason}
        WHERE ${primaryKey} = #{polygonId}
    </update>

    <update id="updateDataReviewer">
        UPDATE ${tableName} SET reviewer = #{reviewer}
        WHERE ${primaryKey} = #{polygonId}
    </update>


    
    <select id="getMaxId" resultType="java.lang.Integer">
        SELECT max(${column}) from ${tableName}
    </select>

    <update id="updatePrimaryKey">
        SELECT setval('${seqName}'::regclass, #{primaryKey})
    </update>

    <update id="updateDataReviewerAndStatus">
        UPDATE ${tableName}
        SET status = #{status},
            reviewer = #{reviewer}
        WHERE ${primaryKey} = #{polygonId}
    </update>
</mapper>