TCmsAdMapper.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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="com.sooka.mybatis.mapper.TCmsAdMapper">
  4. <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TCmsAd">
  5. <!--
  6. WARNING - @mbg.generated
  7. -->
  8. <id column="id" jdbcType="INTEGER" property="id" />
  9. <result column="ad_name" jdbcType="VARCHAR" property="adName" />
  10. <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
  11. <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
  12. <result column="sort_id" jdbcType="INTEGER" property="sortId" />
  13. <result column="group_id" jdbcType="INTEGER" property="groupId" />
  14. <result column="ad_body" jdbcType="VARCHAR" property="adBody" />
  15. <result column="img" jdbcType="VARCHAR" property="img" />
  16. </resultMap>
  17. <resultMap id="VoResultMap" type="com.sooka.module.web.cms.vo.TCmsAdVo" extends="BaseResultMap">
  18. <id column="group_id" jdbcType="INTEGER" property="groupId" />
  19. <result column="group_name" jdbcType="VARCHAR" property="groupName" />
  20. </resultMap>
  21. <select id="findByIdForDate" parameterType="com.sooka.mybatis.model.TCmsAd" resultMap="BaseResultMap">
  22. select * from
  23. t_cms_ad
  24. where
  25. id= #{id}
  26. and group_id=#{groupId}
  27. and start_date &lt;= #{startDate} and end_date &gt; #{endDate} and ad_name= #{adName}
  28. </select>
  29. <select id="findListByGroup" parameterType="com.sooka.mybatis.model.TCmsAd" resultMap="BaseResultMap">
  30. select * from
  31. t_cms_ad
  32. where
  33. group_id=#{groupId}
  34. and start_date &lt;= #{startDate}
  35. and end_date &gt; #{endDate}
  36. <if test="sortId == 1">
  37. ORDER BY sort_id asc
  38. </if>
  39. <if test="sortId == 2">
  40. ORDER BY sort_id DESC
  41. </if>
  42. </select>
  43. </mapper>