<?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.business.qcrk.mapper.DataCrkywJyxxFlt001Mapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.unis.crk.business.qcrk.entity.DataCrkywJyxxFlt001">
        <id column="DataID" property="DataID" />
        <result column="UnitID" property="UnitID" />
        <result column="PeriodID" property="PeriodID" />
        <result column="RoundID" property="RoundID" />
        <result column="builder" property="builder" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="SytelInfoID" property="SytelInfoID" />
        <result column="BuildDate" property="BuildDate" />
        <result column="editor" property="editor" />
        <result column="ModifyDate" property="ModifyDate" />
        <result column="DeptID" property="DeptID" />
        <result column="MainDataID" property="MainDataID" />
        <result column="zbxmc" property="zbxmc" />
        <result column="jykl" property="jykl" />
        <result column="jykj" property="jykj" />
        <result column="jyz" property="jyz" />
        <result column="bz" property="bz" />
        <result column="jykjje" property="jykjje" />
        <result column="zklsl" property="zklsl" />
    </resultMap>

    <select id="selectMyMapsPage" resultType="java.util.Map">
        SELECT * FROM data_crkyw_jyxx_flt_001
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where ${ew.sqlSegment}
        </if>
    </select>
    <select id="getLitByMainDatId" resultType="java.util.Map">
        SELECT
        a.jykl AS "jykl",
        a.jykj AS "jykj",
        a.jyz AS "jyz",
        a.jykjje AS "jykjje",
        a.zklsl AS "zklsl",
        a.zbxmc AS "zbxmc",
        d.enumName AS "zbxmc_value",
        a.MainDataID AS "mainDataId",
        a.DataID AS "dataID",
        d.parentId,
        d.enumCode
        FROM
        DATA_CRKYW_JYXX_FLT_001 a
        LEFT JOIN DATA_CRKYW_JYXX_DEFAULT b ON b.DataID = a.MainDataId
        LEFT JOIN BASIC_ENUM d ON a.zbxmc = d.enumId
        <where>
            <if test='mainDataId != null and mainDataId != ""'>
                and b.DataID = #{mainDataId}
            </if>
            <if test='bizNo != null and bizNo != ""'>
                and b.bizNo = #{bizNo}
            </if>
        </where>
        ORDER BY d.parentId desc,d.enumCode asc
    </select>


</mapper>