TraceHelmetNewestRecordMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhgd.scs.mapper.TraceHelmetNewestRecordMapper">
  6. <select id="getHelmetNewestList" resultType="com.zhgd.scs.domain.vo.TraceHelmetNewestRecordVo">
  7. SELECT thnr.*,
  8. lp.`name` personName,
  9. lp.en_name personEnName,
  10. lu.abbr_name unitName,
  11. lp.tel,
  12. lp.stc_no,
  13. lp.wrc_no,
  14. thd.color
  15. FROM trace_helmet_device thd
  16. LEFT JOIN trace_helmet_newest_record thnr ON thnr.device_code = thd.device_code
  17. LEFT JOIN labor_person lp ON thd.person_id = lp.id AND lp.deleted = 0
  18. LEFT JOIN labor_unit lu ON lp.unit_id = lu.id
  19. WHERE thd.in_out_state = 1
  20. AND thd.project_id = #{projectId}
  21. ORDER BY thnr.receipt_time DESC
  22. </select>
  23. <select id="getOnLineCount" resultType="java.lang.Integer">
  24. SELECT COUNT(*)
  25. FROM trace_helmet_device thd
  26. LEFT JOIN trace_helmet_newest_record thnr ON thnr.device_code = thd.device_code
  27. LEFT JOIN labor_person lp on thd.person_id = lp.id AND lp.deleted = 0
  28. WHERE thd.in_out_state = 1
  29. AND thd.project_id = #{projectId}
  30. AND thd.person_id IS NOT NULL
  31. AND thnr.device_state = 1
  32. AND lp.id IS NOT NULL
  33. </select>
  34. <select id="getHelmetList" resultType="com.zhgd.scs.domain.TraceHelmetNewestRecord">
  35. SELECT thnr.*
  36. FROM trace_helmet_device thd
  37. LEFT JOIN trace_helmet_newest_record thnr ON thnr.device_code = thd.device_code
  38. WHERE thd.project_id = #{projectId}
  39. ORDER BY thd.in_time DESC
  40. </select>
  41. </mapper>