|
@@ -6,7 +6,7 @@
|
|
|
-->
|
|
|
<mapper namespace="com.ym.mec.web.dal.dao.SysNewsInformationDao">
|
|
|
|
|
|
- <resultMap type="com.ym.mec.web.dal.entity.SysNewsInformation" id="SysNewsInformation">
|
|
|
+ <resultMap type="com.ym.mec.cms.dal.entity.SysNewsInformation" id="SysNewsInformation">
|
|
|
<result column="id_" property="id" />
|
|
|
<result column="title_" property="title" />
|
|
|
<result column="content_" property="content" />
|
|
@@ -17,6 +17,20 @@
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
</resultMap>
|
|
|
|
|
|
+ <sql id="queryCondition">
|
|
|
+ <where>
|
|
|
+ <if test="type != null">
|
|
|
+ and type_ = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status_ = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ and title_ like '%' #{title} '%'
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="SysNewsInformation" >
|
|
|
SELECT * FROM sys_news_information WHERE id_ = #{id}
|
|
@@ -28,7 +42,7 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
- <insert id="insert" parameterType="com.ym.mec.web.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
<!--
|
|
|
<selectKey resultClass="int" keyProperty="id" >
|
|
|
SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
@@ -38,33 +52,35 @@
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
- <update id="update" parameterType="com.ym.mec.web.dal.entity.SysNewsInformation">
|
|
|
- UPDATE sys_news_information <set>
|
|
|
-<if test="status != null">
|
|
|
-status_ = #{status},
|
|
|
-</if>
|
|
|
-<if test="id != null">
|
|
|
-id_ = #{id},
|
|
|
-</if>
|
|
|
-<if test="title != null">
|
|
|
-title_ = #{title},
|
|
|
-</if>
|
|
|
-<if test="updateTime != null">
|
|
|
-update_time_ = #{updateTime},
|
|
|
-</if>
|
|
|
-<if test="content != null">
|
|
|
-content_ = #{content},
|
|
|
-</if>
|
|
|
-<if test="coverImage != null">
|
|
|
-cover_image_ = #{coverImage},
|
|
|
-</if>
|
|
|
-<if test="type != null">
|
|
|
-type_ = #{type},
|
|
|
-</if>
|
|
|
-<if test="createTime != null">
|
|
|
-create_time_ = #{createTime},
|
|
|
-</if>
|
|
|
-</set> WHERE id_ = #{id}
|
|
|
+ <update id="update" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation">
|
|
|
+ UPDATE sys_news_information
|
|
|
+ <set>
|
|
|
+ <if test="status != null">
|
|
|
+ status_ = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ title_ = #{title},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="content != null">
|
|
|
+ content_ = #{content},
|
|
|
+ </if>
|
|
|
+ <if test="coverImage != null">
|
|
|
+ cover_image_ = #{coverImage},
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ type_ = #{type},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE id_ = #{id}
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
@@ -74,11 +90,23 @@ create_time_ = #{createTime},
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
|
|
|
- SELECT * FROM sys_news_information ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ SELECT * FROM sys_news_information ORDER BY id_
|
|
|
+ <include refid="queryCondition" />
|
|
|
+ <include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<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>
|
|
|
+ <if test="type != null">
|
|
|
+ and type_ = #{type}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
</mapper>
|