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

        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.unis.crk.cplbusiness.entity.DataCrkywCplspDefault">
                    <id column="dataId" property="dataId" />
                    <result column="unitid" property="unitid" />
                    <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="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="sjjlspmc" property="sjjlspmc" />
                    <result column="sjjlspmcbh" property="sjjlspmcbh" />
                    <result column="scpc" property="scpc" />
                    <result column="gg" property="gg" />
                    <result column="jldw" property="jldw" />
                    <result column="tqyjts" property="tqyjts" />
                    <result column="kcyjs" property="kcyjs" />
                    <result column="kcyjx" property="kcyjx" />

                    <result column="sccs" property="sccs" />
                    <result column="sccsbh" property="sccsbh" />
                    <result column="dj" property="dj" />
                    <result column="isenable" property="isEnable" />
                    <result column="zgcw" property="zgcw" />
                    <result column="zgcs" property="zgcs" />
                    <result column="tccg" property="tccg" />
                    <result column="bz" property="bz" />
        </resultMap>
    <select id="selectMyMapsPage" resultType="java.util.Map">
        SELECT a.dataId as "dataId",
               a.gg as "gg",
               d.enumName as "jldw",
               a.sjjlspmc as "sjjlspmc",
               c.enumName as "sjjlpzmc",
               b.enumName as "sjjlppmc",
                a.sjjlspmcbh as "sjjlspmcbh",
                a.isEnable as "isEnable",
               a.scpc as "scpc",
               a.sccs as "sccs",
               a.cjsj as "cjsj",
               e.enumName as "djmc"
        FROM  data_crkyw_cplsp_default a
        LEFT JOIN  basic_enum b on a.sjjlppbh = b.enumId
        LEFT JOIN  basic_enum c on a.sjjlpzbh = c.enumId
        LEFT JOIN  basic_enum d on a.jldw = d.enumId
        LEFT JOIN  basic_enum e on a.dj = e.enumId
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
    </select>
    <select id="getCplTzdList" resultType="java.util.Map">
       SELECT
	a.dataId,
	a.unitid,
	a.scrq,
	a.bzq,
	c.enumName as "sjjlpzmc",
	a.sjjlpzbh,
	b.enumName as sjjlppmc,
	sjjlppbh,
	sjjlspmc,
	sjjlspmcbh,
	scpc,
	gg,
	d.enumName as "jldwmc",
	jldw,
	sccs,
	sccsbh,
	bz
FROM
	data_crkyw_cplsp_default a
	LEFT JOIN  basic_enum b on a.sjjlppbh = b.enumId
	LEFT JOIN  basic_enum c on a.sjjlpzbh = c.enumId
	LEFT JOIN  basic_enum d on a.jldw = d.enumId
    WHERE
     a.UnitID = #{unitId} and ifnull(a.isEnable, '0') = '1'
     order by cjsj desc
    </select>

    <select id="getCplSpListbydd" resultType="java.util.Map">
        SELECT
            a.dataId,
            a.unitid,
            a.scrq,
            a.bzq,
            c.enumName as "sjjlpzmc",
            a.sjjlpzbh,
            b.enumName as sjjlppmc,
            sjjlppbh,
            sjjlspmc,
            sjjlspmcbh,
            scpc,
            gg,
            d.enumName as "jldwmc",
            jldw,
            sccs,
            sccsbh,
            bz
        FROM
            data_crkyw_cplsp_default a
                LEFT JOIN  basic_enum b on a.sjjlppbh = b.enumId
                LEFT JOIN  basic_enum c on a.sjjlpzbh = c.enumId
                LEFT JOIN  basic_enum d on a.jldw = d.enumId
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
        order by cjsj desc
    </select>
</mapper>
