|  |  |  | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | id, orderId, billType, billHeaderType, companyName, companyTaxNumber, billContent, moreContent, billAmount, addresseeName, addresseePhone, addresseeEmail, state, createTime | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="getPageList" resultType="com.stylefeng.guns.modular.system.model.TBill"> | 
|---|
|  |  |  | SELECT b.id, b.orderId, b.billType, b.billHeaderType, b.companyName, b.companyTaxNumber, b.billContent, b.moreContent, b.billAmount, b.addresseeName, b.addresseePhone, | 
|---|
|  |  |  | b.addresseeEmail, b.state, b.createTime | 
|---|
|  |  |  | FROM t_bill b | 
|---|
|  |  |  | LEFT JOIN t_order o ON b.orderId = o.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> | 
|---|
|  |  |  | AND b.createTime BETWEEN #{startTime} AND #{endTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="addresseePhone != null and addresseePhone != ''"> | 
|---|
|  |  |  | AND b.addresseePhone LIKE concat('%',#{addresseePhone},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="state != null"> | 
|---|
|  |  |  | AND b.state = #{state} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="billType != null"> | 
|---|
|  |  |  | AND b.billType = #{billType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="billHeaderType != null"> | 
|---|
|  |  |  | AND b.billHeaderType = #{billHeaderType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="roleType != null and roleType == 2"> | 
|---|
|  |  |  | AND o.branchOfficeId = #{objectId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="roleType != null and roleType == 3"> | 
|---|
|  |  |  | AND o.agentId = #{objectId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY b.createTime DESC | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|