<?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.yeejoin.amos.boot.module.hygf.api.mapper.HistoryPeasantHouseholdMapper">

    <select id="selectDataInfo" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HistoryPeasantHouseholdDto">
        select * ,file_url as files from hygf_history_peasant_household where sequence_nbr = #{sequenceNbr}
    </select>
    <select id="queryForPage"
            resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HistoryPeasantHouseholdDto">

        select  *, file_url as files from
            hygf_history_peasant_household
        <where>
            <if test="ownersName != null and ownersName != ''">
                hygf_history_peasant_household.owners_name like concat('%',#{ownersName},'%')
            </if>
            <if test="status != null and status != ''">
                hygf_history_peasant_household.status = #{status}
            </if>
            <if test="province != null and province != ''">
                hygf_history_peasant_household.province like concat('%',#{province},'%')
            </if>
            <if test="sequenceNbrs != null and sequenceNbrs.size() > 0">
                hygf_history_peasant_household.sequence_nbr in
            <foreach collection="sequenceNbrs" open="(" close=")" separator="," item="item">
                    #{item}
              </foreach>
            </if>
        </where>

    </select>
</mapper>
