DoubleVerifyClickRecordMapper.xml 1.1 KB

123456789101112131415161718192021
  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.cyksj.mapper.DoubleVerifyClickRecordMapper">
  4. <select id="getDoubleVerifyCodeList" resultType="com.cyksj.model.views.DoubleVerifyCodeView">
  5. select *
  6. from (select user_id, account_id, relation_id, 1 as `type`, code, if(remain_time = 0,null,remain_time) as remain_time, created_time
  7. from double_verify_click_record
  8. where user_id = #{userId}
  9. and relation_id = #{relationId}
  10. union all
  11. select dr.user_id, dr.account_id, dr.relation_id, 2 as `type`, dcr.code, if(dcr.remain_time = 0,null,dcr.remain_time) as remain_time, dcr.created_time
  12. from double_verify_click_record dr
  13. inner join double_verify_click_refresh_record dcr
  14. on dcr.click_id = dr.id and dr.user_id = #{userId} and
  15. dr.relation_id = #{relationId}) s
  16. order by created_time desc
  17. </select>
  18. </mapper>