修改SQL兼容Oracle和Pgsql
This commit is contained in:
parent
67d73bc824
commit
8141aa72e8
|
|
@ -7,51 +7,102 @@
|
|||
nucl.NUCLIDENAME,
|
||||
nucl.CONCENTRATION AS CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNAUTO.GARDS_NUCL_IDED nucl
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||
INNER JOIN RNAUTO.GARDS_QC_CHECK qc ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
||||
<trim prefix="where" suffixOverrides="or">
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
||||
FROM RNAUTO.GARDS_NUCL_IDED nucl
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||
ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||
ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||
INNER JOIN RNAUTO.GARDS_QC_CHECK qc
|
||||
ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
||||
|
||||
<trim prefix="WHERE" suffixOverrides="AND">
|
||||
<choose>
|
||||
|
||||
<!-- Oracle -->
|
||||
<when test="_databaseId == 'oracle'">
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
AND TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</when>
|
||||
|
||||
<!-- PostgreSQL -->
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_TIMESTAMP(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
AND TO_TIMESTAMP(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
AND samp.DATA_TYPE = 'S'
|
||||
AND samp.STATUS IN ('P', 'R')
|
||||
AND samp.STATION_ID = #{stationId}
|
||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND nucl.NUCLIDENAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
<foreach collection="nuclideName"
|
||||
item="item"
|
||||
open="("
|
||||
close=")"
|
||||
separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="(colTime != null and colTime.size() > 0) || (acqTime != null and acqTime.size() > 0) ||
|
||||
airFlow != null || decayTime != null || sampVol != null || be7FWHM != null || ba140MDC != null || xe133MDC != null">
|
||||
<trim prefix="and(" suffixOverrides="or" suffix=")">
|
||||
|
||||
<if test="(colTime != null and colTime.size() > 0)
|
||||
|| (acqTime != null and acqTime.size() > 0)
|
||||
|| airFlow != null
|
||||
|| decayTime != null
|
||||
|| sampVol != null
|
||||
|| be7FWHM != null
|
||||
|| ba140MDC != null
|
||||
|| xe133MDC != null">
|
||||
|
||||
<trim prefix="AND (" suffix=")" suffixOverrides="OR">
|
||||
|
||||
<if test="colTime != null and colTime.size() > 0">
|
||||
(qc.qc_name = 'col_time' and qc.qc_value between #{colTime[0]} and #{colTime[1]} ) or
|
||||
(qc.qc_name = 'col_time'
|
||||
AND qc.qc_value BETWEEN #{colTime[0]}
|
||||
AND #{colTime[1]}) OR
|
||||
</if>
|
||||
|
||||
<if test="acqTime != null and acqTime.size() > 0">
|
||||
(qc.qc_name = 'acq_time' and qc.qc_value = #{acqTime[0]}) or
|
||||
(qc.qc_name = 'acq_time'
|
||||
AND qc.qc_value = #{acqTime[0]}) OR
|
||||
</if>
|
||||
|
||||
<if test="airFlow != null">
|
||||
(qc.qc_name = 'airFlow' and qc.qc_value < #{airFlow} ) or
|
||||
(qc.qc_name = 'airFlow'
|
||||
AND qc.qc_value < #{airFlow}) OR
|
||||
</if>
|
||||
|
||||
<if test="decayTime != null">
|
||||
(qc.qc_name = 'decay_time' and qc.qc_value < #{decayTime} ) or
|
||||
(qc.qc_name = 'decay_time'
|
||||
AND qc.qc_value < #{decayTime}) OR
|
||||
</if>
|
||||
|
||||
<if test="sampVol != null">
|
||||
(qc.qc_name = 'samp_vol' and qc.qc_value < #{sampVol} ) or
|
||||
(qc.qc_name = 'samp_vol'
|
||||
AND qc.qc_value < #{sampVol}) OR
|
||||
</if>
|
||||
|
||||
<if test="be7FWHM != null">
|
||||
(qc.qc_name = 'Be7-FWHM' and qc.qc_value < #{be7FWHM} ) or
|
||||
(qc.qc_name = 'Be7-FWHM'
|
||||
AND qc.qc_value < #{be7FWHM}) OR
|
||||
</if>
|
||||
|
||||
<if test="ba140MDC != null">
|
||||
(qc.qc_name = 'Ba140-MDC' and qc.qc_value < #{ba140MDC} ) or
|
||||
(qc.qc_name = 'Ba140-MDC'
|
||||
AND qc.qc_value < #{ba140MDC}) OR
|
||||
</if>
|
||||
|
||||
<if test="xe133MDC != null">
|
||||
(qc.qc_name = 'Xe133-MDC' and qc.qc_value < #{xe133MDC} ) or
|
||||
(qc.qc_name = 'Xe133-MDC'
|
||||
AND qc.qc_value < #{xe133MDC}) OR
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
|
|
@ -1,60 +1,137 @@
|
|||
<?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="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
DISTINCT samp.SAMPLE_ID,
|
||||
nucl.NUCLIDENAME,
|
||||
nucl.CONCENTRATION AS CONC,
|
||||
ana.ANALYSISBEGIN
|
||||
FROM
|
||||
RNMAN.GARDS_NUCL_IDED nucl
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||
INNER JOIN RNMAN.GARDS_QC_CHECK qc ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
||||
samp.SAMPLE_ID,
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
ana.ANALYSISBEGIN,
|
||||
xe.NID_FLAG
|
||||
FROM RNAUTO.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
||||
|
||||
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||
<choose>
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</when>
|
||||
<otherwise>
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
AND samp.DATA_TYPE = 'S'
|
||||
AND samp.STATUS IN ('P', 'R')
|
||||
AND samp.STATION_ID = #{stationId}
|
||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||
|
||||
<!-- 动态核素 IN -->
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND nucl.NUCLIDENAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
AND xe.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="(colTime != null and colTime.size() > 0) || (acqTime != null and acqTime.size() > 0) ||
|
||||
airFlow != null || decayTime != null || sampVol != null || be7FWHM != null || ba140MDC != null || xe133MDC != null">
|
||||
<trim prefix="and(" suffixOverrides="or" suffix=")">
|
||||
|
||||
<!-- 时间差兼容 Oracle 11g + PostgreSQL -->
|
||||
<if test="colTime != null and colTime.size() > 0">
|
||||
(qc.qc_name = 'col_time' and qc.qc_value between #{colTime[0]} and #{colTime[1]} ) or
|
||||
<choose>
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
AND (
|
||||
EXTRACT(EPOCH FROM (samp.COLLECT_STOP - samp.COLLECT_START)) / 3600
|
||||
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||
)
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (
|
||||
(samp.COLLECT_STOP - samp.COLLECT_START) * 24
|
||||
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<!-- 采集活时间 -->
|
||||
<if test="acqTime != null and acqTime.size() > 0">
|
||||
(qc.qc_name = 'acq_time' and qc.qc_value = #{acqTime[0]}) or
|
||||
AND (
|
||||
samp.ACQUISITION_LIVE_SEC / 3600
|
||||
BETWEEN #{acqTime[0]} AND #{acqTime[1]}
|
||||
)
|
||||
</if>
|
||||
<if test="airFlow != null">
|
||||
(qc.qc_name = 'airFlow' and qc.qc_value < #{airFlow} ) or
|
||||
|
||||
<!-- Xe 体积 -->
|
||||
<if test="XeVol != null">
|
||||
AND aux.XE_VOLUME > #{XeVol}
|
||||
</if>
|
||||
<if test="decayTime != null">
|
||||
(qc.qc_name = 'decay_time' and qc.qc_value < #{decayTime} ) or
|
||||
</if>
|
||||
<if test="sampVol != null">
|
||||
(qc.qc_name = 'samp_vol' and qc.qc_value < #{sampVol} ) or
|
||||
</if>
|
||||
<if test="be7FWHM != null">
|
||||
(qc.qc_name = 'Be7-FWHM' and qc.qc_value < #{be7FWHM} ) or
|
||||
</if>
|
||||
<if test="ba140MDC != null">
|
||||
(qc.qc_name = 'Ba140-MDC' and qc.qc_value < #{ba140MDC} ) or
|
||||
</if>
|
||||
<if test="xe133MDC != null">
|
||||
(qc.qc_name = 'Xe133-MDC' and qc.qc_value < #{xe133MDC} ) or
|
||||
</if>
|
||||
</trim>
|
||||
|
||||
<!-- Xe133m MDC-->
|
||||
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
|
||||
AND (
|
||||
xe.NUCLIDE_NAME = 'Xe133m'
|
||||
AND xe.MDC BETWEEN #{Xe133MDC[0]} AND #{Xe133MDC[1]}
|
||||
)
|
||||
</if>
|
||||
|
||||
</where>
|
||||
) a
|
||||
|
||||
<!-- 去掉不合理条件 -->
|
||||
<trim prefix="where" suffixOverrides="or">
|
||||
|
||||
<choose>
|
||||
<when test="Xe133mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe133Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe131mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe135Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
n.SAMPLE_ID,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||
SELECT * FROM (
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
samp.SAMPLE_ID,
|
||||
xe.NUCLIDE_NAME,
|
||||
|
|
@ -11,70 +12,127 @@
|
|||
xe.NID_FLAG
|
||||
FROM
|
||||
RNAUTO.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
||||
|
||||
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||
<choose>
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</when>
|
||||
<otherwise>
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
AND samp.DATA_TYPE = 'S'
|
||||
AND samp.STATUS IN ('P', 'R')
|
||||
AND samp.STATION_ID = #{stationId}
|
||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||
|
||||
<!-- 动态核素 -->
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND xe.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- 时间差兼容 Oracle 11g + PostgreSQL -->
|
||||
<if test="colTime != null and colTime.size() > 0">
|
||||
and ((TO_NUMBER(samp.COLLECT_STOP - samp.COLLECT_START) * 24) between #{colTime[0]} and #{colTime[1]} )
|
||||
<choose>
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
AND (
|
||||
EXTRACT(EPOCH FROM (samp.COLLECT_STOP - samp.COLLECT_START)) / 3600
|
||||
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||
)
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (
|
||||
(samp.COLLECT_STOP - samp.COLLECT_START) * 24
|
||||
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<!-- 采集活时间-->
|
||||
<if test="acqTime != null and acqTime.size() > 0">
|
||||
and (samp.ACQUISITION_LIVE_SEC / 3600 between #{colTime[0]} and #{colTime[1]} )
|
||||
AND (
|
||||
samp.ACQUISITION_LIVE_SEC / 3600
|
||||
BETWEEN #{acqTime[0]} AND #{acqTime[1]}
|
||||
)
|
||||
</if>
|
||||
|
||||
<!-- Xe 体积 -->
|
||||
<if test="XeVol != null">
|
||||
AND (aux.XE_VOLUME > #{XeVol} )
|
||||
AND aux.XE_VOLUME > #{XeVol}
|
||||
</if>
|
||||
|
||||
<!-- Xe133m MDC -->
|
||||
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
|
||||
AND (xe.NUCLIDE_NAME = 'Xe133m' AND MDC between #{Xe133MDC[0]} AND #{Xe133MDC[1]} )
|
||||
AND (
|
||||
xe.NUCLIDE_NAME = 'Xe133m'
|
||||
AND xe.MDC BETWEEN #{Xe133MDC[0]} AND #{Xe133MDC[1]}
|
||||
)
|
||||
</if>
|
||||
|
||||
</where>
|
||||
) a
|
||||
|
||||
<!-- 核素 flag 过滤-->
|
||||
<trim prefix="where" suffixOverrides="or">
|
||||
|
||||
<choose>
|
||||
<when test="Xe133mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe133Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe131mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="Xe135Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
n.SAMPLE_ID,
|
||||
|
|
|
|||
|
|
@ -2,67 +2,88 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||
SELECT * FROM (
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
samp.SAMPLE_ID,
|
||||
xe.NUCLIDE_NAME,
|
||||
xe.CONC,
|
||||
ana.ANALYSISBEGIN,
|
||||
xe.NID_FLAG
|
||||
FROM
|
||||
RNMAN.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||
FROM RNMAN.GARDS_XE_RESULTS xe
|
||||
INNER JOIN RNMAN.GARDS_ANALYSES ana
|
||||
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||
<where>
|
||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
||||
|
||||
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||
<choose>
|
||||
<when test="_databaseId == 'postgresql'">
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</when>
|
||||
<otherwise>
|
||||
ana.ANALYSISBEGIN BETWEEN
|
||||
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
AND
|
||||
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</otherwise>
|
||||
</choose>
|
||||
AND samp.DATA_TYPE = 'S'
|
||||
AND samp.STATUS IN ('P', 'R')
|
||||
AND samp.STATION_ID = #{stationId}
|
||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||
<!-- 动态核素 IN -->
|
||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||
AND xe.NUCLIDE_NAME IN
|
||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
||||
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) a
|
||||
<!-- 去掉不合理条件 -->
|
||||
<trim prefix="where" suffixOverrides="or">
|
||||
<choose>
|
||||
<when test="Xe133mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="Xe133Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe133' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="Xe131mFlag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe131m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="Xe135Flag != null">
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1 ) or
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||
</when>
|
||||
<otherwise>
|
||||
(a.NUCLIDE_NAME = 'Xe135' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
||||
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||
</otherwise>
|
||||
</choose>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||
SELECT
|
||||
n.SAMPLE_ID,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user