Commit 9122473e authored by chenzhao's avatar chenzhao

修改视图

parent 9f4bb3cb
......@@ -333,13 +333,15 @@
a.companyMaleEmployees,
a.companyFemaleEmployees,
a.managementType,
a. keySiteCompany as isKeyPoint
FROM
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
case when cks_d.count is null then 0 else cks_d.count end as keySiteNum
FROM important_companys a left join (
SELECT cks.belong_id ,count(cks.belong_id) count from cb_key_site cks where cks.is_delete=0 GROUP BY cks.belong_id
)cks_d
on a.id=cks_d.belong_id
where a.longitude is not null and a.latitude is not null
where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1
<if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
......
......@@ -2875,5 +2875,19 @@
</changeSet>
<changeSet author="chenzhao" id="2022-04-25-1">
<preConditions onFail="MARK_RAN">
<viewExists viewName="important_companys"/>
</preConditions>
<dropView viewName="important_companys"/>
<comment>delete important_companys</comment>
</changeSet>
<changeSet author="chenzhao" id="2022-04-25-2">
<createView viewName="important_companys" replaceIfExists="true" >
(select `a`.`name` AS `name`,`b`.`ids` AS `id`,`b`.`companyMaleEmployees` AS `companyMaleEmployees`,`b`.`companyFemaleEmployees` AS `companyFemaleEmployees`,`b`.`longitude` AS `longitude`,`b`.`latitude` AS `latitude`,`b`.`managementType` AS `managementType`,`b`.`keySiteCompany` AS `keySiteCompany` from (((select `cb_org_usr`.`sequence_nbr` AS `id`, `cb_org_usr`.`biz_org_name` AS `name` from `cb_org_usr` where (( `cb_org_usr`.`biz_org_type` in ('COMPANY','DEPARTMENT')) and ( `cb_org_usr`.`is_delete` = 0)))) `a` left join (select `v`.`instance_id` AS `ids`,max((case `v`.`field_code` when 'companyMaleEmployees' then `v`.`field_value` end)) AS `companyMaleEmployees`,max((case `v`.`field_code` when 'companyFemaleEmployees' then `v`.`field_value` end)) AS `companyFemaleEmployees`,max((case `v`.`field_code` when 'longitude' then `v`.`field_value` end)) AS `longitude`,max((case `v`.`field_code` when 'latitude' then `v`.`field_value` end)) AS `latitude`,max((case `v`.`field_code` when 'companyNature' then `v`.`field_value_label` end)) AS `managementType`,max((case `v`.`field_code` when 'businessCategory' then `v`.`field_value` end)) AS `keySiteCompany` from `cb_dynamic_form_instance` `v` group by `v`.`instance_id`) `b` on((`b`.`ids` = `a`.`id`))))</createView>
</changeSet>
</databaseChangeLog>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment