<?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.huiju.estateagents.property.dao.BillMapper">
    <select id="selectListByParams" resultType="com.huiju.estateagents.property.model.Bill">
        SELECT
            t.*
        FROM
            tp_bill t
        WHERE
            t.org_id = #{bill.orgId}
            and t.community_id = #{bill.communityId}
        <if test="bill.id != null">
            and t.id = #{bill.id}
        </if>
        <if test="bill.billName != null and bill.billName != ''">
            and t.bill_name like concat('%',#{bill.billName,jdbcType=VARCHAR},'%')
        </if>
        <if test="bill.startDate != null">
            and t.start_date &gt;= #{bill.startDate}
        </if>
        <if test="bill.endDate != null">
            and t.end_date &lt;= #{bill.endDate}
        </if>
        <if test="bill.isTicket">
            and t.is_ticket = 1
        </if>
        <if test="bill.isTicket == false">
            and t.is_ticket = 0
        </if>
        order by t.id DESC
    </select>
</mapper>
