|
@@ -19,72 +19,12 @@
|
|
<result column="indate" property="indate" />
|
|
<result column="indate" property="indate" />
|
|
<result column="remarks" property="remarks" />
|
|
<result column="remarks" property="remarks" />
|
|
<result column="payment" property="payment" />
|
|
<result column="payment" property="payment" />
|
|
|
|
+ <result column="sec_type_id" property="secTypeId" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
- id, company_id, creator_id, start_date, end_date, number, project_id, name, amounts, type_id, checkerId, status, indate, remarks, payment
|
|
|
|
|
|
+ id, company_id, creator_id, start_date, end_date, number, project_id, name, amounts, type_id, checkerId, status, indate, remarks, payment, sec_type_id
|
|
</sql>
|
|
</sql>
|
|
- <select id="selectContract" resultType="com.management.platform.entity.Contract">
|
|
|
|
- select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,contract_type.type_name,contract.status,contract.indate,contract.remarks,
|
|
|
|
- contract.start_date as startDate,contract.end_date as endDate,
|
|
|
|
- user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount
|
|
|
|
- from contract
|
|
|
|
- left join contract_type
|
|
|
|
- on contract.type_id = contract_type.id
|
|
|
|
- LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
|
|
|
|
- left join user
|
|
|
|
- on contract.creator_id = user.id
|
|
|
|
- where contract.company_id = #{companyId}
|
|
|
|
- <if test="number!=null">
|
|
|
|
- and number like #{number}
|
|
|
|
- </if>
|
|
|
|
- <if test="name!=null">
|
|
|
|
- and contract.name like #{name}
|
|
|
|
- </if>
|
|
|
|
- <if test="typeName!=null">
|
|
|
|
- and contract_type.id = #{typeName}
|
|
|
|
- </if>
|
|
|
|
- <if test="status!=null">
|
|
|
|
- and status = #{status}
|
|
|
|
- </if>
|
|
|
|
- <if test="startDate!=null and endDate !=null">
|
|
|
|
- and indate between #{startDate} and #{endDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="paymentStartDate != null and paymentEndDate != null">
|
|
|
|
- and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
|
|
|
|
- </if>
|
|
|
|
- order by contract.id desc
|
|
|
|
- <if test="pageStart!=null and pageSize!=null">
|
|
|
|
- limit #{pageStart},#{pageSize}
|
|
|
|
- </if>
|
|
|
|
- </select>
|
|
|
|
|
|
|
|
- <select id="selectContractCnt" resultType="java.lang.Long">
|
|
|
|
- select count(1) from contract
|
|
|
|
- left join contract_type
|
|
|
|
- on contract.type_id = contract_type.id
|
|
|
|
- LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
|
|
|
|
- left join user
|
|
|
|
- on contract.creator_id = user.id
|
|
|
|
- where contract.company_id = #{companyId}
|
|
|
|
- <if test="number!=null">
|
|
|
|
- and number like #{number}
|
|
|
|
- </if>
|
|
|
|
- <if test="name!=null">
|
|
|
|
- and contract.name like #{name}
|
|
|
|
- </if>
|
|
|
|
- <if test="typeName!=null">
|
|
|
|
- and contract_type.id = #{typeName}
|
|
|
|
- </if>
|
|
|
|
- <if test="status!=null">
|
|
|
|
- and status = #{status}
|
|
|
|
- </if>
|
|
|
|
- <if test="startDate!=null and endDate !=null">
|
|
|
|
- and indate between #{startDate} and #{endDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="paymentStartDate != null and paymentEndDate != null">
|
|
|
|
- and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
|
|
|
|
- </if>
|
|
|
|
- </select>
|
|
|
|
</mapper>
|
|
</mapper>
|