<?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.community.huiju.dao.BillMapper">
    <select id="selectListByParams" resultType="com.community.huiju.model.Bill">
        SELECT
            t.id,
            t.community_id,
            t.bill_name,
            t.bill_explain,
            t.pay_total_num,
            t.payed_num,
            t.unpayed_num,
            t.bill_status,
            t.end_date,
            t.create_user,
            t.create_date,
            t.update_user,
            t.update_date
        FROM
            tp_bill t
        WHERE
        1 = 1
        AND t.community_id = #{bill.communityId}
        <if test="bill.id != null and bill.id != '' or bill.id ==0">
            and t.id like concat('%',#{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.billExplain != null and bill.billExplain != ''">
            and t.bill_explain like concat('%',#{bill.billExplain,jdbcType=VARCHAR},'%')
        </if>
        order by t.id DESC
    </select>
</mapper>
