<?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.yoho.unions.dal.IUnionsActiveRecordDAO"> <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionsActiveRecord"> <id column="id" property="id" jdbcType="INTEGER" /> <result column="union_name" property="unionName" jdbcType="VARCHAR" /> <result column="app" property="app" jdbcType="VARCHAR" /> <result column="udid" property="udid" jdbcType="VARCHAR" /> <result column="callbackurl" property="callbackurl" jdbcType="VARCHAR" /> <result column="create_time" property="createTime" jdbcType="INTEGER" /> <result column="is_active" property="isActive" jdbcType="CHAR" /> <result column="update_time" property="updateTime" jdbcType="INTEGER" /> <result column="type" property="type" jdbcType="VARCHAR" /> </resultMap> <sql id="Base_Column_List"> id, union_name, app, udid, callbackurl, create_time, is_active, update_time, type </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer"> select <include refid="Base_Column_List" /> from unions_active_record where id = #{id,jdbcType=INTEGER} </select> <select id="selectByUdidAndApp" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionsActiveRecord"> select <include refid="Base_Column_List" /> from unions_active_record where udid=#{udid} and app=#{app} and create_time + 7776000 >= UNIX_TIMESTAMP() limit 1 </select> <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionsActiveRecord"> insert into unions_active_record (union_name, app,udid, callbackurl, create_time, update_time, type) values (#{unionName,jdbcType=VARCHAR},#{app,jdbcType=VARCHAR},#{udid,jdbcType=VARCHAR}, #{callbackurl,jdbcType=VARCHAR}, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), #{type}) </insert> <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionsActiveRecord"> update unions_active_record set is_active = #{isActive,jdbcType=CHAR}, update_time = UNIX_TIMESTAMP() where id = #{id,jdbcType=INTEGER} </update> </mapper>