| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?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="net.mingsoft.cms.dao.IContentDao">
- <resultMap id="resultMap" type="net.mingsoft.cms.entity.ContentEntity">
- <id column="id" property="id" /><!--编号 -->
- <result column="content_title" property="contentTitle" /><!--文章标题 -->
- <result column="content_category_id" property="contentCategoryId" /><!--所属栏目 -->
- <result column="content_type" property="contentType" /><!--文章类型 -->
- <result column="content_display" property="contentDisplay" /><!--是否显示 -->
- <result column="content_author" property="contentAuthor" /><!--文章作者 -->
- <result column="content_source" property="contentSource" /><!--文章来源 -->
- <result column="content_datetime" property="contentDatetime" /><!--发布时间 -->
- <result column="content_sort" property="contentSort" /><!--自定义顺序 -->
- <result column="content_img" property="contentImg" /><!--文章缩略图 -->
- <result column="content_description" property="contentDescription" /><!--描述 -->
- <result column="content_keyword" property="contentKeyword" /><!--关键字 -->
- <result column="content_details" property="contentDetails" /><!--文章内容 -->
- <result column="content_url" property="contentUrl" /><!--文章跳转链接地址 -->
- <result column="content_hit" property="contentHit" /><!--点击次数 -->
- <result column="app_id" property="appId" /><!--文章管理的应用id -->
- <result column="create_by" property="createBy" /><!--创建人 -->
- <result column="create_date" property="createDate" /><!--创建时间 -->
- <result column="update_by" property="updateBy" /><!--修改人 -->
- <result column="update_date" property="updateDate" /><!--修改时间 -->
- <result column="del" property="del" /><!--删除标记 -->
- </resultMap>
- <!--保存-->
- <insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
- parameterType="net.mingsoft.cms.entity.ContentEntity" >
- insert into cms_content
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="contentTitle != null and contentTitle != ''">content_title,</if>
- <if test="contentCategoryId != null and contentCategoryId != ''">content_category_id,</if>
- <if test="contentType != null and contentType != ''">content_type,</if>
- <if test="contentDisplay != null and contentDisplay != ''">content_display,</if>
- <if test="contentAuthor != null and contentAuthor != ''">content_author,</if>
- <if test="contentSource != null and contentSource != ''">content_source,</if>
- <if test="contentDatetime != null">content_datetime,</if>
- <if test="contentSort != null">content_sort,</if>
- <if test="contentImg != null and contentImg != ''">content_img,</if>
- <if test="contentDescription != null and contentDescription != ''">content_description,</if>
- <if test="contentKeyword != null and contentKeyword != ''">content_keyword,</if>
- <if test="contentDetails != null and contentDetails != ''">content_details,</if>
- <if test="contentUrl != null and contentUrl != ''">content_url,</if>
- <if test="contentHit != null">content_hit,</if>
- <if test="appId != null">app_id,</if>
- <if test="createBy > 0">create_by,</if>
- <if test="createDate != null">create_date,</if>
- <if test="updateBy > 0">update_by,</if>
- <if test="updateDate != null">update_date,</if>
- <if test="del != null">del,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
- <if test="contentCategoryId != null and contentCategoryId != ''">#{contentCategoryId},</if>
- <if test="contentType != null and contentType != ''">#{contentType},</if>
- <if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if>
- <if test="contentAuthor != null and contentAuthor != ''">#{contentAuthor},</if>
- <if test="contentSource != null and contentSource != ''">#{contentSource},</if>
- <if test="contentDatetime != null">#{contentDatetime},</if>
- <if test="contentSort != null">#{contentSort},</if>
- <if test="contentImg != null and contentImg != ''">#{contentImg},</if>
- <if test="contentDescription != null and contentDescription != ''">#{contentDescription},</if>
- <if test="contentKeyword != null and contentKeyword != ''">#{contentKeyword},</if>
- <if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
- <if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
- <if test="contentHit != null">#{contentHit},</if>
- <if test="appId != null">#{appId},</if>
- <if test="createBy > 0">#{createBy},</if>
- <if test="createDate != null">#{createDate},</if>
- <if test="updateBy > 0">#{updateBy},</if>
- <if test="updateDate != null">#{updateDate},</if>
- <if test="del != null">#{del},</if>
- </trim>
- </insert>
- <!--更新-->
- <update id="updateEntity" parameterType="net.mingsoft.cms.entity.ContentEntity">
- update cms_content
- <set>
- <if test="contentTitle != null and contentTitle != ''">content_title=#{contentTitle},</if>
- <if test="contentCategoryId != null and contentCategoryId != ''">content_category_id=#{contentCategoryId},</if>
- <if test="contentType != null and contentType != ''">content_type=#{contentType},</if>
- <if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if>
- <if test="contentAuthor != null and contentAuthor != ''">content_author=#{contentAuthor},</if>
- <if test="contentSource != null and contentSource != ''">content_source=#{contentSource},</if>
- <if test="contentDatetime != null">content_datetime=#{contentDatetime},</if>
- <if test="contentSort != null">content_sort=#{contentSort},</if>
- <if test="contentImg != null and contentImg != ''">content_img=#{contentImg},</if>
- <if test="contentDescription != null and contentDescription != ''">content_description=#{contentDescription},</if>
- <if test="contentKeyword != null and contentKeyword != ''">content_keyword=#{contentKeyword},</if>
- <if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if>
- <if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if>
- <if test="contentHit != null">content_hit=#{contentHit},</if>
- <if test="appId != null">app_id=#{appId},</if>
- <if test="createBy > 0">create_by=#{createBy},</if>
- <if test="createDate != null">create_date=#{createDate},</if>
- <if test="updateBy > 0">update_by=#{updateBy},</if>
- <if test="updateDate != null">update_date=#{updateDate},</if>
- <if test="del != null">del=#{del},</if>
- </set>
- where id = #{id}
- </update>
- <!--根据id获取-->
- <select id="getEntity" resultMap="resultMap" parameterType="int">
- select * from cms_content where id=#{id}
- </select>
- <!--根据实体获取-->
- <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.ContentEntity">
- select * from cms_content
- <where>
- <if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT('%',#{contentTitle},'%')</if>
- <if test="contentCategoryId != null and contentCategoryId != ''">and content_category_id=#{contentCategoryId}</if>
- <if test="contentType != null and contentType != ''">and content_type=#{contentType}</if>
- <if test="contentDisplay != null and contentDisplay != ''">and content_display=#{contentDisplay}</if>
- <if test="contentAuthor != null and contentAuthor != ''">and content_author=#{contentAuthor}</if>
- <if test="contentSource != null and contentSource != ''">and content_source=#{contentSource}</if>
- <if test="contentDatetime != null"> and content_datetime=#{contentDatetime} </if>
- <if test="contentSort != null"> and content_sort=#{contentSort} </if>
- <if test="contentImg != null and contentImg != ''">and content_img=#{contentImg}</if>
- <if test="contentDescription != null and contentDescription != ''">and content_description=#{contentDescription}</if>
- <if test="contentKeyword != null and contentKeyword != ''">and content_keyword=#{contentKeyword}</if>
- <if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if>
- <if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if>
- <if test="contentHit != null">and content_hit=#{contentHit}</if>
- <if test="appId != null"> and app_id=#{appId} </if>
- <if test="createBy > 0"> and create_by=#{createBy} </if>
- <if test="createDate != null"> and create_date=#{createDate} </if>
- <if test="updateBy > 0"> and update_by=#{updateBy} </if>
- <if test="updateDate != null"> and update_date=#{updateDate} </if>
- <if test="del != null"> and del=#{del} </if>
- </where>
- limit 0,1
- </select>
- <!--删除-->
- <delete id="deleteEntity" parameterType="int">
- delete from cms_content where id=#{id}
- </delete>
- <!--批量删除-->
- <delete id="delete" >
- delete from cms_content
- <where>
- id in <foreach collection="ids" item="item" index="index"
- open="(" separator="," close=")">#{item}</foreach>
- </where>
- </delete>
- <!--查询全部-->
- <select id="queryAll" resultMap="resultMap">
- select * from cms_content order by id desc
- </select>
- <!--条件查询-->
- <select id="query" resultMap="resultMap">
- select * from cms_content
- <where>
- <if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT('%',#{contentTitle},'%')</if>
- <if test="contentCategoryId != null and contentCategoryId != ''"> and content_category_id=#{contentCategoryId}</if>
- <if test="contentType != null and contentType != ''"> and content_type LIKE CONCAT('%',#{contentType},'%')</if>
- <if test="contentDisplay != null and contentDisplay != ''"> and content_display=#{contentDisplay}</if>
- <if test="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if>
- <if test="contentSource != null and contentSource != ''"> and content_source=#{contentSource}</if>
- <if test="contentDatetime != null"> and content_datetime=#{contentDatetime} </if>
- <if test="contentSort != null"> and content_sort=#{contentSort} </if>
- <if test="contentImg != null and contentImg != ''"> and content_img=#{contentImg}</if>
- <if test="contentDescription != null and contentDescription != ''"> and content_description=#{contentDescription}</if>
- <if test="contentKeyword != null and contentKeyword != ''"> and content_keyword=#{contentKeyword}</if>
- <if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if>
- <if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if>
- <if test="contentHit != null"> and content_hit=#{contentHit}</if>
- <if test="appId != null"> and app_id=#{appId} </if>
- <if test="createBy > 0"> and create_by=#{createBy} </if>
- <if test="createDate != null"> and create_date=#{createDate} </if>
- <if test="updateBy > 0"> and update_by=#{updateBy} </if>
- <if test="updateDate != null"> and update_date=#{updateDate} </if>
- <if test="del != null"> and del=#{del} </if>
- <include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
- </where>
- order by id desc
- </select>
- </mapper>
|