CameraMapper.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.fdkankan.agent.mapper.ICameraMapper">
  4. <select id="pageList" resultType="com.fdkankan.agent.response.CameraDetailVo">
  5. select c.id ,c.sn_code,c.activated_time ,d.create_time as outTime ,d.type,d.own as outType ,u.user_name, c.wifi_name,
  6. d.order_sn,ui.is_expired as incrementStatus,ui.increment_type_id ,ui.increment_end_time
  7. from t_camera c
  8. left join t_camera_detail d on c.id = d.camera_id
  9. left join t_user u on d.user_id = u.id and u.rec_status = 'A'
  10. left join t_user_increment ui on d.camera_id = ui.camera_id and ui.rec_status = 'A'
  11. where c.rec_status = 'A'
  12. <if test="param.userId !=null ">
  13. and d.user_id = #{param.userId}
  14. </if>
  15. <if test="param.type !=null ">
  16. and d.type = #{param.type}
  17. </if>
  18. <if test="param.snCode !=null and param.snCode != '' ">
  19. and c.sn_code like concat ('%',#{param.snCode},'%')
  20. </if>
  21. <if test="param.userName !=null and param.userName != '' ">
  22. and u.user_name like concat('%',#{param.userName},'%')
  23. </if>
  24. <if test="param.bindStatus !=null and param.bindStatus == 0">
  25. and d.user_id is null
  26. </if>
  27. <if test="param.bindStatus !=null and param.bindStatus == 1">
  28. and d.user_id is not null
  29. </if>
  30. <if test="param.incrementStatus !=null ">
  31. and ui.is_expired = #{param.incrementStatus}
  32. </if>
  33. <if test="param.incrementTypeId !=null ">
  34. and ui.increment_type_id = #{param.incrementTypeId}
  35. </if>
  36. <if test="param.cameraIds != null and param.cameraIds.size >0">
  37. and d.camera_id in
  38. <foreach collection="param.cameraIds" item="cameraIds" open="(" separator="," close=")">
  39. #{cameraIds}
  40. </foreach>
  41. </if>
  42. order by d.out_time desc,d.id desc
  43. </select>
  44. <select id="getBySnCodeAndAgentId" resultType="com.fdkankan.agent.entity.Camera">
  45. select c.* from t_camera c left join t_camera_detail d on c.id = d.camera_id
  46. where c.sn_code = #{snCode} and d.agent_id = #{agentId}
  47. </select>
  48. </mapper>