<?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.PreparationMoneyMapper">
<select id="getPeasantHouseholdData" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold">
SELECT hygf_peasant_household.* FROM  hygf_peasant_household
LEFT JOIN  hygf_document_station on hygf_document_station.station_id=hygf_peasant_household.sequence_nbr
 where hygf_document_station.preparation_money_id=#{sequenceNbr}

     <if test="ownersName!=null and ownersName!=''">
         and hygf_peasant_household.owners_name like concat(concat("%",#{ownersName}),"%")
     </if>

</select>

    <select id="selectPageList" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney">
        SELECT * FROM hygf_preparation_money
        <where>
            <if test="dto.consigneeRegion != null and dto.consigneeRegion != ''">
                and hygf_preparation_money.consignee_region like concat ('%',#{dto.consigneeRegion},'%')
            </if>
            <if test="dto.amosUnitName != null and dto.amosUnitName != ''">
                and hygf_preparation_money.amos_unit_name like concat ('%',#{dto.amosUnitName},'%')
            </if>
            <if test="dto.oddNumbers != null and dto.oddNumbers != ''">
                and hygf_preparation_money.odd_numbers like concat ('%',#{dto.oddNumbers},'%')
            </if>
            <if test="dto.deliveryState != null and dto.deliveryState != ''">
                and hygf_preparation_money.delivery_state = #{dto.deliveryState}
            </if>
            <if test="dto.amosUnitId != null and dto.amosUnitId != ''">
                and hygf_preparation_money.amos_unit_id = #{dto.amosUnitId}
            </if>
            <if test="dto.flag != null and dto.flag != ''">
                and hygf_preparation_money.delivery_state != "已作废"
            </if>
            <if test="dto.deliveryTimeStart != null and dto.deliveryTimeEnd != ''">
                and hygf_preparation_money.delivery_time between #{dto.deliveryTimeStart} and #{dto.deliveryTimeEnd}
            </if>
        </where>
        ORDER BY order_time DESC
    </select>
</mapper>
