SecretPhoneMapper.xml 5.0 KB
Newer Older
苗卫卫 committed
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
<?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.boco.nbd.wios.flow.mapper.def.SecretPhoneMapper">

<resultMap id="BaseResultMap" type="com.boco.nbd.wios.flow.entity.SecretPhone">
  <id column="phone" jdbcType="VARCHAR" property="phone" />
  <result column="secret_no" jdbcType="VARCHAR" property="secretNo" />
  <result column="pool_key" jdbcType="VARCHAR" property="poolKey" />
  <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  <result column="subs_id" jdbcType="VARCHAR" property="subsId" />
  <result column="status" jdbcType="INTEGER" property="status" />
  <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>


<sql id="Base_Column_List">
  phone, secret_no, pool_key, expired_time, subs_id, status, update_time, create_time
</sql>


<delete id="delete" parameterType="java.lang.String">
  delete from t_secret_phone
  where phone = #{phone,jdbcType=VARCHAR}
</delete>


<insert id="insert" parameterType="com.boco.nbd.wios.flow.entity.SecretPhone">
  insert into t_secret_phone (phone, secret_no, pool_key,
    expired_time, subs_id, status,
    update_time, create_time)
  values (#{phone,jdbcType=VARCHAR}, #{secretNo,jdbcType=VARCHAR}, #{poolKey,jdbcType=VARCHAR},
    #{expiredTime,jdbcType=TIMESTAMP}, #{subsId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
    #{updateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP})
</insert>


<insert id="insertDynamic" parameterType="com.boco.nbd.wios.flow.entity.SecretPhone">
  insert into t_secret_phone
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="phone != null">
      phone,
    </if>
    <if test="secretNo != null">
      secret_no,
    </if>
    <if test="poolKey != null">
      pool_key,
    </if>
    <if test="expiredTime != null">
      expired_time,
    </if>
    <if test="subsId != null">
      subs_id,
    </if>
    <if test="status != null">
      status,
    </if>
    <if test="updateTime != null">
      update_time,
    </if>
    <if test="createTime != null">
      create_time,
    </if>
  </trim>
  <trim prefix="values (" suffix=")" suffixOverrides=",">
    <if test="phone != null">
      #{phone,jdbcType=VARCHAR},
    </if>
    <if test="secretNo != null">
      #{secretNo,jdbcType=VARCHAR},
    </if>
    <if test="poolKey != null">
      #{poolKey,jdbcType=VARCHAR},
    </if>
    <if test="expiredTime != null">
      #{expiredTime,jdbcType=TIMESTAMP},
    </if>
    <if test="subsId != null">
      #{subsId,jdbcType=VARCHAR},
    </if>
    <if test="status != null">
      #{status,jdbcType=INTEGER},
    </if>
    <if test="updateTime != null">
      #{updateTime,jdbcType=TIMESTAMP},
    </if>
    <if test="createTime != null">
      #{createTime,jdbcType=TIMESTAMP},
    </if>
  </trim>
</insert>


<update id="updateDynamic" parameterType="com.boco.nbd.wios.flow.entity.SecretPhone">
  update t_secret_phone
  <set>
    <if test="secretNo != null">
      secret_no = #{secretNo,jdbcType=VARCHAR},
    </if>
    <if test="poolKey != null">
      pool_key = #{poolKey,jdbcType=VARCHAR},
    </if>
    <if test="expiredTime != null">
      expired_time = #{expiredTime,jdbcType=TIMESTAMP},
    </if>
    <if test="subsId != null">
      subs_id = #{subsId,jdbcType=VARCHAR},
    </if>
    <if test="status != null">
      status = #{status,jdbcType=INTEGER},
    </if>
    <if test="updateTime != null">
      update_time = #{updateTime,jdbcType=TIMESTAMP},
    </if>
    <if test="createTime != null">
      create_time = #{createTime,jdbcType=TIMESTAMP},
    </if>
  </set>
  where phone = #{phone,jdbcType=VARCHAR}
</update>


<update id="update" parameterType="com.boco.nbd.wios.flow.entity.SecretPhone">
  update t_secret_phone
  set secret_no = #{secretNo,jdbcType=VARCHAR},
    pool_key = #{poolKey,jdbcType=VARCHAR},
    expired_time = #{expiredTime,jdbcType=TIMESTAMP},
    subs_id = #{subsId,jdbcType=VARCHAR},
    status = #{status,jdbcType=INTEGER},
    update_time = #{updateTime,jdbcType=TIMESTAMP},
    create_time = #{createTime,jdbcType=TIMESTAMP}
  where phone = #{phone,jdbcType=VARCHAR}
</update>


<select id="selectByPhone" parameterType="java.lang.String" resultMap="BaseResultMap">
  select
	<include refid="Base_Column_List" />
  from  t_secret_phone
  where phone = #{phone,jdbcType=VARCHAR} and status=1
</select>

<select id="selectByExample" parameterType="com.boco.nbd.wios.flow.entity.SecretPhone"
        resultType="com.boco.nbd.wios.flow.entity.SecretPhone">
   select t.* from t_secret_phone t
   <where>
	    <if test="secretNo != null and secretNo !=''">
	        and t.secret_no = #{secretNo}
	    </if>
	    <if test="status != null">
	        and t.status = #{status}
	    </if>
   </where>
   order by t.create_time desc
</select>

<select id="selectExpired"
        resultType="com.boco.nbd.wios.flow.entity.SecretPhone">
   select t.* from t_secret_phone t
   where t.expired_time &lt;= now() and t.status=1
</select>
  
</mapper>