PortalNewsNoticeMapper.xml 3.58 KB
<?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.hotent.column.persistence.dao.PortalNewsNoticeDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hotent.column.model.PortalNewsNotice">
        <id column="ID_" property="id" jdbcType="VARCHAR" />
        <result column="CLASSIFY_ID_" property="classifyId" jdbcType="VARCHAR"/>
        <result column="CLASSIFY_NAME_" property="classifyName" jdbcType="VARCHAR"/>
        <result column="CLASSIFY_PATH_" property="classifyPath" jdbcType="VARCHAR"/>
        <result column="TITLE_" property="title" jdbcType="VARCHAR"/>
        <result column="IS_URL_" property="isUrl" jdbcType="VARCHAR"/>
        <result column="URL_" property="url" jdbcType="VARCHAR"/>
        <result column="CONTENT_" property="content" jdbcType="VARCHAR"/>
        <result column="SN_" property="sn" jdbcType="NUMERIC"/>
        <result column="END_TIME_" property="endTime"  jdbcType="TIMESTAMP"/>
        <result column="ROTATING_DISPLAY_PICTURES_" property="rotatingDisplayPictures" />
        <result column="TITLE_DESCRIPTION_" property="titleDescription" jdbcType="VARCHAR"/>
        <result column="PAGE_HEIGHT_" property="pageHeight" jdbcType="VARCHAR"/>
        <result column="TENANT_ID_" property="tenantId" jdbcType="VARCHAR"/>
        <result column="CREATE_TIME_" property="createTime"  jdbcType="TIMESTAMP"/>
        <result column="CREATE_BY_" property="createBy" jdbcType="VARCHAR"/>
        <result column="UPDATE_TIME_" property="updateTime"  jdbcType="TIMESTAMP"/>
        <result column="UPDATE_BY_" property="updateBy" jdbcType="VARCHAR"/>
        <result column="TYPE_" property="type" jdbcType="NUMERIC"/>
        <result column="CREATE_BY_NAME_" property="createByName" jdbcType="VARCHAR"/>
        <result column="UPDATE_BY_NAME_" property="updateByName" jdbcType="VARCHAR"/>
        <result column="ICON_" property="icon" jdbcType="VARCHAR"/>
        <result column="FILE_" property="file" jdbcType="VARCHAR"/>
        <result column="DRAFTER_" property="drafter" jdbcType="VARCHAR"/>
        <result column="ICON_COLOR_" property="iconColor" jdbcType="VARCHAR"/>
        <result column="TAG_" property="tag" jdbcType="VARCHAR"/>
        <result column="PUBLISH_TIME_" property="publishTime" jdbcType="TIMESTAMP"/>
        <result column="OPEN_TYPE_" property="openType" jdbcType="VARCHAR"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID_, CLASSIFY_ID_, CLASSIFY_NAME_, CLASSIFY_PATH_, TITLE_, IS_URL_, URL_, CONTENT_, SN_, END_TIME_, ROTATING_DISPLAY_PICTURES_, TITLE_DESCRIPTION_, PAGE_HEIGHT_, TENANT_ID_, CREATE_TIME_, CREATE_BY_, UPDATE_TIME_, UPDATE_BY_, TYPE_,ICON_COLOR_,TAG_
    </sql>


    <delete id="deleteByClassifyId" parameterType="java.lang.String">
        delete from portal_news_notice_ where CLASSIFY_ID_ = #{classifyId}
    </delete>
    <delete id="deleteNewsByParentId" parameterType="java.lang.String">
        delete from portal_news_notice_ where CLASSIFY_ID_ in (select id_ from portal_news_tree_ where PARENT_ID_ = #{parentId})
    </delete>

    <select id="listNewsCurrentUserAuth" resultType="com.hotent.column.model.PortalNewsNotice" parameterType="map">
        SELECT t1.*,( CASE  WHEN t2.id_ is  NULL THEN 0 ELSE 1 END ) AS reader
        FROM
	    portal_news_notice_ t1
	    LEFT JOIN portal_news_notice_read t2 ON t1.ID_ = t2.PORTAL_NEWS_NOTICE_ID_ AND t2.USER_ID_= #{userId}
	     ${ew.customSqlSegment} order by t1.sn_ ASC,t1.CREATE_TIME_ DESC
    </select>

</mapper>