|
@@ -26,12 +26,13 @@
|
|
<result column="memo_" property="memo" />
|
|
<result column="memo_" property="memo" />
|
|
<result column="attribute1_" property="attribute1" />
|
|
<result column="attribute1_" property="attribute1" />
|
|
<result column="attribute2_" property="attribute2" />
|
|
<result column="attribute2_" property="attribute2" />
|
|
- <result column="subject_id_list_" property="subjectIdList" />
|
|
|
|
|
|
+ <result column="show_time_" property="showTime" />
|
|
|
|
+ <result column="update_by_" property="updateBy" />
|
|
|
|
+ <result column="create_by_" property="createBy" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
|
|
<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
|
|
- <result column="typeName" property="typeName" />
|
|
|
|
- <result column="subTypeName" property="subTypeName" />
|
|
|
|
|
|
+ <result column="updateName" property="updateName" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<sql id="queryCondition">
|
|
<sql id="queryCondition">
|
|
@@ -40,14 +41,16 @@
|
|
<if test="type != null">
|
|
<if test="type != null">
|
|
and sni.type_ = #{type}
|
|
and sni.type_ = #{type}
|
|
</if>
|
|
</if>
|
|
- <if test="subType != null">
|
|
|
|
|
|
+ <if test="subType != null and subType != ''">
|
|
and sni.sub_type_ = #{subType}
|
|
and sni.sub_type_ = #{subType}
|
|
</if>
|
|
</if>
|
|
<if test="status != null">
|
|
<if test="status != null">
|
|
and sni.status_ = #{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler}
|
|
and sni.status_ = #{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler}
|
|
</if>
|
|
</if>
|
|
<if test="title != null">
|
|
<if test="title != null">
|
|
- and sni.title_ like '%' #{title} '%'
|
|
|
|
|
|
+ and (sni.title_ like '%' #{title} '%'
|
|
|
|
+ or sni.id_ like concat('%',#{titile},'%')
|
|
|
|
+ )
|
|
</if>
|
|
</if>
|
|
<if test="search != null">
|
|
<if test="search != null">
|
|
and sni.title_ like '%' #{search} '%'
|
|
and sni.title_ like '%' #{search} '%'
|
|
@@ -55,22 +58,18 @@
|
|
<if test="subjectId != null">
|
|
<if test="subjectId != null">
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="platformType != null and platformType != ''">
|
|
|
|
+ <if test="platformType != 'ADMIN'" >
|
|
|
|
+ and sni.status_ = 1 and sni.online_time_ <= now()
|
|
|
|
+ and if(sni.offline_time_ is not null,sni.offline_time_ >= now(),1=1)
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
<if test="excludeIds!=null and excludeIds.size()>0">
|
|
<if test="excludeIds!=null and excludeIds.size()>0">
|
|
AND sni.id_ NOT IN
|
|
AND sni.id_ NOT IN
|
|
<foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">
|
|
<foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">
|
|
#{excludeId}
|
|
#{excludeId}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
- <if test="clientName != 'manage'">
|
|
|
|
- <choose>
|
|
|
|
- <when test="memo != null and memo != ''">
|
|
|
|
- and sni.memo_ = #{memo}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- and (sni.memo_ is null or sni.memo_ = '')
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </if>
|
|
|
|
</where>
|
|
</where>
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
@@ -86,8 +85,8 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
<!-- 向数据库增加一条记录 -->
|
|
<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
- INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,attribute1_,attribute2_,subject_id_list_)
|
|
|
|
- VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{attribute1},#{attribute2},#{subjectIdList})
|
|
|
|
|
|
+ INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,attribute1_,attribute2_,subject_id_list_,create_by_,update_by_,show_time_)
|
|
|
|
+ VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{attribute1},#{attribute2},#{subjectIdList},#{createBy},#{updateBy},#{showTime})
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -117,7 +116,7 @@
|
|
</if>
|
|
</if>
|
|
online_time_ = #{onlineTime},
|
|
online_time_ = #{onlineTime},
|
|
offline_time_ = #{offlineTime},
|
|
offline_time_ = #{offlineTime},
|
|
- <if test="subType != null">
|
|
|
|
|
|
+ <if test="subType != null and subType != ''">
|
|
sub_type_ = #{subType},
|
|
sub_type_ = #{subType},
|
|
</if>
|
|
</if>
|
|
<if test="linkUrl != null">
|
|
<if test="linkUrl != null">
|
|
@@ -144,6 +143,12 @@
|
|
<if test="subjectIdList != null">
|
|
<if test="subjectIdList != null">
|
|
subject_id_list_ = #{subjectIdList},
|
|
subject_id_list_ = #{subjectIdList},
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
+ update_by_ = #{updateBy},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="showTime != null">
|
|
|
|
+ show_time_ = #{showTime}
|
|
|
|
+ </if>
|
|
</set>
|
|
</set>
|
|
WHERE id_ = #{id}
|
|
WHERE id_ = #{id}
|
|
</update>
|
|
</update>
|
|
@@ -154,17 +159,18 @@
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
<!-- 分页查询 -->
|
|
- <select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
|
|
|
|
- SELECT sni.*,GROUP_CONCAT(distinct s.name_) subject_name_,GROUP_CONCAT(distinct o.name_) organ_name_list_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
|
|
|
|
- left join organization o on find_in_set(o.id_,sni.organ_id_list_)
|
|
|
|
|
|
+ <select id="selectPage" resultMap="SysNewsInformationDto" parameterType="map">
|
|
|
|
+ SELECT sni.*
|
|
|
|
+ , su.username_ as updateName
|
|
|
|
+ FROM sys_news_information sni
|
|
|
|
+ left join sys_user su on sni.update_by_ = su.id_
|
|
<include refid="queryCondition" />
|
|
<include refid="queryCondition" />
|
|
- group by sni.id_
|
|
|
|
order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
<include refid="global.limit"/>
|
|
<include refid="global.limit"/>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
<!-- 查询当前表的总记录数 -->
|
|
- <select id="queryCount" resultType="int">
|
|
|
|
|
|
+ <select id="selectPageCount" resultType="int">
|
|
SELECT COUNT(sni.id_) FROM sys_news_information sni
|
|
SELECT COUNT(sni.id_) FROM sys_news_information sni
|
|
<include refid="queryCondition" />
|
|
<include refid="queryCondition" />
|
|
</select>
|
|
</select>
|
|
@@ -186,11 +192,13 @@
|
|
<!-- 分页查询 -->
|
|
<!-- 分页查询 -->
|
|
<select id="queryHomePage" resultMap="SysNewsInformation"
|
|
<select id="queryHomePage" resultMap="SysNewsInformation"
|
|
parameterType="map">
|
|
parameterType="map">
|
|
- SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_) where sni.del_flag_=0
|
|
|
|
|
|
+ SELECT sni.*
|
|
|
|
+ FROM sys_news_information sni
|
|
|
|
+ where sni.del_flag_=0
|
|
<if test="type != null">
|
|
<if test="type != null">
|
|
and sni.type_ = #{type}
|
|
and sni.type_ = #{type}
|
|
</if>
|
|
</if>
|
|
- <if test="subType != null">
|
|
|
|
|
|
+ <if test="subType != null and subType != ''">
|
|
and sni.sub_type_ = #{subType}
|
|
and sni.sub_type_ = #{subType}
|
|
</if>
|
|
</if>
|
|
<if test="status != null">
|
|
<if test="status != null">
|
|
@@ -212,16 +220,6 @@
|
|
<if test="subjectId != null">
|
|
<if test="subjectId != null">
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
</if>
|
|
</if>
|
|
- <if test="clientName != 'manage'">
|
|
|
|
- <choose>
|
|
|
|
- <when test="memo != null and memo != ''">
|
|
|
|
- and sni.memo_ = #{memo}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- and (sni.memo_ is null or sni.memo_ = '')
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </if>
|
|
|
|
group by sni.id_
|
|
group by sni.id_
|
|
order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
<include refid="global.limit" />
|
|
<include refid="global.limit" />
|
|
@@ -249,16 +247,6 @@
|
|
<if test="subjectId != null">
|
|
<if test="subjectId != null">
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
</if>
|
|
</if>
|
|
- <if test="clientName != 'manage'">
|
|
|
|
- <choose>
|
|
|
|
- <when test="memo != null and memo != ''">
|
|
|
|
- and sni.memo_ = #{memo}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- and (sni.memo_ is null or sni.memo_ = '')
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </if>
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="queryNeedUpdateStatusList" resultMap="SysNewsInformation" >
|
|
<select id="queryNeedUpdateStatusList" resultMap="SysNewsInformation" >
|
|
@@ -270,9 +258,13 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="queryById" resultMap="SysNewsInformationDto" >
|
|
<select id="queryById" resultMap="SysNewsInformationDto" >
|
|
- SELECT sni.*,sntp.name_ typeName,snts.name_ subTypeName FROM sys_news_information sni
|
|
|
|
- left join sys_news_type sntp on sni.type_ = sntp.id_
|
|
|
|
- left join sys_news_type snts on sni.sub_type_ = snts.id_
|
|
|
|
|
|
+ SELECT sni.*,su.username_ as updateName
|
|
|
|
+ FROM sys_news_information sni
|
|
|
|
+ left join sys_user su on sni.update_by_ = su.id_
|
|
where sni.id_ = #{id}
|
|
where sni.id_ = #{id}
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <update id="updateStatus">
|
|
|
|
+ UPDATE sys_news_information SET status_ = if(status_ = 0,1,0),update_time_ = NOW() WHERE id_ = #{id}
|
|
|
|
+ </update>
|
|
</mapper>
|
|
</mapper>
|