|
@@ -21,6 +21,7 @@
|
|
|
|
|
|
<sql id="queryCondition">
|
|
|
<where>
|
|
|
+ del_flag_=0
|
|
|
<if test="type != null">
|
|
|
and type_ = #{type}
|
|
|
</if>
|
|
@@ -38,18 +39,18 @@
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="SysNewsInformation" >
|
|
|
- SELECT * FROM sys_news_information WHERE id_ = #{id}
|
|
|
+ SELECT * FROM sys_news_information WHERE id_ = #{id} WHERE del_flag_=0
|
|
|
</select>
|
|
|
|
|
|
<!-- 全查询 -->
|
|
|
<select id="findAll" resultMap="SysNewsInformation">
|
|
|
- SELECT * FROM sys_news_information ORDER BY id_
|
|
|
+ SELECT * FROM sys_news_information WHERE del_flag_=0 ORDER BY id_
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<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_,type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_)
|
|
|
- VALUES(#{id},#{title},#{content},#{coverImage},#{type},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},#{delFlag})
|
|
|
+ VALUES(#{id},#{title},#{content},#{coverImage},#{type},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0)
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -105,13 +106,14 @@
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM sys_news_information
|
|
|
+ SELECT COUNT(*) FROM sys_news_information
|
|
|
<include refid="queryCondition" />
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByType" resultMap="SysNewsInformation" parameterType="java.lang.Integer">
|
|
|
SELECT * FROM sys_news_information
|
|
|
<where>
|
|
|
+ del_flag_=0
|
|
|
<if test="type != null">
|
|
|
and type_ = #{type}
|
|
|
</if>
|
|
@@ -119,6 +121,6 @@
|
|
|
</select>
|
|
|
|
|
|
<update id="deleteWithLogical">
|
|
|
- UPDATE sys_news_information del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
|
|
|
+ UPDATE sys_news_information SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
|
|
|
</update>
|
|
|
</mapper>
|