SMSLogsMapper.xml 2.56 KB
<?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.monitor.mysql.mapper.SMSLogsMapper" >
  <resultMap id="BaseResultMap" type="com.model.SMSLogs" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="template_id" property="templateId" jdbcType="INTEGER" />
    <result column="template_name" property="templateName" jdbcType="VARCHAR" />
    <result column="ip" property="ip" jdbcType="VARCHAR" />
    <result column="area" property="area" jdbcType="VARCHAR" />
    <result column="mobile" property="mobile" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="manage_status" property="manageStatus" jdbcType="INTEGER" />
    <result column="first_service" property="firstService" jdbcType="INTEGER" />
    <result column="first_service_reuslt" property="firstServiceReuslt" jdbcType="VARCHAR" />
    <result column="first_service_status" property="firstServiceStatus" jdbcType="INTEGER" />
    <result column="second_service" property="secondService" jdbcType="INTEGER" />
    <result column="second_service_result" property="secondServiceResult" jdbcType="VARCHAR" />
    <result column="second_service_status" property="secondServiceStatus" jdbcType="INTEGER" />
    <result column="ext1" property="ext1" jdbcType="VARCHAR" />
    <result column="ext2" property="ext2" jdbcType="VARCHAR" />
    <result column="ext3" property="ext3" jdbcType="VARCHAR" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.model.SMSLogs" extends="BaseResultMap" >
    <result column="content" property="content" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, template_id, template_name, ip, area, mobile, create_time, update_time, manage_status,
    first_service, first_service_reuslt, first_service_status, second_service, second_service_result,
    second_service_status, ext1, ext2, ext3
  </sql>
  <sql id="Blob_Column_List" >
    content
  </sql>
  <select id="selectByMobile" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from sms_logs
    where mobile = #{params.mobile}
    order by create_time desc limit 10
  </select>

  <select id="selectCountByMobile" resultType="java.lang.Integer">
        select
        count(1)
        from sms_logs where mobile = #{params.mobile}
  </select>

</mapper>