TmsStudentInfoMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.miaxis.tms.mapper.TmsStudentInfoMapper">
  4. <resultMap id="TmsStudentInfoResultMap" type="com.miaxis.tms.vo.TmsStudentInfoVo">
  5. <id property="id" column="TSO_ID" />
  6. <result property="idcard" column="TSO_IDCARD" />
  7. <result property="name" column="TSO_NAME" />
  8. <result property="phone" column="TSO_PHONE" />
  9. <result property="applydate" column="TSO_APPLYDATE" />
  10. <result property="state" column="TSO_STATE" />
  11. <result property="trainType" column="TSO_TRAINTYPE" />
  12. <result property="photoPath" column="TSO_PHOTO_PATH" />
  13. <result property="remark" column="TSO_REMARK" />
  14. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  15. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  16. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  17. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  18. <result property="trainThreeExamStatus" column="SRI_TRAIN_THREE_EXAM_STATUS" />
  19. <result property="trainThreeExamTime" column="SRI_TRAIN_THREE_EXAM_TIME" />
  20. <result property="trainFourExamStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  21. <result property="trainFourExamTime" column="SRI_TRAIN_FOUR_EXAM_TIME" />
  22. </resultMap>
  23. <resultMap id="TmsStudentInfoIdResultMap" type="com.miaxis.tms.vo.TmsStudentInfoIdVo">
  24. <id property="id" column="TSO_ID" />
  25. <result property="cardType" column="TSO_CARDTYPE" />
  26. <result property="idcard" column="TSO_IDCARD" />
  27. <result property="name" column="TSO_NAME" />
  28. <result property="sex" column="TSO_SEX" />
  29. <result property="phone" column="TSO_PHONE" />
  30. <result property="source" column="TSO_SOURCE" />
  31. <result property="nationality" column="TSO_NATIONALITY" />
  32. <result property="trainType" column="TSO_TRAINTYPE" />
  33. <result property="active" column="TSO_ACTIVE" />
  34. <result property="recordDate" column="TSO_RECORD_DATE" />
  35. <result property="address" column="TSO_ADDRESS" />
  36. <result property="photoPath" column="TSO_PHOTO_PATH" />
  37. <result property="face" column="FACE" />
  38. <result property="schoolId" column="TSI_ID" />
  39. <result property="schoolName" column="TSI_NAME" />
  40. <result property="schoolShortName" column="TSI_SHORTNAME" />
  41. <result property="schoolAddress" column="TSI_ADDRESS" />
  42. <result property="schollInscode" column="TSI_INSCODE" />
  43. <result property="qxbh" column="TSI_QXBH" />
  44. <result property="qxmc" column="TSI_QXMC" />
  45. <result property="dqbh" column="TSI_DQBH" />
  46. <result property="dqmc" column="TSI_DQMC" />
  47. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  48. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  49. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  50. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  51. <result property="k1" column="K1" />
  52. <result property="k2" column="K2" />
  53. <result property="k3" column="K3" />
  54. <result property="k4" column="K4" />
  55. <result property="totalKm1" column="TOTAL_KM1" />
  56. <result property="totalKm2" column="TOTAL_KM2" />
  57. <result property="totalKm3" column="TOTAL_KM3" />
  58. <result property="totalKm4" column="TOTAL_KM4" />
  59. <result property="k2Mileage" column="K2MILEAGE" />
  60. <result property="mileage" column="MILEAGE" />
  61. <result property="k3Mileage" column="K3MILEAGE" />
  62. </resultMap>
  63. <select id="getTmsStudentInfoList" parameterType="com.miaxis.tms.dto.TmsStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  64. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  65. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  66. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time
  67. from tms_student_info@tms${city} t1
  68. left join tms_student_train_info@tms${city} t2
  69. on t1.tso_id = t2.sri_student_id
  70. <where>
  71. AND t1.TSO_HISTORY = '0'
  72. AND t1.TSO_BUSITYPE in ('0', '1')
  73. AND t1.TSO_LOGOUT = 0
  74. <if test="coachId!=null" > AND t1.TSO_COACHID = #{coachId } </if>
  75. <if test="field != null and field != ''"> AND (t1.Tso_Name like '%' || #{field,jdbcType=VARCHAR} || '%' or t1.TSO_IDCARD like '%' || #{field,jdbcType=VARCHAR} || '%' or t1.Tso_Phone like '%' || #{field,jdbcType=VARCHAR} || '%') </if>
  76. <if test="schoolId != null "> and t1.TSO_SCHOOL_ID = #{schoolId} </if>
  77. <if test="state != null and state != ''"> AND t1.TSO_STATE = #{state}</if>
  78. </where>
  79. ORDER BY t1.TSO_ID desc, NLSSORT(t1.TSO_NAME, 'NLS_SORT=SCHINESE_PINYIN_M')
  80. </select>
  81. <select id="getTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  82. SELECT t.tso_cardtype,
  83. t.tso_Idcard,
  84. t.tso_name,
  85. t.tso_sex,
  86. t.tso_phone,
  87. t.tso_source,
  88. t.TSO_NATIONALITY,
  89. t.tso_traintype,
  90. t.tso_active,
  91. t.tso_record_date,
  92. t.tso_address,
  93. t.tso_photo_path,
  94. fi.face,
  95. S.TSI_ID,
  96. S.TSI_NAME,
  97. S.TSI_SHORTNAME,
  98. S.TSI_ADDRESS,
  99. S.TSI_INSCODE,
  100. S.TSI_QXBH,
  101. S.TSI_QXMC,
  102. S.TSI_DQBH,
  103. S.TSI_DQMC,
  104. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  105. nvl(trunc(t2.sri_train_one / 45), 0) || '学时' ||nvl((mod(t2.sri_train_one, 45)), 0) || '分钟' as K1,
  106. nvl(trunc(t2.sri_train_two / 45), 0) || '学时' ||nvl((mod(t2.sri_train_two, 45)), 0) || '分钟' as K2,
  107. nvl(trunc(t2.sri_train_three / 45), 0) || '学时' ||nvl((mod(t2.sri_train_three, 45)), 0) || '分钟' as K3,
  108. nvl(trunc(t2.sri_train_four / 45), 0) || '学时' ||nvl((mod(t2.sri_train_four, 45)), 0) || '分钟' as K4,
  109. (select nvl(trunc(sum(tsc_credit_ration) / 45), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 45)), 0) || '分钟' from tms_train_subject_credit@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 1) as total_km1,
  110. (select nvl(trunc(sum(tsc_credit_ration) / 45), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 45)), 0) || '分钟' from tms_train_subject_credit@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 2) as total_km2,
  111. (select nvl(trunc(sum(tsc_credit_ration) / 45), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 45)), 0) || '分钟' from tms_train_subject_credit@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 3) as total_km3,
  112. (select nvl(trunc(sum(tsc_credit_ration) / 45), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 45)), 0) || '分钟' from tms_train_subject_credit@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 4) as total_km4,
  113. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  114. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  115. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  116. FROM TMS_STUDENT_INFO@tms${city} T
  117. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  118. ON T.TSO_SCHOOL_ID = S.TSI_ID
  119. left join tms_student_train_info@tms${city} t2
  120. on t.tso_id = t2.sri_student_id
  121. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  122. on ttv.studentId = tso_id
  123. left join tms_student_face_info@tms${city} fi
  124. on t.tso_id = fi.student_id
  125. WHERE T.TSO_ID = #{id}
  126. </select>
  127. </mapper>