CallLogMapper.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.sayu.mapper.CallLogMapper">
  4. <resultMap id="BaseResultMap" type="com.sayu.entity.CallLog">
  5. <id column="id" property="id"/>
  6. <result column="caller_identity_id" property="callerIdentityId"/>
  7. <result column="callee_identity_id" property="calleeIdentityId"/>
  8. <result column="call_time" property="callTime"/>
  9. </resultMap>
  10. <sql id="Base_Column_List">
  11. id, caller_identity_id, callee_identity_id, call_time
  12. </sql>
  13. <insert id="insert" parameterType="com.sayu.entity.CallLog" useGeneratedKeys="true" keyProperty="id">
  14. INSERT INTO call_log (caller_identity_id, callee_identity_id, call_time)
  15. VALUES (#{callerIdentityId}, #{calleeIdentityId}, NOW())
  16. </insert>
  17. <select id="selectByCallerIdentityId" resultMap="BaseResultMap">
  18. SELECT <include refid="Base_Column_List"/>
  19. FROM call_log
  20. WHERE caller_identity_id = #{callerIdentityId}
  21. ORDER BY call_time DESC
  22. </select>
  23. <select id="selectByCalleeIdentityId" resultMap="BaseResultMap">
  24. SELECT <include refid="Base_Column_List"/>
  25. FROM call_log
  26. WHERE callee_identity_id = #{calleeIdentityId}
  27. ORDER BY call_time DESC
  28. </select>
  29. </mapper>