Blame view

dal/src/main/resources/META-INF/mybatis/UnionsActiveRecordMapper.xml 2.13 KB
ping authored
1 2
<?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" >
ping authored
3 4
<mapper namespace="com.yoho.unions.dal.IUnionsActiveRecordDAO">
	<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionsActiveRecord">
ping authored
5 6 7 8 9 10 11 12
		<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" />
ping authored
13
		<result column="type" property="type" jdbcType="VARCHAR" />
ping authored
14 15 16
	</resultMap>
	<sql id="Base_Column_List">
		id, union_name, app, udid, callbackurl, create_time, is_active,
ping authored
17
		update_time, type 
ping authored
18 19 20 21 22
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
ping authored
23
		from unions_active_record
ping authored
24 25 26
		where id = #{id,jdbcType=INTEGER}
	</select>
	<select id="selectByUdidAndApp" resultMap="BaseResultMap"
ping authored
27
		parameterType="com.yoho.unions.dal.model.UnionsActiveRecord">
ping authored
28 29
		select
		<include refid="Base_Column_List" />
ping authored
30
		from unions_active_record
ping authored
31
		where udid=#{udid} and app=#{app} and create_time + 7776000 >= UNIX_TIMESTAMP() limit 1
ping authored
32
	</select>
ping authored
33 34
	<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)
ping authored
35
		values (#{unionName,jdbcType=VARCHAR},#{app,jdbcType=VARCHAR},#{udid,jdbcType=VARCHAR}, #{callbackurl,jdbcType=VARCHAR}, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), #{type})
ping authored
36
	</insert>
ping authored
37
	
ping authored
38 39
	<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionsActiveRecord">
		update unions_active_record
ping authored
40
		set is_active = #{isActive,jdbcType=CHAR}, update_time = UNIX_TIMESTAMP()
ping authored
41 42 43
		where id = #{id,jdbcType=INTEGER}
	</update>
</mapper>