|
@@ -4,28 +4,145 @@
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="cn.cslg.permission.mapper.qiaobi.PayOrderMapper">
|
|
|
|
|
|
- <resultMap id="BaseResultMap" type="cn.cslg.permission.domain.qiaobi.PayOrder">
|
|
|
- <id property="id" column="ID" jdbcType="INTEGER"/>
|
|
|
- <result property="tradeNo" column="TRADE_NO" jdbcType="VARCHAR"/>
|
|
|
- <result property="orderStatus" column="ORDER_STATUS" jdbcType="INTEGER"/>
|
|
|
- <result property="orgPrice" column="ORG_PRICE" jdbcType="DOUBLE"/>
|
|
|
- <result property="discount" column="DISCOUNT" jdbcType="DOUBLE"/>
|
|
|
- <result property="truePrice" column="TRUE_PRICE" jdbcType="DOUBLE"/>
|
|
|
- <result property="discountReason" column="DISCOUNT_REASON" jdbcType="VARCHAR"/>
|
|
|
- <result property="payTime" column="PAY_TIME" jdbcType="TIMESTAMP"/>
|
|
|
- <result property="createId" column="CREATE_ID" jdbcType="INTEGER"/>
|
|
|
- <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
|
|
- <result property="goodCount" column="GOOD_COUNT" jdbcType="INTEGER"/>
|
|
|
- <result property="goodMessage" column="GOOD_MESSAGE" jdbcType="VARCHAR"/>
|
|
|
- <result property="orderType" column="ORDER_TYPE" jdbcType="INTEGER"/>
|
|
|
- <result property="marketStartegy" column="MARKET_STARTEGY" jdbcType="VARCHAR"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <sql id="Base_Column_List">
|
|
|
- ID,TRADE_NO,ORDER_STATUS,
|
|
|
- ORG_PRICE,DISCOUNT,TRUE_PRICE,
|
|
|
- DISCOUNT_REASON,PAY_TIME,CREATE_ID,
|
|
|
- CREATE_TIME,GOOD_COUNT,GOOD_MESSAGE,
|
|
|
- ORDER_TYPE,MARKET_STARTEGY
|
|
|
- </sql>
|
|
|
+ <select id="queryPayRecord" resultType="cn.cslg.permission.common.model.qiaobi.payOrder.PayOrderQueryVO">
|
|
|
+ select a.* from PAY_ORDER as a left join PERSON_RELATION as b on a.CREATE_ID=b.PERSON_ID2
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="invitePersonName!=null and !invitePersonName.trim().equals('')">
|
|
|
+ and b.PERSON_ID1 in(select ID from PERSONNEL where PERSONNEL_NAME like
|
|
|
+ concat('%',#{invitePersonName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="tenantName!=null and !tenantName.trim().equals('')">
|
|
|
+ and a.TENANT_ID in (select ID from TENANT where TENANT_NAME like concat('%',#{tenantName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="personName!=null and !personName.trim().equals('')">
|
|
|
+ and CREATE_ID in (select ID from PERSONNEL where PERSONNEL_NAME like concat('%',#{personName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d')<=DATE_FORMAT(#{startTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d') <=DATE_FORMAT(#{endTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="tenantId!=null ">
|
|
|
+ and TENANT_ID=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="personId!=null ">
|
|
|
+ and CREATE_ID=#{personId}
|
|
|
+ </if>
|
|
|
+ <if test="current!=null and size!=null">
|
|
|
+ limit #{current},#{size}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryPayRecordTotal" resultType="java.lang.Long">
|
|
|
+ select count(*) from PAY_ORDER as a left join PERSON_RELATION as b on a.CREATE_ID=b.PERSON_ID2
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="invitePersonName!=null and !invitePersonName.trim().equals('')">
|
|
|
+ and b.PERSON_ID1 in(select ID from PERSONNEL where PERSONNEL_NAME like
|
|
|
+ concat('%',#{invitePersonName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="tenantName!=null and !tenantName.trim().equals('')">
|
|
|
+ and a.TENANT_ID in (select ID from TENANT where TENANT_NAME like concat('%',#{tenantName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="personName!=null and !personName.trim().equals('')">
|
|
|
+ and CREATE_ID in (select ID from PERSONNEL where PERSONNEL_NAME like concat('%',#{personName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d')<=DATE_FORMAT(#{startTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d') <=DATE_FORMAT(#{endTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="tenantId!=null ">
|
|
|
+ and TENANT_ID=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="personId!=null ">
|
|
|
+ and CREATE_ID=#{personId}
|
|
|
+ </if>
|
|
|
+ <if test="current!=null and size!=null">
|
|
|
+ limit #{current},#{size}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="groupPayRecord" resultType="cn.cslg.permission.common.model.qiaobi.payOrder.PayOrderGroupVO">
|
|
|
+ select ${groupField} as groupKey, count(distinct CREATE_ID) as personNum,sum(cast(TRUE_PRICE as decimal(18,2)))
|
|
|
+ as groupPrice from PAY_ORDER as a
|
|
|
+ left join PERSON_RELATION as b on a.CREATE_ID=b.PERSON_ID2
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="invitePersonName!=null and !invitePersonName.trim().equals('')">
|
|
|
+ and b.PERSON_ID1 in(select ID from PERSONNEL where PERSONNEL_NAME like
|
|
|
+ concat('%',#{invitePersonName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="tenantName!=null and !tenantName.trim().equals('')">
|
|
|
+ and a.TENANT_ID in (select ID from TENANT where TENANT_NAME like concat('%',#{tenantName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="personName!=null and !personName.trim().equals('')">
|
|
|
+ and CREATE_ID in (select ID from PERSONNEL where PERSONNEL_NAME like concat('%',#{personName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d')<=DATE_FORMAT(#{startTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d') <=DATE_FORMAT(#{endTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="tenantId!=null ">
|
|
|
+ and TENANT_ID=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="personId!=null ">
|
|
|
+ and CREATE_ID=#{personId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ group by ${groupField}
|
|
|
+ <if test="current!=null and size!=null">
|
|
|
+ limit #{current},#{size}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="groupPayRecordTotal" resultType="java.lang.Long">
|
|
|
+ select count(*) from (select a.* from PAY_ORDER as a
|
|
|
+ left join PERSON_RELATION as b on a.CREATE_ID=b.PERSON_ID2
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="invitePersonName!=null and !invitePersonName.trim().equals('')">
|
|
|
+ and b.PERSON_ID1 in(select ID from PERSONNEL where PERSONNEL_NAME like
|
|
|
+ concat('%',#{invitePersonName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="tenantName!=null and !tenantName.trim().equals('')">
|
|
|
+ and a.TENANT_ID in (select ID from TENANT where TENANT_NAME like concat('%',#{tenantName},'%'))
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="personName!=null and !personName.trim().equals('')">
|
|
|
+ and CREATE_ID in (select ID from PERSONNEL where PERSONNEL_NAME like concat('%',#{personName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d')<=DATE_FORMAT(#{startTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime!=null ">
|
|
|
+ and DATE_FORMAT(CREATE_TIME, '%Y-%m-%d') <=DATE_FORMAT(#{endTime}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="tenantId!=null ">
|
|
|
+ and TENANT_ID=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="personId!=null ">
|
|
|
+ and CREATE_ID=#{personId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ group by ${groupField}
|
|
|
+ ) as t
|
|
|
+ </select>
|
|
|
</mapper>
|