dcs 5 maanden geleden
bovenliggende
commit
59d3ddb02c

+ 26 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/PaymentOrdinary.java

@@ -14,6 +14,16 @@ public class PaymentOrdinary {
 
     private long id;
 
+    /**
+     * 合同id
+     */
+    private long contractId;
+
+    /**
+     * 合同编码
+     */
+    private String contractCode;
+
     /**
      * 名称
      */
@@ -95,6 +105,22 @@ public class PaymentOrdinary {
         this.id = id;
     }
 
+    public long getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(long contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getContractCode() {
+        return contractCode;
+    }
+
+    public void setContractCode(String contractCode) {
+        this.contractCode = contractCode;
+    }
+
     public String getName() {
         return name;
     }

+ 13 - 3
virgo.api/src/main/resources/mapper/PaymentOrdinaryMapper.xml

@@ -6,6 +6,8 @@
 
     <resultMap type="com.bosshand.virgo.api.model.PaymentOrdinary" id="result">
         <id column="id" property="id"/>
+        <result column="contractId" property="contractId"/>
+        <result column="contractCode" property="contractCode"/>
         <result column="name" property="name"/>
         <result column="date" property="date"/>
         <result column="reminderDate" property="reminderDate"/>
@@ -24,8 +26,8 @@
     </resultMap>
 
     <insert id="insert" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO payment_ordinary(`name`, `date`, `reminderDate`, `projectId`, `organizationId`, `payMerchantId`, `payClientId`, `tenantType`, `amount`, `data`, `status`, `type`)
-        VALUES (#{name}, now(), #{reminderDate}, #{projectId}, #{organizationId}, #{payMerchantId}, #{payClientId}, #{tenantType}, #{amount}, #{data}, #{status}, #{type})
+        INSERT INTO payment_ordinary(`contractId`,`name`, `date`, `reminderDate`, `projectId`, `organizationId`, `payMerchantId`, `payClientId`, `tenantType`, `amount`, `data`, `status`, `type`)
+        VALUES (#{contractId}, #{name}, now(), #{reminderDate}, #{projectId}, #{organizationId}, #{payMerchantId}, #{payClientId}, #{tenantType}, #{amount}, #{data}, #{status}, #{type})
     </insert>
 
     <delete id="delete">
@@ -35,6 +37,7 @@
     <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary">
         UPDATE payment_ordinary
         <trim prefix="set" suffixOverrides=",">
+            <if test="contractId != 0">contractId = #{contractId},</if>
             <if test="name != null">name = #{name},</if>
             <if test="reminderDate != null">reminderDate = #{reminderDate},</if>
             <if test="projectId != 0">projectId = #{projectId},</if>
@@ -53,6 +56,9 @@
     <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary" resultType="Integer">
         SELECT count(*) FROM payment_ordinary
         <where>
+            <if test="contractId != 0">
+                and contractId = #{contractId}
+            </if>
             <if test="name != null">
                 and name = #{name}
             </if>
@@ -89,10 +95,11 @@
     </select>
 
     <sql id="query">
-        SELECT a.*, b.name as organizationName, c.name as payMerchantName, d.name as payClientName FROM payment_ordinary a
+        SELECT a.*, b.name as organizationName, c.name as payMerchantName, d.name as payClientName, e.code as contractCode FROM payment_ordinary a
                                                                                                             LEFT JOIN mgr_organization b ON a.organizationId = b.id
                                                                                                             LEFT JOIN merchant c ON a.payMerchantId = c.id
                                                                                                             LEFT JOIN mgr_client d ON a.payClientId = d.id
+                                                                                                            LEFT JOIN contract e ON a.contractId = e.id
     </sql>
 
     <select id="get" resultMap="result">
@@ -102,6 +109,9 @@
     <select id="getLimit" resultMap="result">
         <include refid="query"/>
         <where>
+            <if test="p.contractId != 0">
+                and a.contractId = #{p.contractId}
+            </if>
             <if test="p.name != null">
                 and a.name = #{p.name}
             </if>