<?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.finishedGrainSupervision.modular.mapper.DataCrkywCplrkDefaultMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.unis.finishedGrainSupervision.modular.entity.DataCrkywCplrkDefault">
        <id column="dataId" property="dataId" />
        <result column="unitid" property="unitid" />
        <result column="zdmc" property="zdmc" />
        <result column="zdbm" property="zdbm" />
        <result column="ch" property="ch" />
        <result column="hwh" property="hwh" />
        <result column="chmc" property="chmc" />
        <result column="hwmc" property="hwmc" />
        <result column="builder" property="builder" />
        <result column="cjsj" property="cjsj" />
        <result column="editor" property="editor" />
        <result column="modifyDate" property="modifyDate" />
        <result column="updateTime" property="updateTime" />
        <result column="scrq" property="scrq" />
        <result column="bzq" property="bzq" />
        <result column="xz" property="xz" />
        <result column="deptId" property="deptId" />
        <result column="sjjlpzmc" property="sjjlpzmc" />
        <result column="sjjlpzbh" property="sjjlpzbh" />
        <result column="sjjlppmc" property="sjjlppmc" />
        <result column="sjjlppbh" property="sjjlppbh" />
        <result column="sjjldjbh" property="sjjldjbh" />
        <result column="sjjldjmc" property="sjjldjmc" />
        <result column="sjjlspmc" property="sjjlspmc" />
        <result column="sjjlspmcbh" property="sjjlspmcbh" />
        <result column="gysbh" property="gysbh" />
        <result column="gys" property="gys" />
        <result column="rkbh" property="rkbh" />
        <result column="ddbh" property="ddbh" />
        <result column="ddsl" property="ddsl" />
        <result column="ddsysl" property="ddsysl" />
        <result column="scpc" property="scpc" />
        <result column="gg" property="gg" />
        <result column="jldw" property="jldw" />
        <result column="js" property="js" />
        <result column="dj" property="dj" />
        <result column="zje" property="zje" />
        <result column="sjjlsl" property="sjjlsl" />
        <result column="ywsj" property="ywsj" />
        <result column="jggy" property="jggy" />
        <result column="cazylx" property="cazylx" />
        <result column="ysfs" property="ysfs" />
        <result column="ysfsmc" property="ysfsmc" />
        <result column="ccfs" property="ccfs" />
        <result column="scnf" property="scnf" />
        <result column="cd" property="cd" />
        <result column="zjbh" property="zjbh" />
        <result column="cph" property="cph" />
        <result column="ywlx" property="ywlx" />
        <result column="ywlxmc" property="ywlxmc" />
        <result column="cyr" property="cyr" />
        <result column="cyrdz" property="cyrdz" />
        <result column="cyrdh" property="cyrdh" />
        <result column="cyrsfz" property="cyrsfz" />
        <result column="ddcbid" property="ddcbid" />
        <result column="ddid" property="ddid" />
        <result column="pf" property="pf" />
        <result column="bz" property="bz" />
        <result column="isstaging" property="isstaging" />
    </resultMap>
    <select id="selectRkdetails"
            resultType="com.unis.finishedGrainSupervision.modular.entity.DataCrkywCplrkDefault">
        SELECT
            cf_enum.storehouse_name AS chmc,
            hw_enum.warehouse_name AS hwmc,
            ywlx_enum.enumName AS ywlxmc,
            ysfs_enum.enumName AS ysfsmc,
            a.dataId,
            a.unitid,
            a.zdmc,
            a.zdbm,
            a.ch,
            a.cazylx,
            a.hwh,
            a.builder,
            a.editor,
            a.cjsj,
            a.modifyDate,
            a.updateTime,
            a.scrq,
            a.bzq,
            a.xz,
            a.deptId,
            a.sjjlpzmc,
            a.sjjlpzbh,
            a.sjjlppmc,
            a.sjjlppbh,
            a.sjjldjbh,
            a.sjjldjmc,
            a.sjjlspmc,
            a.sjjlspmcbh,
            a.gysbh,
            a.gys,
            a.rkbh,
            a.ddbh,
            a.ddsl,
            a.ddsysl,
            a.scpc,
            a.gg,
            a.jldw,
            a.js,
            a.dj,
            a.zje,
            a.sjjlsl,
            a.ywsj,
            a.jggy,
            a.ysfs,
            a.ccfs,
            a.cd,
            a.scnf,
            a.zjbh,
            a.cph,
            a.ywlx,
            a.cyr,
            a.cyrdz,
            a.cyrdh,
            a.cyrsfz,
            a.ddcbid,
            a.ddid,
            a.pf,
            a.bz,
            a.isstaging,
            bpgp.plan_name planName,
            oi.org_name org_name
        FROM
            depot_qh.data_crkyw_cplrk_default a
                LEFT JOIN depot_qh.basic_enum ywlx_enum ON ywlx_enum.enumId = a.ywlx
                LEFT JOIN depot_qh.basic_enum ysfs_enum ON ysfs_enum.enumId = a.ysfs
                LEFT JOIN depot_qh.basic_storehouse cf_enum ON cf_enum.storehouse_id = a.ch
                LEFT JOIN depot_qh.basic_warehouse hw_enum ON hw_enum.warehouse_id = a.hwh
                LEFT JOIN depot_qh.business_pg_gops_plan bpgp ON a.ddbh = bpgp.id
                left join depot_qh.org_info oi on oi.org_id= a.unitid
        WHERE
            a.dataId =#{dateCrkywCplcrkIdParam.dataId}

    </select>

</mapper>