TmsStudentInfoMapper.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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="sex" column="TSO_SEX" />
  9. <result property="phone" column="TSO_PHONE" />
  10. <result property="applydate" column="TSO_APPLYDATE" />
  11. <result property="state" column="TSO_STATE" />
  12. <result property="trainType" column="TSO_TRAINTYPE" />
  13. <result property="photoPath" column="TSO_PHOTO_PATH" />
  14. <result property="remark" column="TSO_REMARK" />
  15. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  16. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  17. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  18. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  19. <result property="trainThreeExamStatus" column="SRI_TRAIN_THREE_EXAM_STATUS" />
  20. <result property="trainThreeExamTime" column="SRI_TRAIN_THREE_EXAM_TIME" />
  21. <result property="trainFourExamStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  22. <result property="trainFourExamTime" column="SRI_TRAIN_FOUR_EXAM_TIME" />
  23. <result property="bmType" column="BM_TYPE" />
  24. </resultMap>
  25. <resultMap id="TmsStudentInfoTempResultMap" type="com.miaxis.tms.vo.TmsStudentInfoTempVo">
  26. <id property="id" column="TSO_ID" />
  27. <result property="idcard" column="TSO_IDCARD" />
  28. <result property="name" column="TSO_NAME" />
  29. <result property="phone" column="TSO_PHONE" />
  30. <result property="applydate" column="TSO_APPLYDATE" />
  31. <result property="state" column="TSO_STATE" />
  32. <result property="trainType" column="TSO_TRAINTYPE" />
  33. <result property="photoPath" column="TSO_PHOTO_PATH" />
  34. <result property="remark" column="TSO_REMARK" />
  35. <result property="bmType" column="BM_TYPE" />
  36. </resultMap>
  37. <resultMap id="TmsStudentInfoIdResultMap" type="com.miaxis.tms.vo.TmsStudentInfoIdVo">
  38. <id property="id" column="TSO_ID" />
  39. <result property="cardType" column="TSO_CARDTYPE" />
  40. <result property="idcard" column="TSO_IDCARD" />
  41. <result property="name" column="TSO_NAME" />
  42. <result property="sex" column="TSO_SEX" />
  43. <result property="phone" column="TSO_PHONE" />
  44. <result property="source" column="TSO_SOURCE" />
  45. <result property="nationality" column="TSO_NATIONALITY" />
  46. <result property="trainType" column="TSO_TRAINTYPE" />
  47. <result property="active" column="TSO_ACTIVE" />
  48. <result property="recordDate" column="TSO_RECORD_DATE" />
  49. <result property="address" column="TSO_ADDRESS" />
  50. <result property="photoPath" column="TSO_PHOTO_PATH" />
  51. <result property="password" column="TSO_PASSWORD" />
  52. <result property="face" column="FACE" />
  53. <result property="schoolId" column="TSI_ID" />
  54. <result property="schoolName" column="TSI_NAME" />
  55. <result property="schoolShortName" column="TSI_SHORTNAME" />
  56. <result property="schoolAddress" column="TSI_ADDRESS" />
  57. <result property="schollInscode" column="TSI_INSCODE" />
  58. <result property="qxbh" column="TSI_QXBH" />
  59. <result property="qxmc" column="TSI_QXMC" />
  60. <result property="dqbh" column="TSI_DQBH" />
  61. <result property="dqmc" column="TSI_DQMC" />
  62. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  63. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  64. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  65. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  66. <result property="trainThreeExamStatus" column="SRI_TRAIN_THREE_EXAM_STATUS" />
  67. <result property="trainThreeExamTime" column="SRI_TRAIN_THREE_EXAM_TIME" />
  68. <result property="trainFourExamStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  69. <result property="trainFourExamTime" column="SRI_TRAIN_FOUR_EXAM_TIME" />
  70. <result property="k1" column="K1" />
  71. <result property="k2" column="K2" />
  72. <result property="k3" column="K3" />
  73. <result property="k4" column="K4" />
  74. <result property="totalKm1" column="TOTAL_KM1" />
  75. <result property="totalKm2" column="TOTAL_KM2" />
  76. <result property="totalKm3" column="TOTAL_KM3" />
  77. <result property="totalKm4" column="TOTAL_KM4" />
  78. <result property="k2Mileage" column="K2MILEAGE" />
  79. <result property="mileage" column="MILEAGE" />
  80. <result property="k3Mileage" column="K3MILEAGE" />
  81. </resultMap>
  82. <resultMap id="TmsSignResultMap" type="com.miaxis.tms.vo.TmsSignVo">
  83. <result property="trainCarLicnum" column="TDI_TRAIN_CAR_LICNUM" />
  84. <result property="sim" column="TDI_SIM" />
  85. <result property="loginTime" column="LSL_LOGIN_TIME" />
  86. <result property="loginFlag" column="LSL_LOGIN_FLAG" />
  87. </resultMap>
  88. <resultMap id="TmsStudentTeachLogResultMap" type="com.miaxis.tms.vo.TmsStudentTeachLogVo">
  89. <result property="recnum" column="CRI_RECNUM" />
  90. <result property="pxlxName" column="PXLX_NAME" />
  91. <result property="mile" column="MILE" />
  92. <result property="duration" column="CRI_DURATION" />
  93. <result property="vaildTime" column="CRI_VAILD_TIME" />
  94. <result property="trainSubject" column="CRI_TRAIN_SUBJECT" />
  95. <result property="startTime" column="CRI_STARTTIME" />
  96. <result property="endTime" column="CRI_ENDTIME" />
  97. <result property="coachName" column="COACH_NAME" />
  98. <result property="carLicnum" column="CAR_LICNUM" />
  99. <result property="sim" column="SIM" />
  100. <result property="auditResult" column="CRI_AUDIT_RESULT" />
  101. <result property="recordStatus" column="CRI_RECORD_STATUS" />
  102. <result property="classid" column="CRI_CLASSID" />
  103. <result property="auditReason" column="CRI_AUDIT_REASON" />
  104. </resultMap>
  105. <select id="getTmsMyStudentInfoList" parameterType="com.miaxis.tms.dto.TmsStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  106. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  107. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  108. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'2' as bm_type
  109. from tms_student_info@tms${city} t1
  110. left join tms_student_train_info@tms${city} t2
  111. on t1.tso_id = t2.sri_student_id
  112. <where>
  113. AND t1.TSO_BUSITYPE in ('0', '1')
  114. AND t1.TSO_LOGOUT = 0
  115. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  116. <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>
  117. <if test="schoolId != null "> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>
  118. <if test="state != null and state != ''"> AND t1.TSO_STATE = #{state,jdbcType=VARCHAR }</if>
  119. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  120. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  121. </where>
  122. ORDER BY t1.TSO_ID desc
  123. </select>
  124. <select id="getTmsStudentInfoList" parameterType="com.miaxis.tms.dto.TmsStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  125. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  126. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  127. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'2' as bm_type
  128. from tms_student_info@tms${city} t1
  129. left join tms_student_train_info@tms${city} t2
  130. on t1.tso_id = t2.sri_student_id
  131. <where>
  132. AND t1.TSO_BUSITYPE in ('0', '1')
  133. AND t1.TSO_LOGOUT = 0
  134. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  135. <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>
  136. <!--<if test="schoolId != null "> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>-->
  137. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  138. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  139. #{sid}
  140. </foreach>
  141. </if>
  142. <if test="state != null and state != ''"> AND t1.TSO_STATE = #{state,jdbcType=VARCHAR }</if>
  143. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  144. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  145. </where>
  146. ORDER BY t1.TSO_ID desc
  147. </select>
  148. <select id="getTmsStudentInfoTempList" parameterType="com.miaxis.tms.dto.TmsStudentInfoTempDTO" resultMap="TmsStudentInfoTempResultMap">
  149. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,'1' as bm_type
  150. from tms_student_info_temp@tms${city} t1
  151. <where>
  152. AND t1.TSO_BUSITYPE in ('0', '1')
  153. AND t1.TSO_LOGOUT = 0
  154. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  155. <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>
  156. <if test="schoolId != null "> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>
  157. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  158. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  159. </where>
  160. ORDER BY t1.TSO_ID desc
  161. </select>
  162. <select id="getTmsAllStudentInfoList" parameterType="com.miaxis.tms.dto.TmsAllStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  163. select * from (
  164. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE ,
  165. t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  166. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  167. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'1' as bm_type
  168. from tms_student_info_temp@tms${city} t1
  169. left join tms_student_train_info@tms${city} t2
  170. on t1.tso_id = t2.sri_student_id
  171. <where>
  172. AND t1.TSO_BUSITYPE in ('0', '1')
  173. AND t1.TSO_LOGOUT = 0
  174. <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>
  175. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  176. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  177. #{sid}
  178. </foreach>
  179. </if>
  180. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  181. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  182. </where>
  183. union
  184. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.
  185. TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  186. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  187. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'2' as bm_type
  188. from tms_student_info@tms${city} t1
  189. left join tms_student_train_info@tms${city} t2
  190. on t1.tso_id = t2.sri_student_id
  191. <where>
  192. AND t1.TSO_BUSITYPE in ('0', '1')
  193. AND t1.TSO_LOGOUT = 0
  194. <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>
  195. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  196. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  197. #{sid}
  198. </foreach>
  199. </if>
  200. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  201. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } )</if>
  202. </where>
  203. )
  204. ORDER BY TSO_ID desc
  205. </select>
  206. <select id="getTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  207. SELECT t.tso_id,
  208. t.tso_cardtype,
  209. t.tso_Idcard,
  210. t.tso_name,
  211. t.tso_sex,
  212. t.tso_phone,
  213. t.tso_source,
  214. t.TSO_NATIONALITY,
  215. t.tso_traintype,
  216. t.tso_active,
  217. t.tso_record_date,
  218. t.tso_address,
  219. t.tso_photo_path,
  220. t.tso_password,
  221. fi.face,
  222. S.TSI_ID,
  223. S.TSI_NAME,
  224. S.TSI_SHORTNAME,
  225. S.TSI_ADDRESS,
  226. S.TSI_INSCODE,
  227. S.TSI_QXBH,
  228. S.TSI_QXMC,
  229. S.TSI_DQBH,
  230. S.TSI_DQMC,
  231. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  232. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  233. nvl(trunc(t2.sri_train_one / 45), 0) || '学时' ||nvl((mod(t2.sri_train_one, 45)), 0) || '分钟' as K1,
  234. nvl(trunc(t2.sri_train_two / 45), 0) || '学时' ||nvl((mod(t2.sri_train_two, 45)), 0) || '分钟' as K2,
  235. nvl(trunc(t2.sri_train_three / 45), 0) || '学时' ||nvl((mod(t2.sri_train_three, 45)), 0) || '分钟' as K3,
  236. nvl(trunc(t2.sri_train_four / 45), 0) || '学时' ||nvl((mod(t2.sri_train_four, 45)), 0) || '分钟' as K4,
  237. (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,
  238. (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,
  239. (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,
  240. (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,
  241. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  242. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  243. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  244. FROM TMS_STUDENT_INFO@tms${city} T
  245. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  246. ON T.TSO_SCHOOL_ID = S.TSI_ID
  247. left join tms_student_train_info@tms${city} t2
  248. on t.tso_id = t2.sri_student_id
  249. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  250. on ttv.studentId = tso_id
  251. left join tms_student_face_info@tms${city} fi
  252. on t.tso_id = fi.student_id
  253. WHERE T.TSO_ID = #{id}
  254. </select>
  255. <select id="getWzTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoApplyIdDTO" resultMap="TmsStudentInfoIdResultMap">
  256. SELECT t.tso_id,
  257. t.tso_cardtype,
  258. t.tso_Idcard,
  259. t.tso_name,
  260. t.tso_sex,
  261. t.tso_phone,
  262. t.tso_source,
  263. t.TSO_NATIONALITY,
  264. t.tso_traintype,
  265. t.tso_active,
  266. t.tso_record_date,
  267. t.tso_address,
  268. t.tso_photo_path,
  269. t.tso_password,
  270. fi.face,
  271. S.TSI_ID,
  272. S.TSI_NAME,
  273. S.TSI_SHORTNAME,
  274. S.TSI_ADDRESS,
  275. S.TSI_INSCODE,
  276. S.TSI_QXBH,
  277. S.TSI_QXMC,
  278. S.TSI_DQBH,
  279. S.TSI_DQMC,
  280. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  281. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  282. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  283. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  284. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  285. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  286. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit1@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 1) as total_km1,
  287. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit1@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 2) as total_km2,
  288. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit1@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 3) as total_km3,
  289. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit1@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 4) as total_km4,
  290. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  291. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  292. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  293. FROM TMS_STUDENT_INFO@tms${city} T
  294. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  295. ON T.TSO_SCHOOL_ID = S.TSI_ID
  296. left join tms_student_train_info@tms${city} t2
  297. on t.tso_id = t2.sri_student_id
  298. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  299. on ttv.studentId = tso_id
  300. left join tms_student_face_info@tms${city} fi
  301. on t.tso_id = fi.student_id
  302. WHERE T.TSO_ID = #{id}
  303. </select>
  304. <select id="getTzTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  305. SELECT t.tso_id,
  306. t.tso_cardtype,
  307. t.tso_Idcard,
  308. t.tso_name,
  309. t.tso_sex,
  310. t.tso_phone,
  311. t.tso_source,
  312. t.TSO_NATIONALITY,
  313. t.tso_traintype,
  314. t.tso_active,
  315. t.tso_record_date,
  316. t.tso_address,
  317. t.tso_photo_path,
  318. t.tso_password,
  319. fi.face,
  320. S.TSI_ID,
  321. S.TSI_NAME,
  322. S.TSI_SHORTNAME,
  323. S.TSI_ADDRESS,
  324. S.TSI_INSCODE,
  325. S.TSI_QXBH,
  326. S.TSI_QXMC,
  327. S.TSI_DQBH,
  328. S.TSI_DQMC,
  329. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  330. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  331. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  332. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  333. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  334. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  335. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit_new@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 1) as total_km1,
  336. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit_new@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 2) as total_km2,
  337. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit_new@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 3) as total_km3,
  338. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 0) || '分钟' from tms_train_subject_credit_new@tms${city} c where c.tsc_permit_drive_car_type = t.tso_traintype and tsc_apply_exam_subject = 4) as total_km4,
  339. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  340. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  341. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  342. FROM TMS_STUDENT_INFO@tms${city} T
  343. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  344. ON T.TSO_SCHOOL_ID = S.TSI_ID
  345. left join tms_student_train_info@tms${city} t2
  346. on t.tso_id = t2.sri_student_id
  347. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  348. on ttv.studentId = tso_id
  349. left join tms_student_face_info@tms${city} fi
  350. on t.tso_id = fi.student_id
  351. WHERE T.TSO_ID = #{id}
  352. </select>
  353. <select id="getWzOldTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoApplyIdDTO" resultMap="TmsStudentInfoIdResultMap">
  354. SELECT t.tso_id,
  355. t.tso_cardtype,
  356. t.tso_Idcard,
  357. t.tso_name,
  358. t.tso_sex,
  359. t.tso_phone,
  360. t.tso_source,
  361. t.TSO_NATIONALITY,
  362. t.tso_traintype,
  363. t.tso_active,
  364. t.tso_record_date,
  365. t.tso_address,
  366. t.tso_photo_path,
  367. t.tso_password,
  368. fi.face,
  369. S.TSI_ID,
  370. S.TSI_NAME,
  371. S.TSI_SHORTNAME,
  372. S.TSI_ADDRESS,
  373. S.TSI_INSCODE,
  374. S.TSI_QXBH,
  375. S.TSI_QXMC,
  376. S.TSI_DQBH,
  377. S.TSI_DQMC,
  378. t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  379. t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  380. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  381. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  382. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  383. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  384. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 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,
  385. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 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,
  386. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 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,
  387. (select nvl(trunc(sum(tsc_credit_ration) / 60), 0) || '学时' ||nvl((mod(sum(tsc_credit_ration), 60)), 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,
  388. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  389. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  390. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  391. FROM TMS_STUDENT_INFO@tms${city} T
  392. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  393. ON T.TSO_SCHOOL_ID = S.TSI_ID
  394. left join tms_student_train_info@tms${city} t2
  395. on t.tso_id = t2.sri_student_id
  396. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  397. on ttv.studentId = tso_id
  398. left join tms_student_face_info@tms${city} fi
  399. on t.tso_id = fi.student_id
  400. WHERE T.TSO_ID = #{id}
  401. </select>
  402. <select id="getTmsLogFaceListByStuId" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultType="com.miaxis.tms.vo.TmsLogFaceVo" >
  403. select f.crdate,f.sim,f.sourceimg,f.img, f.similar, f.type from tms_log_face_info@tms${city} f
  404. where f.stu_out_id = #{id}
  405. order by f.crdate desc
  406. </select>
  407. <select id="getTmsSignListByStuId" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsSignResultMap" >
  408. SELECT D.TDI_TRAIN_CAR_LICNUM, D.TDI_SIM, t.lsl_login_time,t.lsl_login_flag
  409. FROM TMS_LOG_STUDENT_LOGIN@tms${city} T
  410. LEFT JOIN TMS_STUDENT_INFO@tms${city} s
  411. ON s.TSO_ID = T.LSL_STU_ID
  412. LEFT JOIN TMS_DEVICE_INFO@tms${city} D
  413. ON D.TDI_ID = T.LSL_DEV_ID
  414. WHERE T.LSL_STU_ID = #{id}
  415. ORDER BY T.LSL_LOGIN_TIME DESC
  416. </select>
  417. <select id="getDayStuTempCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  418. select trunc(t.tso_applydate) as dateTime,count(1) as stuCount
  419. from tms_student_info_temp@tms${city} t
  420. where 1=1
  421. and t.tso_school_id = #{schoolId}
  422. and trunc(t.tso_applydate) = trunc(sysdate - #{day})
  423. group by trunc(t.tso_applydate)
  424. </select>
  425. <select id="getDayStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  426. select trunc(t.tso_applydate) as dateTime,count(1) as stuCount
  427. from tms_student_info@tms${city} t
  428. where 1=1
  429. and t.tso_school_id = #{schoolId}
  430. and trunc(t.tso_applydate) = trunc(sysdate - #{day})
  431. group by trunc(t.tso_applydate)
  432. </select>
  433. <select id="getMonthStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  434. select to_char(tso_applydate, 'yyyy-MM') as dateTime,count(1) as stuCount
  435. from tms_student_info@tms${city} t
  436. where 1=1
  437. and t.tso_school_id = #{schoolId}
  438. and trunc(t.tso_applydate,'MONTH') = ADD_MONTHS(TRUNC(SYSDATE, 'MONTH'), #{month})
  439. group by to_char(tso_applydate, 'yyyy-MM')
  440. order by to_char(tso_applydate, 'yyyy-MM')
  441. </select>
  442. <select id="getYearStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  443. select to_char(tso_applydate, 'yyyy') as dateTime,count(1) as stuCount
  444. from tms_student_info@tms${city} t
  445. where 1=1
  446. and t.tso_school_id = #{schoolId}
  447. and TO_CHAR(t.tso_applydate, 'yyyy') = TO_CHAR(ADD_MONTHS(sysdate, #{month}), 'YYYY')
  448. group by to_char(tso_applydate, 'yyyy')
  449. order by to_char(tso_applydate, 'yyyy')
  450. </select>
  451. <select id="getEveryDayStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  452. select to_char(tso_applydate, 'yyyy-MM-dd') as dateTime,count(1) as stuCount
  453. from tms_student_info@tms${city} t
  454. where 1=1
  455. and t.tso_school_id = #{schoolId}
  456. and t.tso_applydate <![CDATA[ >= ]]> to_date(#{startDate},'yyyy-MM-dd')
  457. and t.tso_applydate <![CDATA[ < ]]> to_date(#{endDate},'yyyy-MM-dd')+1
  458. group by to_char(tso_applydate, 'yyyy-MM-dd')
  459. order by ${field} ${sort}
  460. </select>
  461. <select id="getEveryMonthStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  462. SELECT TO_CHAR(tso_applydate, 'yyyy-MM') AS dateTime, COUNT(1) AS stuCount
  463. FROM tms_student_info@tms${city} t
  464. WHERE t.tso_school_id = #{schoolId}
  465. and t.tso_applydate <![CDATA[ >= ]]> to_date(#{startMonth},'yyyy-MM')
  466. and t.tso_applydate <![CDATA[ < ]]> to_date(#{endMonth},'yyyy-MM')+1
  467. GROUP BY TO_CHAR(tso_applydate, 'yyyy-MM')
  468. ORDER BY ${field} ${sort}
  469. </select>
  470. <select id="getEveryYearStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmYearListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  471. SELECT TO_CHAR(tso_applydate, 'yyyy') AS dateTime, COUNT(1) AS stuCount
  472. FROM tms_student_info@tms${city} t
  473. WHERE t.tso_school_id = #{schoolId}
  474. AND EXTRACT(YEAR FROM t.tso_applydate) <![CDATA[ >= ]]> #{startYear}
  475. AND EXTRACT(YEAR FROM t.tso_applydate) <![CDATA[ <= ]]> #{endYear}
  476. GROUP BY TO_CHAR(tso_applydate, 'yyyy')
  477. ORDER BY ${field} ${sort}
  478. </select>
  479. <update id="upStuAppCoachIdById" parameterType="com.miaxis.tms.dto.TmsStudentInfoQrDTO">
  480. update TMS_STUDENT_INFO@tms${city} set tso_app_coach_id = #{appCoachId} where tso_id = #{id}
  481. </update>
  482. <select id="getTmsStudentTeachLogById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentTeachLogResultMap" >
  483. SELECT CRI_RECNUM,DECODE(SUBSTR(T.CRI_SUBJCODE,0,1),1,'实操',2,'课堂教学',3,'模拟器教学',4,'远程教学','') PXLX_NAME,
  484. round(t.cri_mileage/1000,3) as mile,
  485. t.cri_duration,t.cri_vaild_time,CRI_TRAIN_SUBJECT,
  486. t.cri_starttime,t.cri_endtime,c.TCI_NAME COACH_NAME,
  487. car.tco_licnum CAR_LICNUM,t.cri_device_id sim,t.CRI_AUDIT_RESULT,t.CRI_RECORD_STATUS,T.CRI_CLASSID,CRI_AUDIT_REASON
  488. FROM TMS_TRAIN_CLASS_RECORD@tms${city} T LEFT JOIN TMS_SCHOOL_INFO@tms${city} S ON T.CRI_SCHOOL_ID = S.TSI_ID
  489. LEFT JOIN TMS_STUDENT_INFO@tms${city} STU ON T.CRI_STUDENT_ID = STU.TSO_ID
  490. LEFT JOIN TMS_COACH_INFO@tms${city} C ON T.CRI_COACH_ID = C.TCI_ID
  491. LEFT JOIN tms_train_car_info@tms${city} car on car.tco_id=t.cri_train_car_id WHERE STU.TSO_ID = #{id}
  492. ORDER BY T.cri_id DESC
  493. </select>
  494. <select id="getTmsStudentPhotoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoPhotoDTO" resultType="com.miaxis.tms.vo.TmsStudentPhotoVo" >
  495. SELECT T.EVENT,T.FILEPATH,T.PTIME FROM TMS_TRAIN_FILE_INFO@tms${city} T WHERE T.type =1 and is_del=0 and is_show=0
  496. AND T.STU_ID = #{id}
  497. AND T.CLASSID = #{classId}
  498. ORDER BY T.PTIME DESC
  499. </select>
  500. </mapper>