<?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.unis.crk.cplbusiness.mapper.DataCrkywCpltzdxxFlt001Mapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.unis.crk.cplbusiness.entity.DataCrkywCpltzdxxFlt001">
        <id column="DataID" property="DataID"/>
        <result column="UnitID" property="UnitID"/>
        <result column="PeriodID" property="PeriodID"/>
        <result column="RoundID" property="RoundID"/>
        <result column="ModifyDate" property="ModifyDate"/>
        <result column="builder" property="builder"/>
        <result column="UPDATE_TIME" property="updateTime"/>
        <result column="DeptID" property="DeptID"/>
        <result column="SytelInfoID" property="SytelInfoID"/>
        <result column="BuildDate" property="BuildDate"/>
        <result column="editor" property="editor"/>
        <result column="MainDataID" property="MainDataID"/>
        <result column="ch" property="ch"/>
        <result column="chmc" property="chmc"/>
        <result column="hwh" property="hwh"/>
        <result column="hwhmc" property="hwhmc"/>
        <result column="hlbs" property="hlbs"/>
        <result column="sjcksj" property="sjcksj"/>
        <result column="scpc" property="scpc"/>
        <result column="bzq" property="bzq"/>
        <result column="sl" property="sl"/>
        <result column="js" property="js"/>
        <result column="wcsl" property="wcsl"/>
        <result column="je" property="je"/>
        <result column="dj" property="dj"/>
        <result column="mxpzmc" property="mxpzmc"/>
        <result column="mxpz" property="mxpz"/>
        <result column="lspzmc" property="lspzmc"/>
        <result column="lspz" property="lspz"/>
        <result column="xz" property="xz"/>
        <result column="sysl" property="sysl"/>
        <result column="sjjlppmc" property="sjjlppmc"/>
        <result column="sjjlppmcbh" property="sjjlppmcbh"/>
        <result column="jyjg" property="jyjg"/>
        <result column="scnf" property="scnf"/>
        <result column="lsdj" property="lsdj"/>
        <result column="cd" property="cd"/>
        <result column="gg" property="gg"/>
        <result column="scrq" property="scrq"/>

        <result column="scnfmc" property="scnfmc"/>
        <result column="cdmc" property="cdmc"/>
        <result column="xzmc" property="xzmc"/>
        <result column="lsdjmc" property="lsdjmc"/>
        <result column="jldwmc" property="jldwmc"/>
        <result column="istax" property="istax" />
        <result column="taxrate" property="taxrate" />

    </resultMap>
    <select id="selectMyMapsPage" resultType="java.util.Map">
        SELECT * FROM data_crkyw_cpltzdxx_flt_001
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where ${ew.sqlSegment}
        </if>
    </select>
    <select id="getFltForMainDataId" resultType="java.util.Map">
      SELECT DISTINCT
tzscnf_enum.enumName AS scnfmc,
tzcd_enum.enumName AS cdmc,
lsxz_enum.enumName AS xzmc,
lspz_enum.enumName AS lspzmc,
lsdj_enum.enumName AS lsdjmc,
mxpz_enum.sjjlspmc AS  mxpzmc,
lspp_enum.enumName AS sjjlppmc,
jldw_enum.enumName AS jldwmc,
b.DataID as "dataID",
b.UnitID,
b.PeriodID,
b.RoundID,
b.ModifyDate,
b.builder,
b.UPDATE_TIME,
b.DeptID,
b.SytelInfoID,
b.BuildDate,
b.editor,
b.MainDataID,
b.ch,
b.chmc,
b.hwh,
b.hwhmc,
b.hlbs,
b.sjcksj,
b.scpc,
b.bzq,
b.sl,
b.je,
b.dj,
b.mxpz,
b.lspz,
b.xz,
b.wcsl,
b.sysl,
b.sjjlppmcbh,
b.jyjg,
b.scnf,
b.cd,
b.gg,
b.jldw,
b.lsdj,
b.js,
b.scrq
FROM
	data_crkyw_cpltzdxx_flt_001 b
LEFT JOIN basic_enum tzscnf_enum ON tzscnf_enum.enumId = b.scnf
LEFT JOIN basic_enum tzcd_enum ON tzcd_enum.enumId = b.cd
LEFT JOIN basic_enum lsxz_enum ON lsxz_enum.enumId = b.xz
LEFT JOIN basic_enum lspz_enum ON lspz_enum.enumId = b.lspz
LEFT JOIN basic_enum lsdj_enum ON lsdj_enum.enumId = b.lsdj
LEFT JOIN basic_enum lspp_enum ON lspp_enum.enumId = b.sjjlppmcbh
LEFT JOIN data_crkyw_cplsp_default mxpz_enum ON mxpz_enum.sjjlspmcbh = b.mxpz
 and  mxpz_enum.unitId = b.unitId
LEFT JOIN basic_enum jldw_enum ON jldw_enum.enumId = b.jldw
WHERE
	b.MainDataID =#{dataId}

    </select>
    <select id="getCplCrkTzdFltList" resultType="java.util.Map">
    SELECT DISTINCT
        b.DataID AS ddcbid,
        tzscnf_enum.enumName AS scnf_value,
        b.scnf,
        tzcd_enum.enumName AS cd_value,
        b.cd,
        lsxz_enum.enumName AS xz_value,
        b.xz,
        b.dj,
        lspz_enum.enumName AS sjjlpzmc,
        b.lspz as sjjlpzbh,
        b.sl,
        b.lsdj as sjjldjbh,
        lsdj_enum.enumName AS sjjldjmc,

        mxpz_enum.sjjlspmc AS sjjlspmc,
        b.mxpz as sjjlspmcbh,
        b.sjjlppmcbh as sjjlppbh,
        lspp_enum.enumName AS sjjlppmc,
        b.sysl,
        b.sysl as kcsl,
        b.sysl/b.gg as syjs,
        b.ch,
        b.gg,
        b.bzq,
        b.jldw,
        b.ModifyDate,
        jldw_enum.enumName AS jldwmc,
        b.taxrate,
        b.istax
        FROM
         data_crkyw_cpltzdxx_flt_001 b
        LEFT JOIN basic_enum tzscnf_enum ON tzscnf_enum.enumId = b.scnf
        LEFT JOIN basic_enum tzcd_enum ON tzcd_enum.enumId = b.cd
        LEFT JOIN basic_enum lsxz_enum ON lsxz_enum.enumId = b.xz
        LEFT JOIN basic_enum lspz_enum ON lspz_enum.enumId = b.lspz
        LEFT JOIN basic_enum lsdj_enum ON lsdj_enum.enumId = b.lsdj
        LEFT JOIN basic_enum lspp_enum ON lspp_enum.enumId = b.sjjlppmcbh
        LEFT JOIN data_crkyw_cplsp_default mxpz_enum ON mxpz_enum.sjjlspmcbh =b.mxpz
         and  mxpz_enum.unitId = b.unitId
         LEFT JOIN basic_enum jldw_enum ON jldw_enum.enumId =b.jldw
        WHERE
        b.MainDataID = #{dataId}
         AND b.sysl > 0
        order by b.ModifyDate desc
    </select>
</mapper>
