123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.dayou.mapper.DyoaRecordMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dayou.entity.DyoaRecord">
- <result column="id" property="id" />
- <result column="modified" property="modified" />
- <result column="created" property="created" />
- <result column="deleted" property="deleted" />
- <result column="mbs_type" property="mbsType" />
- <result column="mbs_id" property="mbsId" />
- <result column="dyoa_id" property="dyoaId" />
- <result column="user_id" property="userId" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id,
- modified,
- created,
- deleted,
- mbs_type, mbs_id, dyoa_id, user_id
- </sql>
- <select id="getMaxOrderTime" resultType="java.util.Date">
- select max(order_datetime) from dyoa_record where mbs_type = 'PERSONAL_ORDER'
- </select>
- <select id="getMaxPersonalTargetTime" resultType="java.util.Date">
- select max(order_datetime) from dyoa_record where mbs_type = 'PERSONAL_TARGET'
- </select>
- <select id="getMaxRealAmountCreatedTime" resultType="java.util.Date">
- select max(order_datetime) from dyoa_record where mbs_type = 'REAL_AMOUNT'
- </select>
- <select id="getMaxClaimDate" resultType="java.util.Date">
- select max(order_datetime) from dyoa_record where mbs_type = 'REAL_AMOUNT_CLAIM'
- </select>
- <select id="selectOrderFundIdByDyoaOrderId" resultType="com.dayou.entity.DyoaRecord">
- SELECT
- m.dyoa_id,
- f.id as mbsId
- FROM
- (
- SELECT
- mbs_id,
- dyoa_id,
- ( CASE mbs_type WHEN 'MAJOR_ORDER' THEN 'MAJOR_BUSINESS' WHEN 'PERSONAL_ORDER' THEN 'PERSONAL_BUSINESS'
- WHEN 'ASSETS_ORDER' THEN 'ASSET_BUSINESS'
- END ) AS mbs_type
- FROM
- dyoa_record
- WHERE
- mbs_type IN ( 'MAJOR_ORDER','PERSONAL_ORDER','ASSETS_ORDER' )) m
- LEFT JOIN order_fund f ON (
- f.business_id = m.mbs_id
- AND f.business_type = m.mbs_type) where f.id is not null GROUP BY m.dyoa_id
- </select>
- <select id="getMaxFinanceInvoiceCreatedTime" resultType="java.util.Date">
- select max(order_datetime) from dyoa_record where mbs_type = 'FINANCE_INVOICE'
- </select>
- <select id="getMbsIdByDyOAId" parameterType="java.lang.String" resultType="java.lang.Long">
- select mbs_id from dyoa_record where dyoa_id = #{id} and mbs_type = 'MAJOR_ORDER'
- </select>
- <select id="getMbsIdByDyOAIdForAssets" parameterType="java.lang.String" resultType="java.lang.Long">
- select mbs_id from dyoa_record where dyoa_id = #{id} and mbs_type = 'ASSETS_ORDER'
- </select>
- <select id="findPersonalProduction" resultType="com.dayou.dto.history.HisPersonalProduction">
- select id,bgInRepoTime,bgOutRepoTime from dy_order_loan
- where masterName IS NOT NULL
- and deleted = 0
- </select>
- <select id="getPersonalTargetId" parameterType="java.lang.String" resultType="java.lang.Long">
- select id from personal_target where personal_id = (select mbs_id from dyoa_record where dyoa_id = #{id})
- </select>
- <select id="findAssetsProduction" resultType="com.dayou.dto.history.HisPersonalProduction">
- select id,bgInTime as bgInRepoTime,bgOutTime as bgOutRepoTime,confirmTime from dy_assets
- where
- deleted = 0
- </select>
- <select id="getMbsIdByDyOAiDForInvoice" parameterType="java.lang.String" resultType="com.dayou.entity.FinanceInvoice">
- SELECT
- *
- FROM
- finance_invoice
- WHERE
- id = (
- SELECT
- mbs_id
- FROM
- dyoa_record
- WHERE
- dyoa_id = #{dyoaId}
- AND mbs_type = 'FINANCE_INVOICE')
- </select>
- <select id="getMbsRealAmountId" resultType="java.lang.Long">
- select mbs_id from dyoa_record where mbs_type = #{name} and dyoa_id = #{incomeId} and deleted = 0
- </select>
- <select id="getMembersAndSignerInDyoa" parameterType="java.lang.Long" resultType="java.lang.String">
- select dyoa_id from dyoa_record where mbs_type = 'ASSETS_ORDER' and mbs_id = #{id} and deleted = 0
- </select>
- <select id="getDyoaIdByMbsPersonalId" parameterType="java.lang.Long" resultType="java.lang.String">
- select dyoa_id from dyoa_record where deleted = 0 and mbs_type = 'PERSONAL_ORDER' and mbs_id = #{personalId}
- </select>
- </mapper>
|