ICmsHistoryLogDao.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="net.mingsoft.cms.dao.ICmsHistoryLogDao">
  4. <resultMap id="resultMap" type="net.mingsoft.cms.entity.HistoryLogEntity">
  5. <id column="id" property="id" /><!--编号 -->
  6. <result column="content_id" property="contentId" /><!--文章编号 -->
  7. <result column="hl_ip" property="hlIp" /><!--浏览ip -->
  8. <result column="hl_people_id" property="hlPeopleId" /><!--用户id -->
  9. <result column="hl_is_mobile" property="hlIsMobile" /><!--是否为移动端 -->
  10. <result column="create_by" property="createBy" /><!--创建人 -->
  11. <result column="create_date" property="createDate" /><!--创建时间 -->
  12. <result column="update_by" property="updateBy" /><!--修改人 -->
  13. <result column="update_date" property="updateDate" /><!--修改时间 -->
  14. <result column="del" property="del" /><!--删除标记 -->
  15. </resultMap>
  16. <!--保存-->
  17. <insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
  18. parameterType="net.mingsoft.cms.entity.HistoryLogEntity" >
  19. insert into cms_history_log
  20. <trim prefix="(" suffix=")" suffixOverrides=",">
  21. <if test="contentId != null and contentId != ''">content_id,</if>
  22. <if test="hlIp != null and hlIp != ''">hl_ip,</if>
  23. <if test="hlPeopleId != null and hlPeopleId != ''">hl_people_id,</if>
  24. <if test="hlIsMobile != null">hl_is_mobile,</if>
  25. <if test="createBy &gt; 0">create_by,</if>
  26. <if test="createDate != null">create_date,</if>
  27. <if test="updateBy &gt; 0">update_by,</if>
  28. <if test="updateDate != null">update_date,</if>
  29. <if test="del != null">del,</if>
  30. </trim>
  31. <trim prefix="values (" suffix=")" suffixOverrides=",">
  32. <if test="contentId != null and contentId != ''">#{contentId},</if>
  33. <if test="hlIp != null and hlIp != ''">#{hlIp},</if>
  34. <if test="hlPeopleId != null and hlPeopleId != ''">#{hlPeopleId},</if>
  35. <if test="hlIsMobile != null">#{hlIsMobile},</if>
  36. <if test="createBy &gt; 0">#{createBy},</if>
  37. <if test="createDate != null">#{createDate},</if>
  38. <if test="updateBy &gt; 0">#{updateBy},</if>
  39. <if test="updateDate != null">#{updateDate},</if>
  40. <if test="del != null">#{del},</if>
  41. </trim>
  42. </insert>
  43. <!--更新-->
  44. <update id="updateEntity" parameterType="net.mingsoft.cms.entity.HistoryLogEntity">
  45. update cms_history_log
  46. <set>
  47. <if test="contentId != null and contentId != ''">content_id=#{contentId},</if>
  48. <if test="hlIp != null and hlIp != ''">hl_ip=#{hlIp},</if>
  49. <if test="hlPeopleId != null and hlPeopleId != ''">hl_people_id=#{hlPeopleId},</if>
  50. <if test="hlIsMobile != null">hl_is_mobile=#{hlIsMobile},</if>
  51. <if test="createBy &gt; 0">create_by=#{createBy},</if>
  52. <if test="createDate != null">create_date=#{createDate},</if>
  53. <if test="updateBy &gt; 0">update_by=#{updateBy},</if>
  54. <if test="updateDate != null">update_date=#{updateDate},</if>
  55. <if test="del != null">del=#{del},</if>
  56. </set>
  57. where id = #{id}
  58. </update>
  59. <!--根据id获取-->
  60. <select id="getEntity" resultMap="resultMap" parameterType="int">
  61. select * from cms_history_log where id=#{id}
  62. </select>
  63. <!--根据实体获取-->
  64. <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.HistoryLogEntity">
  65. select * from cms_history_log
  66. <where>
  67. <if test="contentId != null and contentId != ''">and content_id=#{contentId}</if>
  68. <if test="hlIp != null and hlIp != ''">and hl_ip=#{hlIp}</if>
  69. <if test="hlPeopleId != null and hlPeopleId != ''">and hl_people_id=#{hlPeopleId}</if>
  70. <if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
  71. <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
  72. <if test="createDate != null"> and create_date=#{createDate} </if>
  73. <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
  74. <if test="updateDate != null"> and update_date=#{updateDate} </if>
  75. <if test="del != null"> and del=#{del} </if>
  76. </where>
  77. limit 0,1
  78. </select>
  79. <!--删除-->
  80. <delete id="deleteEntity" parameterType="int">
  81. delete from cms_history_log where id=#{id}
  82. </delete>
  83. <!--批量删除-->
  84. <delete id="delete" >
  85. delete from cms_history_log
  86. <where>
  87. id in <foreach collection="ids" item="item" index="index"
  88. open="(" separator="," close=")">#{item}</foreach>
  89. </where>
  90. </delete>
  91. <!--查询全部-->
  92. <select id="queryAll" resultMap="resultMap">
  93. select * from cms_history_log order by id desc
  94. </select>
  95. <!--条件查询-->
  96. <select id="query" resultMap="resultMap">
  97. select * from cms_history_log
  98. <where>
  99. <if test="contentId != null and contentId != ''"> and content_id=#{contentId}</if>
  100. <if test="hlIp != null and hlIp != ''"> and hl_ip=#{hlIp}</if>
  101. <if test="hlPeopleId != null and hlPeopleId != ''"> and hl_people_id=#{hlPeopleId}</if>
  102. <if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
  103. <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
  104. <if test="createDate != null"> and create_date=#{createDate} </if>
  105. <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
  106. <if test="updateDate != null"> and update_date=#{updateDate} </if>
  107. <if test="del != null"> and del=#{del} </if>
  108. <include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
  109. </where>
  110. order by id desc
  111. </select>
  112. </mapper>