<?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.DataCrkywCpljyxxDefaultMapper">

        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.unis.crk.cplbusiness.entity.DataCrkywCpljyxxDefault">
                    <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="scpc" property="scpc" />
                    <result column="gysbh" property="gysbh" />
                    <result column="gys" property="gys" />
                    <result column="ddbh" property="ddbh" />
                    <result column="ddcbid" property="ddcbid" />
                    <result column="htbh" property="htbh" />
                    <result column="jhbh" property="jhbh" />
                    <result column="dhrq" property="dhrq" />
                    <result column="cysm" property="cysm" />
                    <result column="cysj" property="cysj" />
                    <result column="cyr" property="cyr" />
                    <result column="cywds" property="cywds" />
                    <result column="ypbh" property="ypbh" />
                    <result column="cybz" property="cybz" />
                    <result column="zljybhbh" property="zljybhbh" />
                    <result column="jyr" property="jyr" />
                    <result column="jyfs" property="jyfs" />
                    <result column="dsfjhbm" property="dsfjhbm" />
                    <result column="jyjg" property="jyjg" />
                    <result column="ywlx" property="ywlx" />
                    <result column="bzyq" property="bzyq" />
                    <result column="jybz" property="jybz" />
                    <result column="lybzyjyz" property="lybzyjyz" />
                    <result column="bz" property="bz" />
                    <result column="jyjgName" property="jyjgName" />
                    <result column="jyfsName" property="jyfsName" />
                    <result column="pf" property="pf" />
                    <result column="jysj" property="jysj" />
                    <result column="ywlxmc" property="ywlxmc" />
                    <result column="name_of_inspection_institution" property="nameOfInspectionInstitution" />
                    <result column="ypsl" property="ypsl" />
        </resultMap>

    <select id="selectMyMapsPage" resultType="java.util.Map">
        SELECT
        sjjlspmc_enum.gg as gg,
        jldw_enum.enumName as jldw,
        jyjg_enum.enumName AS jyjgName,
        jyfs_enum.enumName AS jyfsName,
        dj_enum.enumName AS sjjldjmc,
        sjjlppmc_enum.enumName AS sjjlppmc,
        a.sjjlpzbh,
        sjjlpzmc_enum.enumName AS sjjlpzmc,
        a.sjjlspmcbh,
        sjjlspmc_enum.sjjlspmc AS sjjlspmc,
        a.sjjldjbh,
        a.dataId,
        a.unitid,
        a.zdmc,
        a.zdbm,
        a.ch,
        a.hwh,
        a.chmc,
        a.hwmc,
        a.builder,
        a.cjsj,
        a.editor,
        a.modifyDate,
        a.updateTime,
        a.scrq,
        a.bzq,
        a.xz,
        a.deptId,
        a.scpc,
        a.gysbh,
        a.gys,
        a.ddbh,
        a.ddcbid,
        a.jysj,
        a.htbh,
        a.jhbh,
        a.dhrq,
        a.cysm,
        a.cysj,
        a.cyr,
        a.cywds,
        a.ypbh,
        a.cybz,
        a.zljybhbh,
        a.jyr,
        a.jyfs,
        a.dsfjhbm,
        a.jyjg,
        a.ywlx,
        a.bzyq,
        a.jybz,
        a.lybzyjyz,
        a.pf,
        a.bz,
        a.ypsl,
        a.name_of_inspection_institution as nameOfInspectionInstitution
        FROM
        data_crkyw_cpljyxx_default a
        LEFT JOIN basic_enum jyjg_enum ON jyjg_enum.enumId = a.jyjg
        LEFT JOIN basic_enum jyfs_enum ON jyfs_enum.enumId = a.jyfs
        LEFT JOIN basic_enum dj_enum ON dj_enum.enumId = a.sjjldjbh
        LEFT JOIN basic_enum sjjlppmc_enum ON sjjlppmc_enum.enumId = a.sjjlppbh
        LEFT JOIN basic_enum sjjlpzmc_enum ON sjjlpzmc_enum.enumId = a.sjjlpzbh
        LEFT JOIN data_crkyw_cplsp_default sjjlspmc_enum ON sjjlspmc_enum.sjjlspmcbh = a.sjjlspmcbh
        and  sjjlspmc_enum.unitId = a.unitId
        LEFT JOIN basic_enum jldw_enum on sjjlspmc_enum.jldw = jldw_enum.enumId
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
        order by modifyDate desc
    </select>
    <select id="getCplJyxxList" resultType="java.util.Map">
        SELECT DISTINCT
        sjjlspmc_enum.gg as gg,
        jldw_enum.enumName as jldw,
        a.zljybhbh,
        a.ddbh,
        a.scrq,
        a.bzq,
        a.scpc,
        a.gys,
        a.sjjlppbh,
        sjjlppmc_enum.enumName as sjjlppmc,
        a.sjjlpzbh,
        sjjlpzmc_enum.enumName as sjjlpzmc,
        a.sjjlspmcbh,
        sjjlspmc_enum.sjjlspmc as sjjlspmc,
        a.sjjldjbh,
        sjjldjmc_enum.enumName as sjjldjmc,
        a.cjsj
        FROM
        data_crkyw_cpljyxx_default a
        LEFT JOIN basic_enum sjjlppmc_enum ON sjjlppmc_enum.enumId = a.sjjlppbh
        LEFT JOIN basic_enum sjjlpzmc_enum ON sjjlpzmc_enum.enumId = a.sjjlpzbh
        LEFT JOIN data_crkyw_cplsp_default sjjlspmc_enum ON sjjlspmc_enum.sjjlspmcbh = a.sjjlspmcbh
        and  sjjlspmc_enum.unitId = a.unitId
        LEFT JOIN basic_enum sjjldjmc_enum ON sjjldjmc_enum.enumId = a.sjjldjbh
        LEFT JOIN basic_enum jldw_enum on sjjlspmc_enum.jldw = jldw_enum.enumId
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
    </select>
    <select id="selectByIdgetOne" resultType="com.unis.crk.cplbusiness.entity.DataCrkywCpljyxxDefault">
        SELECT
            jyjg_enum.enumName AS jyjgName,
            jyfs_enum.enumName AS jyfsName,
            dj_enum.enumName AS sjjldjmc,
            cf_enum.storehouse_name AS chmc,
            hw_enum.warehouse_name AS hwmc,
            lspz_enum.enumName AS sjjlpzmc,
            lspp_enum.enumName AS sjjlppmc,
            ywlx_enum.enumName AS ywlxmc,
            a.dataId,
            a.unitid,
            a.zdmc,
            a.zdbm,
            a.ch,
            a.hwh,
            a.builder,
            a.cjsj,
            a.editor,
            a.modifyDate,
            a.updateTime,
            a.scrq,
            a.bzq,
            a.xz,
            a.deptId,
            a.sjjlpzbh,
            a.sjjlppbh,
            a.sjjldjbh,
            a.sjjlspmc,
            a.sjjlspmcbh,
            a.scpc,
            a.gysbh,
            a.gys,
            a.ddbh,
            a.ddcbid,
            a.jysj,
            a.htbh,
            a.jhbh,
            a.dhrq,
            a.ypsl,
            a.cysm,
            a.cysj,
            a.cyr,
            a.cywds,
            a.ypbh,
            a.cybz,
            a.zljybhbh,
            a.jyr,
            a.jyfs,
            a.dsfjhbm,
            a.jyjg,
            a.ywlx,
            a.bzyq,
            a.jybz,
            a.lybzyjyz,
            a.pf,
            a.bz,
            a.name_of_inspection_institution as nameOfInspectionInstitution

        FROM
            data_crkyw_cpljyxx_default a
                LEFT JOIN basic_enum jyjg_enum ON jyjg_enum.enumId = a.jyjg
                LEFT JOIN basic_enum jyfs_enum ON jyfs_enum.enumId = a.jyfs
                LEFT JOIN basic_enum dj_enum ON dj_enum.enumId = a.sjjldjbh
                LEFT JOIN basic_enum lsxz_enum ON lsxz_enum.enumId = a.xz
                LEFT JOIN basic_enum lspz_enum ON lspz_enum.enumId = a.sjjlpzbh
                LEFT JOIN basic_enum ywlx_enum ON ywlx_enum.enumId = a.ywlx
                LEFT JOIN basic_enum lspp_enum ON lspp_enum.enumId = a.sjjlppbh
                LEFT JOIN basic_storehouse cf_enum ON cf_enum.storehouse_id = a.ch
                LEFT JOIN basic_warehouse hw_enum ON hw_enum.warehouse_id = a.hwh
        where  a.dataId= #{id}
    </select>

</mapper>
