ActivationDataMapper.xml
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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="cn.com.glsx.openplatform.mapper.ActivationDataMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.openplatform.model.ActivationData">
<!--@mbg.generated-->
<!--@Table t_activation_data-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="month" jdbcType="VARCHAR" property="month"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="customer" jdbcType="VARCHAR" property="customer"/>
<result column="num" jdbcType="INTEGER" property="num"/>
<result column="type" jdbcType="TINYINT" property="type"/>
</resultMap>
<select id="getActivationList" resultType="cn.com.glsx.openplatform.model.ActivationData">
select id, month, customer_id customerId, customer, num, type
from t_activation_data
order by month;
</select>
<update id="updateDeviceActivation">
update t_platform_device
set customer_id = #{data.customerId,jdbcType=INTEGER},
activat_time = from_unixtime(
unix_timestamp(#{data.month,jdbcType=VARCHAR}) + floor(
rand() * (
unix_timestamp(#{data.endMonth,jdbcType=VARCHAR})
- unix_timestamp(#{data.month,jdbcType=VARCHAR}) + 1
)
)
)
where customer_id is null
and create_time > #{startTimeStr,jdbcType=VARCHAR}
and create_time <= #{endTimeStr,jdbcType=VARCHAR}
and device_type = #{data.typeName,jdbcType=VARCHAR}
order by rand()
limit #{num,jdbcType=INTEGER}
</update>
<select id="getShipmentList" resultType="cn.com.glsx.openplatform.model.ShipmentData">
select id, goods_time goodsTime, goods_num goodsNum, type
from t_shipment_data
</select>
</mapper>