You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.6 KiB

<?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="com.dsic.gj_erp.mapper.kc.ImCkwpkwpMapper">
<select id="slxxKcList" parameterType="map" resultType="com.dsic.gj_erp.bean.kc.SlKc">
SELECT (IM_CKWPKWP.KWH) AS KWH ,
IM_CKWPKWP.SXRQ ,
MS_DDJBP1.dzwz,
(IM_CKWPKWP.NBSBM) AS NBSBM ,
(IM_CKWPKWP.BSBS) AS BSBS ,
(IM_CKWPKWP.BSSCH) AS BSSCH ,
(IM_CKWPKWP.DQBM) AS DQBM ,
(IM_CKWPKWP.RKRQ) AS RKRQ ,
(IM_CKWPKWP.KSBM) AS KSBM ,
(IM_CKWPKWP.KSSX) AS KSSX ,
(IM_CKWPKWP.KSLX) AS KSLX ,
(IM_CKWPKWP.JGFLM) AS CGFLM ,
IM_CKWPKWP.GCDDH ,
IM_CKWPKWP.WPPH ,
IM_CKWPKWP.QXKCL,
IM_CKWPKWP.RKDJ,
IM_CKWPKWP.KCJE,
(IM_CKWPKWP.DHH) AS DHH,
(IM_CKWPKWP.KHTH) AS KHTH,
(IM_CKWPKWP.CPH) AS CPH,
(IM_CKWPKWP.DDTZ) AS DDTZ,
(IM_CKWPKWP.DDH) AS DDH,
rtrim(IM_CKWPKWP.BZ) AS BZ,
(IM_CKWPKWP.cpbs) AS cpbs,
IM_CKWPKWP.DDXH AS DDXH,
IM_CKWPKWP.cfcs AS CFCS,
(IM_CKWPKWP.LPH) AS LPH,
(IM_CKWPKWP.CFCS1) AS CFCS1,
IM_CKWPKWP.QXKCL1,
(IM_CKWPKWP.DC_CH) AS DC_CH ,
(IM_CKWPKWP.DC_CM) AS DC_CM ,
(IM_CKWPKWP.dc_pl) AS dc_pl ,
(IM_CKWPKWP.dc_fd) AS dc_fd,
(IM_CKWPKWP.DC_TH) AS DC_TH,
'' as xz,
(IM_CKWPKWP.CKH) AS CKH,
(IM_CKWPKWP.WPH) AS WPH,
(DM_WPJBP.WPMC) AS WPMC,
(DM_WPJBP.WPGG) AS WPGG,
(DM_WPJBP.WPXH) AS WPXH,
(DM_WPJBP.WPFLM) AS WPFLM,
(IM_CKWPKWP.dc_tpbh) AS dc_tpbh,
rtrim(IM_CKWPKWP.ZYCH) AS ZYCH ,
rtrim(IM_CKWPKWP.ZYPL) AS ZYPL,
rtrim(IM_CKWPKWP.ZYLX) AS ZYLX,
rtrim(IM_CKWPKWP.pwwz) AS pwwz,
rtrim(IM_CKWPKWP.SLDW) AS SLDW ,
rtrim(IM_CKWPKWP.WPZT) AS WPZT,
rtrim(IM_CKWPKWP.pwbz) AS pwbz,
sllsh,
dyry,
dyrq,
IM_CKWPKWP.ydid,
'N' as bs,
'N' as bs_all
FROM IM_CKWPKWP
join DM_WPJBP on((IM_CKWPKWP.WPH) = (DM_WPJBP.WPH))
left join (select MS_DDJBP.dzwz,
MS_DDJBP.ddmc,MS_DDMXP.dc_ch
from MS_DDJBP,MS_DDMXP
where MS_DDJBP.CGFLM = MS_DDMXP.CGFLM and MS_DDJBP.DDH = MS_DDMXP.DDH
and MS_DDJBP.CGFLM = '01' and MS_DDJBP.DDLX = 'B') as MS_DDJBP1 on(IM_CKWPKWP.gcddh =MS_DDJBP1.dc_ch )
WHERE( (IM_CKWPKWP.CKH) = '01' )
<if test="dcch != null and dcch!=''">
and IM_CKWPKWP.dc_ch=#{dcch}
</if>
<if test="ql!= null and ql!=''">
and IM_CKWPKWP.dzwz=#{ql}
</if>
<if test="wpgg!= null and wpgg!=''">
and DM_WPJBP.wpgg=#{wpgg}
</if>
<if test="lph!= null and lph!=''">
and IM_CKWPKWP.lph=#{lph}
</if>
<if test="kwh!= null and kwh!=''">
and IM_CKWPKWP.kwh like '%'+#{kwh}+'%'
</if>
<if test="wpxh!= null and wpxh!=''">
and IM_CKWPKWP.wpxh=#{wpxh}
</if>
<if test="rqopt=='01'.toString() ">
and isnull(IM_CKWPKWP.zych,'')=''
-- and ( isnull(IM_CKWPKWP.ydid,'')='' and isnull(IM_CKWPKWP.sllsh,'')='' )
</if>
<if test="rqopt=='02'.toString() ">
and isnull(IM_CKWPKWP.zych,'')&lt;&gt;'' and isnull(IM_CKWPKWP.sllsh,'')=''
-- and (isnull(IM_CKWPKWP.ydid,'')&lt;&gt;'' or isnull(IM_CKWPKWP.sllsh,'')&lt;&gt;'')
</if>
<if test="rqopt=='03'.toString() ">
and isnull(IM_CKWPKWP.zych,'')&lt;&gt;'' and isnull(IM_CKWPKWP.sllsh,'')&lt;&gt;''
</if>
<if test="rqopt=='03'.toString() ">
and isnull(IM_CKWPKWP.zych,'')&lt;&gt;'' and isnull(IM_CKWPKWP.sllsh,'')&lt;&gt;''
</if>
order by IM_CKWPKWP.kwh,IM_CKWPKWP.cfcs1 desc
</select>
</mapper>