<?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="com.api.manage.dao.resources.ResourcesImgDao">
    <select id="findImgByDate" parameterType="com.api.model.resources.ResourcesImg" resultType="com.api.vo.resources.VoResourcesImg">
        select * from resources_img
        where table_name = #{tableName}
        and date_id = #{dateId}
        and type_name = #{typeName}
        order by sort
    </select>

    <select id="countByData" parameterType="com.api.model.resources.ResourcesImg" resultType="java.lang.Integer">
        select count(*) from resources_img
        where table_name = #{tableName}
        and date_id = #{dateId}
        and type_name = #{typeName}
    </select>

    <insert id="insert" parameterType="com.api.model.resources.ResourcesImg">
        insert into resources_img(
            table_name,
            date_id,
            type_name,
            url,
            size,
            longs,
            paragraph,
            sort
        ) values (
            #{tableName},
            #{dateId},
            #{typeName},
            #{url},
            #{size},
            #{longs},
            #{paragraph},
            #{sort}
        )
    </insert>

    <delete id="deleteImgByDate" parameterType="com.api.model.resources.ResourcesImg">
        delete from resources_img
        where table_name = #{tableName}
        and date_id = #{dateId}
        and type_name = #{typeName}
    </delete>
</mapper>