|
@@ -27,36 +27,41 @@
|
|
|
<result column="tenant_id_" property="tenantId" />
|
|
|
<result column="attribute1_" property="attribute1" />
|
|
|
<result column="attribute2_" property="attribute2" />
|
|
|
+ <result column="subject_id_list_" property="subjectIdList" />
|
|
|
+ <result column="subject_name_" property="subjectName" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="queryCondition">
|
|
|
<where>
|
|
|
- del_flag_=0
|
|
|
+ sni.del_flag_=0
|
|
|
<if test="type != null">
|
|
|
- and type_ = #{type}
|
|
|
+ and sni.type_ = #{type}
|
|
|
</if>
|
|
|
<if test="subType != null">
|
|
|
- and sub_type_ = #{subType}
|
|
|
+ and sni.sub_type_ = #{subType}
|
|
|
</if>
|
|
|
<if test="tenantId != null">
|
|
|
- and tenant_id_ = #{tenantId}
|
|
|
+ and sni.tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
+ and sni.status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
</if>
|
|
|
<if test="title != null">
|
|
|
- and title_ like '%' #{title} '%'
|
|
|
+ and sni.title_ like '%' #{title} '%'
|
|
|
</if>
|
|
|
<if test="search != null">
|
|
|
- and title_ like '%' #{search} '%'
|
|
|
+ and sni.title_ like '%' #{search} '%'
|
|
|
+ </if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
|
</if>
|
|
|
<if test="clientName != 'manage'">
|
|
|
<choose>
|
|
|
<when test="memo != null and memo != ''">
|
|
|
- and memo_ = #{memo}
|
|
|
+ and sni.memo_ = #{memo}
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
- and (memo_ is null or memo_ = '')
|
|
|
+ and (sni.memo_ is null or sni.memo_ = '')
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -75,8 +80,8 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.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_,tenant_id_,attribute1_,attribute2_)
|
|
|
- VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2})
|
|
|
+ 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_,tenant_id_,attribute1_,attribute2_,subject_id_list_)
|
|
|
+ VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2},#{subjectIdList})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -137,6 +142,9 @@
|
|
|
<if test="attribute2 != null">
|
|
|
attribute2_ = #{attribute2},
|
|
|
</if>
|
|
|
+ <if test="subjectIdList != null">
|
|
|
+ subject_id_list_ = #{subjectIdList},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
WHERE id_ = #{id}
|
|
|
</update>
|
|
@@ -148,15 +156,16 @@
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
|
|
|
- SELECT * FROM sys_news_information
|
|
|
+ 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_)
|
|
|
<include refid="queryCondition" />
|
|
|
- order by status_ desc,order_ desc,update_time_ desc
|
|
|
+ group by sni.id_
|
|
|
+ order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
|
<include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM sys_news_information
|
|
|
+ SELECT COUNT(sni.id_) FROM sys_news_information sni
|
|
|
<include refid="queryCondition" />
|
|
|
</select>
|
|
|
|
|
@@ -177,69 +186,75 @@
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryHomePage" resultMap="SysNewsInformation"
|
|
|
parameterType="map">
|
|
|
- SELECT * FROM sys_news_information where del_flag_=0
|
|
|
+ SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni where sni.del_flag_=0
|
|
|
<if test="type != null">
|
|
|
- and type_ = #{type}
|
|
|
+ and sni.type_ = #{type}
|
|
|
</if>
|
|
|
<if test="subType != null">
|
|
|
- and sub_type_ = #{subType}
|
|
|
+ and sni.sub_type_ = #{subType}
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and status_ = #{status,
|
|
|
+ and sni.status_ = #{status,
|
|
|
typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
</if>
|
|
|
<if test="title != null">
|
|
|
- and title_ like '%' #{title} '%'
|
|
|
+ and sni.title_ like '%' #{title} '%'
|
|
|
</if>
|
|
|
<if test="search != null">
|
|
|
- and title_ like '%' #{search} '%'
|
|
|
+ and sni.title_ like '%' #{search} '%'
|
|
|
</if>
|
|
|
<if test="tenantId != null">
|
|
|
- and tenant_id_ = #{tenantId}
|
|
|
+ and sni.tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
|
+ </if>
|
|
|
<if test="clientName != 'manage'">
|
|
|
<choose>
|
|
|
<when test="memo != null and memo != ''">
|
|
|
- and memo_ = #{memo}
|
|
|
+ and sni.memo_ = #{memo}
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
- and (memo_ is null or memo_ = '')
|
|
|
+ and (sni.memo_ is null or sni.memo_ = '')
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
- order by status_ desc,order_ desc,update_time_ desc
|
|
|
+ order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
|
|
|
<include refid="global.limit" />
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryHomeCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM sys_news_information where del_flag_=0
|
|
|
+ SELECT COUNT(sni.id_) FROM sys_news_information sni where sni.del_flag_=0
|
|
|
<if test="type != null">
|
|
|
- and type_ = #{type}
|
|
|
+ and sni.type_ = #{type}
|
|
|
</if>
|
|
|
<if test="subType != null">
|
|
|
- and sub_type_ = #{subType}
|
|
|
+ and sni.sub_type_ = #{subType}
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and status_ = #{status,
|
|
|
+ and sni.status_ = #{status,
|
|
|
typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
</if>
|
|
|
<if test="title != null">
|
|
|
- and title_ like '%' #{title} '%'
|
|
|
+ and sni.title_ like '%' #{title} '%'
|
|
|
</if>
|
|
|
<if test="search != null">
|
|
|
- and title_ like '%' #{search} '%'
|
|
|
+ and sni.title_ like '%' #{search} '%'
|
|
|
</if>
|
|
|
<if test="tenantId != null">
|
|
|
- and tenant_id_ = #{tenantId}
|
|
|
+ and sni.tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ and find_in_set(#{subjectId},sni.subject_id_list_)
|
|
|
+ </if>
|
|
|
<if test="clientName != 'manage'">
|
|
|
<choose>
|
|
|
<when test="memo != null and memo != ''">
|
|
|
- and memo_ = #{memo}
|
|
|
+ and sni.memo_ = #{memo}
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
- and (memo_ is null or memo_ = '')
|
|
|
+ and (sni.memo_ is null or sni.memo_ = '')
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</if>
|