update report
This commit is contained in:
parent
d4c663a995
commit
d22c0aa8aa
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
/app.properties
|
||||
/cn/
|
||||
/jdbc.properties
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
AppDebug=true
|
||||
AppTrace=true
|
||||
AppTrace=false
|
||||
AppParamHelper=cn.tsy.cas.idsse.dsds.helper.DSDSParamHelper
|
||||
AppListener=cn.tsy.cas.idsse.dsds.control.DSDSInitializeListener
|
||||
AppName=DSDSServer
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,6 +3,7 @@
|
|||
<mapper
|
||||
namespace="cn.tsy.data.cas.idsse.dsds.mapper.voyage.IVoyageRegReportMapper">
|
||||
|
||||
<!-- 航次统计 -->
|
||||
<select id="reportShipTotal" resultType="map">
|
||||
SELECT
|
||||
<if test="year != null">
|
||||
|
|
@ -25,7 +26,11 @@
|
|||
DISTINCT
|
||||
member_unit ) unit_total FROM voyage_member WHERE member_unit
|
||||
!=
|
||||
'海南深科海洋技术服务有限公司' GROUP BY voyage_id ) C
|
||||
'海南深科海洋技术服务有限公司'
|
||||
<if test="unit != null and unit != ''">
|
||||
and unit=#{member_unit}
|
||||
</if>
|
||||
GROUP BY voyage_id ) C
|
||||
WHERE
|
||||
A.tsy_id = b.voyage_id
|
||||
AND A.tsy_id = C.voyage_id
|
||||
|
|
@ -43,6 +48,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 统计航次单位 -->
|
||||
<select id="reportShipUnit" resultType="map">
|
||||
SELECT
|
||||
DISTINCT
|
||||
|
|
@ -53,7 +59,7 @@
|
|||
voyage_member M
|
||||
WHERE
|
||||
member_unit!='海南深科海洋技术服务有限公司' and
|
||||
s.unit_name = M.member_unit
|
||||
s.unit_name = m.member_unit
|
||||
AND
|
||||
r.tsy_id = M.voyage_id
|
||||
<if test="ship_name != null and ship_name != ''">
|
||||
|
|
@ -118,6 +124,7 @@
|
|||
voyage_year
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计 -->
|
||||
<select id="reportPlatformTotal" resultType="map">
|
||||
SELECT
|
||||
<if test="year != null">
|
||||
|
|
@ -151,6 +158,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计单位 -->
|
||||
<select id="reportPlatformUnit" resultType="map">
|
||||
SELECT DISTINCT
|
||||
s.*
|
||||
|
|
@ -178,17 +186,26 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计潜次 -->
|
||||
<select id="reportPlatformDiving" resultType="map">
|
||||
SELECT
|
||||
DISTINCT
|
||||
diving_sn
|
||||
SELECT DISTINCT
|
||||
diving_sn
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset sd
|
||||
voyage_reg r,
|
||||
sample_dataset sd,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = sd.voyage_id and diving_sn is not null
|
||||
and
|
||||
platform_type in (${platform_type})
|
||||
m.voyage_id = r.tsy_id
|
||||
and r.tsy_id = sd.voyage_id
|
||||
AND diving_sn IS NOT NULL
|
||||
<if test="platform_type != null and platform_type!=''">
|
||||
and platform_type in (${platform_type})
|
||||
</if>
|
||||
|
||||
<if test="unit != null and unit!=''">
|
||||
and member_unit = unit
|
||||
</if>
|
||||
|
||||
<if test="platform_name != null and platform_name!=''">
|
||||
and platform_name = #{platform_name}
|
||||
</if>
|
||||
|
|
@ -254,4 +271,194 @@
|
|||
</select>
|
||||
|
||||
|
||||
<!-- 统计科学家 -->
|
||||
<select id="reportMember" resultType="map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
a.member_unit,
|
||||
a.member_name,
|
||||
a.voyage_total,
|
||||
a.days_total,
|
||||
a.min_voyage_date,
|
||||
b.drving_total,
|
||||
b.min_drving_date
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) voyage_total,
|
||||
SUM(voyage_days) days_total,
|
||||
MIN(voyage_start_date) min_voyage_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
ORDER BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) a
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) drving_total,
|
||||
MIN(voyage_start_date) min_drving_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset d,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
AND d.voyage_id = r.tsy_id
|
||||
AND (
|
||||
d.driver_unit_left = m.member_unit
|
||||
AND d.driver_left = m.member_name
|
||||
OR d.driver_unit_right = m.member_unit
|
||||
AND d.driver_right = m.member_name
|
||||
)
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) b ON a.member_unit = b.member_unit
|
||||
AND a.member_name = b.member_name
|
||||
)
|
||||
WHERE
|
||||
1=1
|
||||
<if test="unit != null and unit != ''">
|
||||
and member_unit = #{unit}
|
||||
</if>
|
||||
ORDER BY
|
||||
member_unit,
|
||||
member_name;
|
||||
</select>
|
||||
|
||||
<select id="reportUnit" resultType="map">
|
||||
SELECT
|
||||
b.unit_name,
|
||||
count(1) voyage_total,
|
||||
SUM(a.voyage_days) voyage_days,
|
||||
SUM(b.member_total) member_total,
|
||||
SUM(b.drving_total) drving_total,
|
||||
SUM(b.f_drving_total) f_drving_total,
|
||||
<if test="year != null">
|
||||
date_part('year', voyage_start_date) as year,
|
||||
</if>
|
||||
SUM(b.f_voyage_total) f_voyage_total
|
||||
FROM
|
||||
voyage_reg a,
|
||||
(
|
||||
SELECT
|
||||
a.voyage_name,
|
||||
a.unit_name,
|
||||
COUNT(1) member_total,
|
||||
sum(drving_total) drving_total,
|
||||
SUM(CASE WHEN b.min_voyage_date = a.voyage_start_date THEN 1 ELSE 0 END) f_voyage_total,
|
||||
SUM(CASE WHEN b.min_drving_date >= a.voyage_start_date AND b.min_drving_date <= a.voyage_end_date THEN 1 ELSE 0 END) f_drving_total
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
voyage_name,
|
||||
unit_type,
|
||||
unit_name,
|
||||
member_name,
|
||||
voyage_days,
|
||||
voyage_start_date,
|
||||
voyage_end_date
|
||||
FROM
|
||||
dict_unit_sail s,
|
||||
voyage_reg r,
|
||||
voyage_member M
|
||||
WHERE
|
||||
member_unit != '海南深科海洋技术服务有限公司'
|
||||
AND s.unit_name = m.member_unit
|
||||
AND r.tsy_id = M.voyage_id
|
||||
GROUP BY
|
||||
voyage_name,
|
||||
unit_type,
|
||||
unit_name,
|
||||
member_name,
|
||||
voyage_days,
|
||||
voyage_start_date,
|
||||
voyage_end_date
|
||||
) a,
|
||||
(
|
||||
SELECT
|
||||
a.member_unit,
|
||||
a.member_name,
|
||||
a.voyage_total,
|
||||
a.days_total,
|
||||
a.min_voyage_date,
|
||||
b.drving_total,
|
||||
b.min_drving_date
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) voyage_total,
|
||||
SUM(voyage_days) days_total,
|
||||
MIN(voyage_start_date) min_voyage_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
ORDER BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) a
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) drving_total,
|
||||
MIN(voyage_start_date) min_drving_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset d,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
AND d.voyage_id = r.tsy_id
|
||||
AND (
|
||||
d.driver_unit_left = m.member_unit
|
||||
AND d.driver_left = m.member_name
|
||||
OR d.driver_unit_right = m.member_unit
|
||||
AND d.driver_right = m.member_name
|
||||
)
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) b ON a.member_unit = b.member_unit
|
||||
AND a.member_name = b.member_name
|
||||
) b
|
||||
WHERE
|
||||
a.member_name = b.member_name
|
||||
AND a.unit_name = b.member_unit
|
||||
GROUP BY
|
||||
a.voyage_name,
|
||||
a.unit_name
|
||||
) b
|
||||
WHERE
|
||||
a.voyage_name = b.voyage_name
|
||||
<if test="unit != null and unit != ''">
|
||||
and unit_name=#{unit}
|
||||
</if>
|
||||
GROUP BY
|
||||
unit_name
|
||||
<if test="year != null and year != ''">
|
||||
,date_part('year', voyage_start_date)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
AppDebug=true
|
||||
AppTrace=true
|
||||
AppTrace=false
|
||||
AppParamHelper=cn.tsy.cas.idsse.dsds.helper.DSDSParamHelper
|
||||
AppListener=cn.tsy.cas.idsse.dsds.control.DSDSInitializeListener
|
||||
AppName=DSDSServer
|
||||
|
|
@ -43,8 +43,8 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
* 科考船汇总统计属性
|
||||
*/
|
||||
@RequestMapping("ship/total.htm")
|
||||
public HmeAjax totalShip(String ship_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportShipTotal(ship_name, start, end,year));
|
||||
public HmeAjax totalShip(String unit,String ship_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportShipTotal(ship_name, start, end,year,unit));
|
||||
}
|
||||
|
||||
/***************
|
||||
|
|
@ -86,7 +86,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 无人航行潜水器
|
||||
* 水下自主式无人潜器
|
||||
*/
|
||||
@RequestMapping("platform/auv.htm")
|
||||
public HmeAjax platformAuv(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
|
|
@ -94,7 +94,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 遥控潜水器
|
||||
* 遥控水下机器人
|
||||
*/
|
||||
@RequestMapping("platform/rov.htm")
|
||||
public HmeAjax platformRov(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
|
|
@ -110,7 +110,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 无人航行潜水器
|
||||
* 水下自主式无人潜器
|
||||
*/
|
||||
@RequestMapping("platform/auv/unit.htm")
|
||||
public HmeAjax platformAuvUnit(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
|
|
@ -118,7 +118,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 遥控潜水器
|
||||
* 遥控水下机器人
|
||||
*/
|
||||
@RequestMapping("platform/rov/unit.htm")
|
||||
public HmeAjax platformRovUnit(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
|
|
@ -135,7 +135,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 无人航行潜水器
|
||||
* 水下自主式无人潜器
|
||||
*/
|
||||
@RequestMapping("platform/auv/unit/year.htm")
|
||||
public HmeAjax platformAuvUnitYear(String platform_name) {
|
||||
|
|
@ -143,7 +143,7 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
}
|
||||
|
||||
/***************
|
||||
* 遥控潜水器
|
||||
* 遥控水下机器人
|
||||
*/
|
||||
@RequestMapping("platform/rov/unit/year.htm")
|
||||
public HmeAjax platformRovUnitYear(String platform_name) {
|
||||
|
|
@ -154,25 +154,45 @@ public class DSDSReportControl extends HmeAjaxControl {
|
|||
* 载人潜水器
|
||||
*/
|
||||
@RequestMapping("platform/hov/diving.htm")
|
||||
public HmeAjax platformHovDiving(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving("'载人潜水器'", platform_name, start, end,year));
|
||||
public HmeAjax platformHovDiving(String unit,String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
System.out.println("--------------------------");
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving(unit,"'载人潜水器'", platform_name, start, end,year));
|
||||
}
|
||||
|
||||
/***************
|
||||
* 无人航行潜水器
|
||||
* 潜次统计:水下自主式无人潜器
|
||||
*/
|
||||
@RequestMapping("platform/auv/diving.htm")
|
||||
public HmeAjax platformAuvDiving(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving("'水下自主式无人潜器'", platform_name, start, end,year));
|
||||
public HmeAjax platformAuvDiving(String unit,String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving(unit,"'水下自主式无人潜器'", platform_name, start, end,year));
|
||||
}
|
||||
|
||||
/***************
|
||||
* 遥控潜水器
|
||||
* 潜次统计:遥控水下机器人
|
||||
*/
|
||||
@RequestMapping("platform/rov/diving.htm")
|
||||
public HmeAjax platformRovDiving(String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving("'遥控水下机器人'", platform_name, start, end, year));
|
||||
public HmeAjax platformRovDiving(String unit,String platform_name, LocalDate start, LocalDate end,Integer year) {
|
||||
return new HmeAjax(this.iRegReport.reportPlatformDiving(unit,"'遥控水下机器人'", platform_name, start, end, year));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************
|
||||
* 统计科学家
|
||||
*/
|
||||
@RequestMapping("unit/member.htm")
|
||||
public HmeAjax unitMember(String unit) {
|
||||
return new HmeAjax(this.iRegReport.reportMember(unit));
|
||||
}
|
||||
|
||||
|
||||
/***************
|
||||
* 潜次统计:遥控水下机器人
|
||||
*/
|
||||
@RequestMapping("unit/total.htm")
|
||||
public HmeAjax unitTotal(String year,String unit) {
|
||||
return new HmeAjax(this.iRegReport.reportUnit(year,unit));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ public interface IVoyageRegReportMapper extends IHmeMapper<VoyageLog> {
|
|||
* 科考船的汇总统计:目前有探索一号,探索二号、探索三号,海警101船(名字待定)
|
||||
*
|
||||
* @param ship_name 船的名称,如果不传,返回所有的
|
||||
* 2026-04-02 增加根据单位检索
|
||||
*/
|
||||
public List<Map<String, Object>> reportShipTotal(@Param("ship_name") String ship_name, @Param("start") LocalDate start,
|
||||
@Param("end") LocalDate end,@Param("year") Integer year);
|
||||
@Param("end") LocalDate end,@Param("year") Integer year,@Param("unit") String unit);
|
||||
|
||||
/***************
|
||||
* 统计参航单位
|
||||
|
|
@ -41,8 +42,21 @@ public interface IVoyageRegReportMapper extends IHmeMapper<VoyageLog> {
|
|||
|
||||
public List<Map<String, Object>> reportPlatfromUnitWithYear(@Param("platform_type") String platform_type,@Param("platform_name") String platform_name);
|
||||
|
||||
|
||||
public List<Map<String, Object>> reportPlatformDiving(@Param("platform_type") String platform_type,
|
||||
/******************
|
||||
* 统计参航航次
|
||||
*/
|
||||
public List<Map<String, Object>> reportPlatformDiving(@Param("unit") String unit,@Param("platform_type") String platform_type,
|
||||
@Param("platform_name") String platfrom_name, @Param("start") LocalDate start, @Param("end") LocalDate end,@Param("year") Integer year);
|
||||
|
||||
|
||||
|
||||
/******************
|
||||
* 统计参航单位
|
||||
*/
|
||||
public List<Map<String, Object>> reportUnit(@Param("year") String year,@Param("unit") String unit);
|
||||
/******************
|
||||
* 统计科学家
|
||||
*/
|
||||
public List<Map<String, Object>> reportMember(@Param("unit") String unit);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<mapper
|
||||
namespace="cn.tsy.data.cas.idsse.dsds.mapper.voyage.IVoyageRegReportMapper">
|
||||
|
||||
<!-- 航次统计 -->
|
||||
<select id="reportShipTotal" resultType="map">
|
||||
SELECT
|
||||
<if test="year != null">
|
||||
|
|
@ -25,7 +26,11 @@
|
|||
DISTINCT
|
||||
member_unit ) unit_total FROM voyage_member WHERE member_unit
|
||||
!=
|
||||
'海南深科海洋技术服务有限公司' GROUP BY voyage_id ) C
|
||||
'海南深科海洋技术服务有限公司'
|
||||
<if test="unit != null and unit != ''">
|
||||
and unit=#{member_unit}
|
||||
</if>
|
||||
GROUP BY voyage_id ) C
|
||||
WHERE
|
||||
A.tsy_id = b.voyage_id
|
||||
AND A.tsy_id = C.voyage_id
|
||||
|
|
@ -43,6 +48,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 统计航次单位 -->
|
||||
<select id="reportShipUnit" resultType="map">
|
||||
SELECT
|
||||
DISTINCT
|
||||
|
|
@ -53,7 +59,7 @@
|
|||
voyage_member M
|
||||
WHERE
|
||||
member_unit!='海南深科海洋技术服务有限公司' and
|
||||
s.unit_name = M.member_unit
|
||||
s.unit_name = m.member_unit
|
||||
AND
|
||||
r.tsy_id = M.voyage_id
|
||||
<if test="ship_name != null and ship_name != ''">
|
||||
|
|
@ -118,6 +124,7 @@
|
|||
voyage_year
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计 -->
|
||||
<select id="reportPlatformTotal" resultType="map">
|
||||
SELECT
|
||||
<if test="year != null">
|
||||
|
|
@ -151,6 +158,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计单位 -->
|
||||
<select id="reportPlatformUnit" resultType="map">
|
||||
SELECT DISTINCT
|
||||
s.*
|
||||
|
|
@ -178,17 +186,26 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据平台统计潜次 -->
|
||||
<select id="reportPlatformDiving" resultType="map">
|
||||
SELECT
|
||||
DISTINCT
|
||||
diving_sn
|
||||
SELECT DISTINCT
|
||||
diving_sn
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset sd
|
||||
voyage_reg r,
|
||||
sample_dataset sd,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = sd.voyage_id and diving_sn is not null
|
||||
and
|
||||
platform_type in (${platform_type})
|
||||
m.voyage_id = r.tsy_id
|
||||
and r.tsy_id = sd.voyage_id
|
||||
AND diving_sn IS NOT NULL
|
||||
<if test="platform_type != null and platform_type!=''">
|
||||
and platform_type in (${platform_type})
|
||||
</if>
|
||||
|
||||
<if test="unit != null and unit!=''">
|
||||
and member_unit = unit
|
||||
</if>
|
||||
|
||||
<if test="platform_name != null and platform_name!=''">
|
||||
and platform_name = #{platform_name}
|
||||
</if>
|
||||
|
|
@ -254,4 +271,194 @@
|
|||
</select>
|
||||
|
||||
|
||||
<!-- 统计科学家 -->
|
||||
<select id="reportMember" resultType="map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
a.member_unit,
|
||||
a.member_name,
|
||||
a.voyage_total,
|
||||
a.days_total,
|
||||
a.min_voyage_date,
|
||||
b.drving_total,
|
||||
b.min_drving_date
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) voyage_total,
|
||||
SUM(voyage_days) days_total,
|
||||
MIN(voyage_start_date) min_voyage_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
ORDER BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) a
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) drving_total,
|
||||
MIN(voyage_start_date) min_drving_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset d,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
AND d.voyage_id = r.tsy_id
|
||||
AND (
|
||||
d.driver_unit_left = m.member_unit
|
||||
AND d.driver_left = m.member_name
|
||||
OR d.driver_unit_right = m.member_unit
|
||||
AND d.driver_right = m.member_name
|
||||
)
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) b ON a.member_unit = b.member_unit
|
||||
AND a.member_name = b.member_name
|
||||
)
|
||||
WHERE
|
||||
1=1
|
||||
<if test="unit != null and unit != ''">
|
||||
and member_unit = #{unit}
|
||||
</if>
|
||||
ORDER BY
|
||||
member_unit,
|
||||
member_name;
|
||||
</select>
|
||||
|
||||
<select id="reportUnit" resultType="map">
|
||||
SELECT
|
||||
b.unit_name,
|
||||
count(1) voyage_total,
|
||||
SUM(a.voyage_days) voyage_days,
|
||||
SUM(b.member_total) member_total,
|
||||
SUM(b.drving_total) drving_total,
|
||||
SUM(b.f_drving_total) f_drving_total,
|
||||
<if test="year != null">
|
||||
date_part('year', voyage_start_date) as year,
|
||||
</if>
|
||||
SUM(b.f_voyage_total) f_voyage_total
|
||||
FROM
|
||||
voyage_reg a,
|
||||
(
|
||||
SELECT
|
||||
a.voyage_name,
|
||||
a.unit_name,
|
||||
COUNT(1) member_total,
|
||||
sum(drving_total) drving_total,
|
||||
SUM(CASE WHEN b.min_voyage_date = a.voyage_start_date THEN 1 ELSE 0 END) f_voyage_total,
|
||||
SUM(CASE WHEN b.min_drving_date >= a.voyage_start_date AND b.min_drving_date <= a.voyage_end_date THEN 1 ELSE 0 END) f_drving_total
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
voyage_name,
|
||||
unit_type,
|
||||
unit_name,
|
||||
member_name,
|
||||
voyage_days,
|
||||
voyage_start_date,
|
||||
voyage_end_date
|
||||
FROM
|
||||
dict_unit_sail s,
|
||||
voyage_reg r,
|
||||
voyage_member M
|
||||
WHERE
|
||||
member_unit != '海南深科海洋技术服务有限公司'
|
||||
AND s.unit_name = m.member_unit
|
||||
AND r.tsy_id = M.voyage_id
|
||||
GROUP BY
|
||||
voyage_name,
|
||||
unit_type,
|
||||
unit_name,
|
||||
member_name,
|
||||
voyage_days,
|
||||
voyage_start_date,
|
||||
voyage_end_date
|
||||
) a,
|
||||
(
|
||||
SELECT
|
||||
a.member_unit,
|
||||
a.member_name,
|
||||
a.voyage_total,
|
||||
a.days_total,
|
||||
a.min_voyage_date,
|
||||
b.drving_total,
|
||||
b.min_drving_date
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) voyage_total,
|
||||
SUM(voyage_days) days_total,
|
||||
MIN(voyage_start_date) min_voyage_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
ORDER BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) a
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
m.member_unit,
|
||||
m.member_name,
|
||||
COUNT(1) drving_total,
|
||||
MIN(voyage_start_date) min_drving_date
|
||||
FROM
|
||||
voyage_reg r,
|
||||
sample_dataset d,
|
||||
voyage_member m
|
||||
WHERE
|
||||
r.tsy_id = m.voyage_id
|
||||
AND d.voyage_id = r.tsy_id
|
||||
AND (
|
||||
d.driver_unit_left = m.member_unit
|
||||
AND d.driver_left = m.member_name
|
||||
OR d.driver_unit_right = m.member_unit
|
||||
AND d.driver_right = m.member_name
|
||||
)
|
||||
GROUP BY
|
||||
m.member_unit,
|
||||
m.member_name
|
||||
) b ON a.member_unit = b.member_unit
|
||||
AND a.member_name = b.member_name
|
||||
) b
|
||||
WHERE
|
||||
a.member_name = b.member_name
|
||||
AND a.unit_name = b.member_unit
|
||||
GROUP BY
|
||||
a.voyage_name,
|
||||
a.unit_name
|
||||
) b
|
||||
WHERE
|
||||
a.voyage_name = b.voyage_name
|
||||
<if test="unit != null and unit != ''">
|
||||
and unit_name=#{unit}
|
||||
</if>
|
||||
GROUP BY
|
||||
unit_name
|
||||
<if test="year != null and year != ''">
|
||||
,date_part('year', voyage_start_date)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue