1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?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="com.sooka.mybatis.mapper.TCmsAdMapper">
- <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TCmsAd">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="ad_name" jdbcType="VARCHAR" property="adName" />
- <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
- <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
- <result column="sort_id" jdbcType="INTEGER" property="sortId" />
- <result column="group_id" jdbcType="INTEGER" property="groupId" />
- <result column="ad_body" jdbcType="VARCHAR" property="adBody" />
- <result column="img" jdbcType="VARCHAR" property="img" />
- </resultMap>
- <resultMap id="VoResultMap" type="com.sooka.module.web.cms.vo.TCmsAdVo" extends="BaseResultMap">
- <id column="group_id" jdbcType="INTEGER" property="groupId" />
- <result column="group_name" jdbcType="VARCHAR" property="groupName" />
- </resultMap>
- <select id="findByIdForDate" parameterType="com.sooka.mybatis.model.TCmsAd" resultMap="BaseResultMap">
- select * from
- t_cms_ad
- where
- id= #{id}
- and group_id=#{groupId}
- and start_date <= #{startDate} and end_date > #{endDate} and ad_name= #{adName}
- </select>
- <select id="findListByGroup" parameterType="com.sooka.mybatis.model.TCmsAd" resultMap="BaseResultMap">
- select * from
- t_cms_ad
- where
- group_id=#{groupId}
- and start_date <= #{startDate}
- and end_date > #{endDate}
- <if test="sortId == 1">
- ORDER BY sort_id asc
- </if>
- <if test="sortId == 2">
- ORDER BY sort_id DESC
- </if>
- </select>
- </mapper>
|