feat: 消费地图大屏功能, 新增。
This commit is contained in:
@@ -68,6 +68,22 @@
|
||||
<result property="transferRecordId" column="transfer_record_id" />
|
||||
<result property="currentBalance" column="current_balance" />
|
||||
<result property="childCategory" column="child_category" />
|
||||
<result property="locationName" column="location_name" />
|
||||
<result property="locationAddress" column="location_address" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AccountDealLocationVo" id="AccountDealLocationResult">
|
||||
<result property="locationKey" column="location_key" />
|
||||
<result property="locationName" column="location_name" />
|
||||
<result property="locationAddress" column="location_address" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="dealCount" column="deal_count" />
|
||||
<result property="latestTime" column="latest_time" />
|
||||
<result property="accountNames" column="account_names" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAccountsOutInList" parameterType="AccountsDealRecordDto" resultMap="AccountsDealRecordResult">
|
||||
@@ -1026,4 +1042,102 @@
|
||||
b.bank_name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<sql id="accountDealLocationWhere">
|
||||
a.del_flag = '0'
|
||||
and a.longitude is not null
|
||||
and a.latitude is not null
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and #{endTime} >= to_char(a.create_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and to_char(a.create_time, 'yyyy-MM-dd') >= #{startTime}
|
||||
</if>
|
||||
<if test="accountId != null">
|
||||
and a.account_id = #{accountId}
|
||||
</if>
|
||||
<if test="dealType != null and dealType != ''">
|
||||
and a.deal_type = #{dealType}
|
||||
</if>
|
||||
<if test="dealCategory != null and dealCategory != ''">
|
||||
and a.deal_category = #{dealCategory}
|
||||
</if>
|
||||
<if test="childCategory != null and childCategory != ''">
|
||||
and a.child_category = #{childCategory}
|
||||
</if>
|
||||
<if test="locationName != null and locationName != ''">
|
||||
and a.location_name like '%' || #{locationName} || '%'
|
||||
</if>
|
||||
<if test="locationAddress != null and locationAddress != ''">
|
||||
and a.location_address like '%' || #{locationAddress} || '%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectAccountDealLocationPoints" parameterType="AccountDealLocationDto" resultMap="AccountDealLocationResult">
|
||||
select
|
||||
concat(round(a.longitude::numeric, 5), '_', round(a.latitude::numeric, 5)) as location_key,
|
||||
COALESCE(NULLIF(max(a.location_name), ''), NULLIF(max(a.location_address), ''), concat(round(a.longitude::numeric, 5), ',', round(a.latitude::numeric, 5))) as location_name,
|
||||
max(a.location_address) as location_address,
|
||||
round(a.longitude::numeric, 5)::float8 as longitude,
|
||||
round(a.latitude::numeric, 5)::float8 as latitude,
|
||||
COALESCE(sum(a.amount), 0) as total_amount,
|
||||
count(1) as deal_count,
|
||||
to_char(max(a.create_time), 'yyyy-MM-dd HH24:mi:ss') as latest_time,
|
||||
string_agg(distinct COALESCE(ac."name", ''), '、') as account_names
|
||||
from
|
||||
accounts_deal_record a
|
||||
left join accounts ac on ac.id = a.account_id
|
||||
<where>
|
||||
<include refid="accountDealLocationWhere"/>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by
|
||||
round(a.longitude::numeric, 5),
|
||||
round(a.latitude::numeric, 5)
|
||||
order by
|
||||
sum(a.amount) desc
|
||||
</select>
|
||||
|
||||
<select id="selectAccountDealLocationRecords" parameterType="AccountDealLocationDto" resultMap="AccountsDealRecordResult">
|
||||
select
|
||||
a.id,
|
||||
a.name,
|
||||
a.type,
|
||||
a.account_id,
|
||||
a.amount,
|
||||
a.transfer_record_id,
|
||||
a.deal_type,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.remark,
|
||||
a.deal_category,
|
||||
a.current_balance,
|
||||
a.child_category,
|
||||
a.location_name,
|
||||
a.location_address,
|
||||
a.longitude,
|
||||
a.latitude,
|
||||
CONCAT(ac."name", '(', right(ac.code, 4), ')') as account_name
|
||||
from
|
||||
accounts_deal_record a
|
||||
left join accounts ac on ac.id = a.account_id
|
||||
<where>
|
||||
<include refid="accountDealLocationWhere"/>
|
||||
<if test="longitude != null">
|
||||
and round(a.longitude::numeric, 5) = round(CAST(#{longitude} AS numeric), 5)
|
||||
</if>
|
||||
<if test="latitude != null">
|
||||
and round(a.latitude::numeric, 5) = round(CAST(#{latitude} AS numeric), 5)
|
||||
</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by
|
||||
a.create_time desc
|
||||
limit 100
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user