|
|
@@ -76,39 +76,6 @@
|
|
|
WHERE #{year} between DATE_FORMAT(XMKSSJ, '%Y') and DATE_FORMAT(COALESCE(get_xm_info(xm.id,'XMJSSJ', #{year}),XMJSSJ), '%Y')
|
|
|
</select>
|
|
|
|
|
|
-<!-- <select id="summaryPage" resultType="org.sky.scientific.pojo.vo.XmSummary">-->
|
|
|
-<!-- SELECT-->
|
|
|
-<!-- xm.id, xm.xmbh,-->
|
|
|
-<!-- COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'xmmc' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1), xm.XMMC ) AS xmmc,-->
|
|
|
-<!-- COALESCE( (SELECT BGHDZ FROM kd_xm_bgrz bgrz WHERE XM_ID = xm.id AND ZDMC = 'XMFZR' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY BGSXSJ DESC,bgrz.create_time desc LIMIT 1), xm.XMFZR) as xmfzr,-->
|
|
|
-<!-- tech.name AS xmfzrxm,-->
|
|
|
-<!-- COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMSQDWID' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.XMSQDWID) AS xmsqdwid,-->
|
|
|
-<!-- CONCAT_WS('/',(SELECT name FROM kd_department d2 WHERE d2.id = d.parent_id), d.`name`) as xmsqdw,-->
|
|
|
-<!-- xm.xmkssj,-->
|
|
|
-<!-- COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMJSSJ' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.XMJSSJ) AS xmjssj,-->
|
|
|
-<!-- COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMYSZEMX' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.XMYSZEMX) AS xmyszemx,-->
|
|
|
-<!-- COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'STATUS' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.status) AS status,-->
|
|
|
-<!-- LXBG as lxbg,-->
|
|
|
-<!-- (select count(*) from kd_xm_jdxbg jdxbg where jdxbg.xm_id = xm.id and date_format(jdxbg.fill_date,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as jdxbgCount,-->
|
|
|
-<!-- (select count(*) from kd_xm_jtb jtb where jtb.xm_id = xm.id and date_format(jtb.tbsj,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as ysbgCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_zl zl where zl.xm_id = xm.id and zl.ZLLX = '发明专利' and date_format(zl.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as fmzlCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_zl zl where zl.xm_id = xm.id and zl.ZLLX = '实用新型专利' and date_format(zl.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as syxxzlCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_rjzzq rjzzq where rjzzq.xm_id = xm.id and date_format(rjzzq.DJPZRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as rzCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_jsbz jsbz where jsbz.xm_id = xm.id and date_format(jsbz.SSRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as bzCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_kylw kylw where kylw.xm_id = xm.id and date_format(kylw.FBRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as lwCount,-->
|
|
|
-<!-- (select count(*) from kd_cg_qt qt where qt.xm_id = xm.id and date_format(qt.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as qtCount,-->
|
|
|
-<!-- (select ifnull(sum(WWFYJE), 0) from kd_xm_wwxm ww where ww.XM_ID = xm.id and ww.year_and_month = left(#{ew.yearAndMonth}, 4)) as wwAmount-->
|
|
|
-<!-- FROM kd_xm xm-->
|
|
|
-<!-- LEFT JOIN kd_technician tech ON tech.id = COALESCE( (SELECT BGHDZ FROM kd_xm_bgrz bgrz WHERE XM_ID = xm.id AND ZDMC = 'XMFZR' AND (DATE_FORMAT(BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and BGSXSJ <![CDATA[<=]]> now())) ORDER BY BGSXSJ DESC,create_time desc LIMIT 1), xm.XMFZR)-->
|
|
|
-<!-- LEFT JOIN kd_department d on d.id = COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMSQDWID' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.XMSQDWID)-->
|
|
|
-<!-- WHERE xm.tenant_id = #{ew.tenantId} and DATE_FORMAT(xm.XMKSSJ, '%Y%m') <![CDATA[<=]]> #{ew.yearAndMonth}-->
|
|
|
-<!-- <if test="ew.xmbh!=null and ew.xmbh!=''">and xm.XMBH like concat('%',#{ew.xmbh},'%')</if>-->
|
|
|
-<!-- <if test="ew.xmmc!=null and ew.xmmc!=''">and COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'xmmc' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1), xm.XMMC ) like concat('%',#{ew.xmmc},'%')</if>-->
|
|
|
-<!-- <if test="ew.xmfzrxm!=null and ew.xmfzrxm!=''">and tech.name like concat('%', #{ew.xmfzrxm},'%')</if>-->
|
|
|
-<!-- <if test="ew.xmsqdw!=null and ew.xmsqdw!=''">and CONCAT_WS('/',(SELECT name FROM kd_department d2 WHERE d2.id = d.parent_id), d.`name`) like concat('%',#{ew.xmsqdw},'%')</if>-->
|
|
|
-<!-- <if test="ew.status!=null">and COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'STATUS' AND (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') <![CDATA[<]]> #{ew.yearAndMonth} or (DATE_FORMAT(bgrz.BGSXSJ, '%Y%m') =#{ew.yearAndMonth} and bgrz.BGSXSJ <![CDATA[<=]]> now())) ORDER BY bgrz.BGSXSJ DESC,bgrz.create_time desc LIMIT 1),xm.status) = #{ew.status}</if>-->
|
|
|
-<!-- </select>-->
|
|
|
-
|
|
|
<select id="summaryPage" resultType="org.sky.scientific.pojo.vo.XmSummary">
|
|
|
|
|
|
SELECT
|
|
|
@@ -184,9 +151,8 @@
|
|
|
COALESCE(get_xm_info(xm.id,'XMMC', null), XMMC) AS XMMC,
|
|
|
COALESCE(get_xm_info(xm.id,'XMFZR', null),XMFZR) AS XMFZR,
|
|
|
COALESCE(get_xm_info(xm.id,'XMSQDWID', null),xm.XMSQDWID) AS XMSQDWID,
|
|
|
-
|
|
|
COALESCE(get_xm_info(xm.id,'XMJSSJ', null),XMJSSJ) AS XMJSSJ,
|
|
|
- COALESCE(get_xm_info(xm.id,'STATUS', null),STATUS) AS STATUS,
|
|
|
+ COALESCE(get_xm_info(xm.id,'STATUS', null),STATUS) AS status,
|
|
|
YJLX,
|
|
|
XMLY,
|
|
|
XMKZXS,
|
|
|
@@ -213,6 +179,9 @@
|
|
|
where id in <foreach item="xmId" collection="xmIdList" separator="," open="(" close=")" index="index">#{xmId}</foreach>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getXmStatusByXmId" parameterType="java.lang.Long" resultType="java.lang.Integer">
|
|
|
+ SELECT COALESCE(get_xm_info(xm.id,'STATUS', null),STATUS) FROM kd_xm where id = #{xmId}
|
|
|
+ </select>
|
|
|
|
|
|
<select id="getXmIdByXmmcOrXmbh" resultType="java.lang.Long">
|
|
|
SELECT id
|
|
|
@@ -235,7 +204,8 @@
|
|
|
XMBH,
|
|
|
COALESCE(get_xm_info(xm.id,'XMMC', #{yearAndMonth}),XMMC) AS XMMC,
|
|
|
xm.XMKSSJ,
|
|
|
- COALESCE(get_xm_info(xm.id,'XMJSSJ', #{yearAndMonth}),XMJSSJ) AS XMJSSJ
|
|
|
+ COALESCE(get_xm_info(xm.id,'XMJSSJ', #{yearAndMonth}),XMJSSJ) AS XMJSSJ,
|
|
|
+ COALESCE(get_xm_info(xm.id,'STATUS', #{yearAndMonth}),STATUS) AS status
|
|
|
FROM kd_xm xm
|
|
|
where #{yearAndMonth} between DATE_FORMAT(XMKSSJ, '%Y%m') and DATE_FORMAT(COALESCE(get_xm_info(xm.id,'XMJSSJ', #{yearAndMonth}),XMJSSJ),'%Y%m')
|
|
|
</select>
|