|
@@ -0,0 +1,130 @@
|
|
|
|
+<!DOCTYPE mapper
|
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
+
|
|
|
|
+<mapper namespace="com.bosshand.virgo.api.dao.PaymentOrdinaryDao">
|
|
|
|
+
|
|
|
|
+ <resultMap type="com.bosshand.virgo.api.model.PaymentOrdinary" id="result">
|
|
|
|
+ <id column="id" property="id"/>
|
|
|
|
+ <result column="name" property="name"/>
|
|
|
|
+ <result column="date" property="date"/>
|
|
|
|
+ <result column="reminderDate" property="reminderDate"/>
|
|
|
|
+ <result column="projectId" property="projectId"/>
|
|
|
|
+ <result column="organizationId" property="organizationId"/>
|
|
|
|
+ <result column="organizationName" property="organizationName"/>
|
|
|
|
+ <result column="payMerchantId" property="payMerchantId"/>
|
|
|
|
+ <result column="payMerchantName" property="payMerchantName"/>
|
|
|
|
+ <result column="payClientId" property="payClientId"/>
|
|
|
|
+ <result column="payClientName" property="payClientName"/>
|
|
|
|
+ <result column="tenantType" property="tenantType"/>
|
|
|
|
+ <result column="amount" property="amount"/>
|
|
|
|
+ <result column="data" property="data"/>
|
|
|
|
+ <result column="status" property="status"/>
|
|
|
|
+ <result column="type" property="type"/>
|
|
|
|
+ </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>
|
|
|
|
+
|
|
|
|
+ <delete id="delete">
|
|
|
|
+ DELETE from payment_ordinary where id=#{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary">
|
|
|
|
+ UPDATE payment_ordinary
|
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
|
+ <if test="reminderDate != null">reminderDate = #{reminderDate},</if>
|
|
|
|
+ <if test="projectId != 0">projectId = #{projectId},</if>
|
|
|
|
+ <if test="organizationId != 0">organizationId = #{organizationId},</if>
|
|
|
|
+ <if test="payMerchantId != 0">payMerchantId = #{payMerchantId},</if>
|
|
|
|
+ <if test="payClientId != 0">payClientId = #{payClientId},</if>
|
|
|
|
+ <if test="tenantType != null">tenantType = #{tenantType},</if>
|
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
|
+ <if test="type != null">type = #{type},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ WHERE id=#{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary" resultType="Integer">
|
|
|
|
+ SELECT count(*) FROM payment_ordinary
|
|
|
|
+ <where>
|
|
|
|
+ <if test="name != null">
|
|
|
|
+ and name = #{name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="reminderDate != null">
|
|
|
|
+ and reminderDate = #{reminderDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="projectId != 0">
|
|
|
|
+ and projectId = #{projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organizationId != 0">
|
|
|
|
+ and organizationId = #{organizationId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="payMerchantId != 0">
|
|
|
|
+ and payMerchantId = #{payMerchantId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="payClientId != 0">
|
|
|
|
+ and payClientId = #{payClientId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="tenantType != null">
|
|
|
|
+ and tenantType = #{tenantType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ and status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type != null">
|
|
|
|
+ and type = #{type}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <sql id="query">
|
|
|
|
+ SELECT a.*, b.name as organizationName, c.name as payMerchantName, d.name as payClientName 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
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="get" resultMap="result">
|
|
|
|
+ <include refid="query"/> where a.id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getLimit" resultMap="result">
|
|
|
|
+ <include refid="query"/>
|
|
|
|
+ <where>
|
|
|
|
+ <if test="p.name != null">
|
|
|
|
+ and a.name = #{p.name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.reminderDate != null">
|
|
|
|
+ and a.reminderDate = #{p.reminderDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.projectId != 0">
|
|
|
|
+ and a.projectId = #{p.projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.organizationId != 0">
|
|
|
|
+ and a.organizationId = #{p.organizationId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.payMerchantId != 0">
|
|
|
|
+ and a.payMerchantId = #{p.payMerchantId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.payClientId != 0">
|
|
|
|
+ and a.payClientId = #{p.payClientId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.tenantType != null">
|
|
|
|
+ and a.tenantType = #{p.tenantType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.status != null">
|
|
|
|
+ and a.status = #{p.status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="p.type != null">
|
|
|
|
+ and a.type = #{p.type}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ limit #{currIndex} , #{pageSize}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+</mapper>
|