id,amount,surplus_amount,
documentary,property,suborder,
from_bank_card,to_bank_card,user_id,
create_time,business_eegments_type
SELECT
a.reportDate AS reportDate,
MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
FROM
(
SELECT
CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')) reportDate,
property as property,
sum(amount) as amount
FROM
sys_user_account_history
WHERE
documentary=2
and create_time >= #{beginTime} and create_time <= #{endTime}
and user_id=#{userId}
GROUP BY
CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')),
property
) a
GROUP BY
a.reportDate
SELECT
a.reportDate AS reportDate,
MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
FROM
(
SELECT
CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')) reportDate,
property as property,
sum(amount) as amount
FROM
sys_user_account_history
WHERE
documentary=2
and create_time >= #{beginTime} and create_time <= #{endTime}
and user_id=#{userId}
GROUP BY
CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')),
property
) a
GROUP BY
a.reportDate
SELECT
a.reportDate AS reportDate,
MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
FROM
(
SELECT
CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )) reportDate,
property as property,
sum( amount ) as amount
FROM
sys_user_account_history
WHERE
documentary=2
and create_time >= #{beginTime} and create_time <= #{endTime}
and user_id=#{userId}
GROUP BY
CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )),
property
) a
GROUP BY
a.reportDate
SELECT
his.id as id,
ins.id as "subOrderNo",
ins.signing_time as "signingTime",
o.licenseno as "licenseno",
his.amount as "amount",
his.business_eegments_type as "businessSegmentsType",
his.documentary as "incomeAndExpensesType",
his.property as "transactionType",
his.create_time as "createTime",
his.auditiing_id as "auditiingId",
CASE saa.auditing_status
WHEN '2' THEN '提现中'
WHEN '3' THEN '已提现'
WHEN '4' THEN '驳回'
ELSE ''
END AS "auditingStatus",
CASE ifa.audituser WHEN '自动审核' THEN '1'
ELSE '2' END as "checkStatus"
FROM
sys_user_account_history his
LEFT JOIN ins_area_company ins ON his.suborder = ins.id
LEFT JOIN ins_orders o ON o.orderno = ins.orderno
left join sys_amount_auditing saa on saa.id =his.auditiing_id
left join ins_fee_audit ifa on ifa.ins_order_no = ins.id
WHERE
his.property !=1 and his.property !=2
AND his.documentary=#{ myIncomeAndExpensesQueryDto.incomeAndExpensesType}
and his.user_id = #{myIncomeAndExpensesQueryDto.userId}
AND his.create_time BETWEEN #{myIncomeAndExpensesQueryDto.startDate} AND #{myIncomeAndExpensesQueryDto.endDate}
and his.property = #{myIncomeAndExpensesQueryDto.transactionType}
and his.business_eegments_type =#{myIncomeAndExpensesQueryDto.businessSegmentsType}
order by his.create_time desc
SELECT
count(0)
FROM
sys_user_account_history his
WHERE
his.property !=1 and his.property !=2
AND his.documentary=#{ myIncomeAndExpensesQueryDto.incomeAndExpensesType}
and his.user_id = #{myIncomeAndExpensesQueryDto.userId}
AND his.create_time BETWEEN #{myIncomeAndExpensesQueryDto.startDate} AND #{myIncomeAndExpensesQueryDto.endDate}
and his.property = #{myIncomeAndExpensesQueryDto.transactionType}
and his.business_eegments_type =#{myIncomeAndExpensesQueryDto.businessSegmentsType}
SELECT
sum(his.amount) as "sumAmount"
FROM
sys_user_account_history his
WHERE
his.property !=1 and his.property !=2
AND his.documentary=#{ myIncomeAndExpensesQueryDto.incomeAndExpensesType}
and his.user_id = #{myIncomeAndExpensesQueryDto.userId}
AND his.create_time BETWEEN #{myIncomeAndExpensesQueryDto.startDate} AND #{myIncomeAndExpensesQueryDto.endDate}
and his.property = #{myIncomeAndExpensesQueryDto.transactionType}
and his.business_eegments_type =#{myIncomeAndExpensesQueryDto.businessSegmentsType}
SELECT
sum(his.amount) as "sumAmount"
FROM
sys_user_account_history his
WHERE
his.documentary =#{types}
and his.property !=1 and his.property !=2
and his.user_id = #{userId}
SELECT
his.id as id,
ins.id as "subOrderNo",
ins.signing_time as "signingTime",
o.licenseno as "licenseno",
his.amount as "amount",
his.business_eegments_type as "businessSegmentsType",
his.documentary as "incomeAndExpensesType",
his.property as "transactionType",
his.create_time as "createTime",
his.auditiing_id as "auditiingId",
CASE saa.auditing_status
WHEN '2' THEN '提现中'
WHEN '3' THEN '已提现'
WHEN '4' THEN '已驳回'
ELSE ''
END AS "auditingStatus"
FROM
sys_user_account_history his
LEFT JOIN ins_area_company ins ON his.suborder = ins.id
LEFT JOIN ins_orders o ON o.orderno = ins.orderno
left join sys_amount_auditing saa on saa.id =his.auditiing_id
WHERE
his.property !=1 and his.property !=2
AND his.documentary=#{ vo.incomeAndExpensesType}
and his.user_id = #{vo.userId}
AND his.create_time BETWEEN #{vo.startDate} AND #{vo.endDate}
and his.property = #{vo.transactionType}
and his.business_eegments_type =#{vo.businessSegmentsType}
and o.licenseno =#{vo.licenseNo}
order by his.create_time desc
SELECT
his.id as id,
his.amount as "amount",
DATE_FORMAT(his.create_time, '%Y-%m-%d %H:%i:%s') as "createTime",
his.auditiing_id as "auditiingId",
CASE saa.auditing_status
WHEN '2' THEN '提现中'
WHEN '3' THEN '已提现'
WHEN '4' THEN '已驳回'
ELSE ''
END AS "auditingStatus",
su.id as userId,
su.name as userName,
DATE_FORMAT(saa.auditing_time, '%Y-%m-%d %H:%i:%s') as auditingTime,
CASE
dept.management_source
WHEN '1' THEN
'渠道'
WHEN '2' THEN
'代理人' ELSE ''
END deptType
FROM
sys_user_account_history his
LEFT JOIN ins_area_company ins ON his.suborder = ins.id
LEFT JOIN sys_user su ON su.id = his.user_id
LEFT JOIN sys_amount_auditing saa ON saa.id = his.auditiing_id
LEFT JOIN sys_dept dept ON dept.id = su.dept_id
WHERE
his.property !=1 and his.property !=2
AND (
dept.management_source = 1
OR dept.management_source = 2)
and his.documentary =1
and his.user_id = #{vo.userId}
AND his.create_time BETWEEN #{vo.startDate} AND #{vo.endDate}
AND saa.auditing_status = #{auditstatus}
order by his.create_time desc