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

        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.unis.crk.cplbusiness.entity.DataCrkywCplckDefault">
                    <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="scnf" property="scnf" />
                    <result column="cd" property="cd" />
                    <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="ckbh" property="ckbh" />
                    <result column="khmc" property="khmc" />
                    <result column="ddbh" property="ddbh" />
                    <result column="ccfs" property="ccfs" />
                    <result column="ywsj" property="ywsj" />
                    <result column="ddsl" property="ddsl" />
                    <result column="ddsysl" property="ddsysl" />
                    <result column="scpc" property="scpc" />
                    <result column="gg" property="gg" />
                    <result column="js" property="js" />
                    <result column="dj" property="dj" />
                    <result column="zje" property="zje" />
                    <result column="sjjlsl" property="sjjlsl" />
                    <result column="spkczl" property="spkczl" />
                    <result column="zjbh" property="zjbh" />
                    <result column="cphId" property="cphId" />
                    <result column="cph" property="cph" />
                    <result column="ysfs" property="ysfs" />
                    <result column="ysfsmc" property="ysfsmc" />
                    <result column="ywlx" property="ywlx" />
                    <result column="cazylx" property="cazylx" />
                    <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="lsdbh" property="lsdbh" />
                    <result column="ddcbid" property="ddcbid" />
                    <result column="ztps" property="ztps" />
                    <result column="nwc" property="nwc" />
                    <result column="khid" property="khid" />
                    <result column="ddid" property="ddid" />
                    <result column="ryid" property="ryid" />
                    <result column="pf" property="pf" />
                    <result column="bz" property="bz" />
                    <result column="isstaging" property="isstaging" />
        </resultMap>


    <select id="selectMyMapsPage" resultType="java.util.Map">
        SELECT	a.*, ywlx_enum.enumName AS ywlxmc FROM	data_crkyw_cplck_default a LEFT JOIN basic_enum ywlx_enum ON ywlx_enum.enumId = a.ywlx
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
        order by modifyDate desc
    </select>

    <select id="getOneById" resultType="com.unis.crk.cplbusiness.entity.DataCrkywCplckDefault">
        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.hwh,
            a.builder,
            a.editor,
            a.cjsj,
            a.modifyDate,
            a.updateTime,
            a.scrq,
            a.bzq,
            a.xz,
            a.deptId,
            a.sjjlpzmc,
            a.sjjlpzbh,
            a.cazylx,
            a.sjjlppmc,
            a.sjjlppbh,
            a.sjjldjbh,
            a.sjjldjmc,
            a.sjjlspmc,
            a.sjjlspmcbh,
            a.ckbh,
            a.khmc,
            a.ddbh,
            a.ccfs,
            a.ywsj,
            a.ddsl,
            a.ddsysl,
            a.scpc,
            a.gg,
            a.jldw,
            a.js,
            a.dj,
            a.cd,
            a.scnf,
            a.zje,
            a.sjjlsl,
            a.spkczl,
            a.zjbh,
            a.cphId,
            a.cph,
            a.ysfs,
            a.ywlx,
            a.cyr,
            a.cyrdz,
            a.cyrdh,
            a.cyrsfz,
            a.lsdbh,
            a.ddcbid,
            a.pf,
            a.bz,
            a.ztps,
            a.nwc,
            a.khid,
            a.ddid,
            a.ryid,
            a.isstaging
        FROM
            data_crkyw_cplck_default a
                LEFT JOIN basic_enum ywlx_enum ON ywlx_enum.enumId = a.ywlx
                LEFT JOIN basic_enum ysfs_enum ON ysfs_enum.enumId = a.ysfs
                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
            dataId = #{id}

    </select>
    <select id="getAppCkList" resultType="com.unis.crk.cplbusiness.entity.DataCrkywCplckDefault">
        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.hwh,
            a.builder,
            a.editor,
            a.cjsj,
            a.modifyDate,
            a.updateTime,
            a.scrq,
            a.bzq,
            a.xz,
            a.cazylx,
            a.deptId,
            a.sjjlpzmc,
            a.sjjlpzbh,
            a.sjjlppmc,
            a.sjjlppbh,
            a.sjjldjbh,
            a.sjjldjmc,
            a.sjjlspmc,
            a.sjjlspmcbh,
            a.ckbh,
            a.khmc,
            a.ddbh,
            a.ccfs,
            a.ywsj,
            a.ddsl,
            a.ddsysl,
            a.scpc,
            a.gg,
            a.jldw,
            a.js,
            a.dj,
            a.cd,
            a.scnf,
            a.zje,
            a.sjjlsl,
            a.spkczl,
            a.zjbh,
            a.cph,
            a.ysfs,
            a.ywlx,
            a.cyr,
            a.cyrdz,
            a.cyrdh,
            a.cyrsfz,
            a.lsdbh,
            a.ddcbid,
            a.pf,
            a.bz,
            a.khid,
            a.ddid,
            a.ryid
        FROM
            data_crkyw_cplck_default a
                LEFT JOIN basic_enum ywlx_enum ON ywlx_enum.enumId = a.ywlx
                LEFT JOIN basic_enum ysfs_enum ON ysfs_enum.enumId = a.ysfs
                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
            ddbh = #{ddbh}
    </select>

</mapper>
