TmsStudentInfoMapper.xml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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="trainOneStatus" column="SRI_TRAIN_ONE_STATUS" />
  16. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  17. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  18. <result property="trainTwoStatus" column="SRI_TRAIN_TWO_STATUS" />
  19. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  20. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  21. <result property="trainThreeStatus" column="SRI_TRAIN_THREE_STATUS" />
  22. <result property="trainThreeExamStatus" column="SRI_TRAIN_THREE_EXAM_STATUS" />
  23. <result property="trainThreeExamTime" column="SRI_TRAIN_THREE_EXAM_TIME" />
  24. <result property="trainFourStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  25. <result property="trainFourExamStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  26. <result property="trainFourExamTime" column="SRI_TRAIN_FOUR_EXAM_TIME" />
  27. <result property="bmType" column="BM_TYPE" />
  28. <result property="schoolName" column="SCHOOL_NAME" />
  29. </resultMap>
  30. <resultMap id="TmsStudentInfoTempResultMap" type="com.miaxis.tms.vo.TmsStudentInfoTempVo">
  31. <id property="id" column="TSO_ID" />
  32. <result property="idcard" column="TSO_IDCARD" />
  33. <result property="name" column="TSO_NAME" />
  34. <result property="phone" column="TSO_PHONE" />
  35. <result property="applydate" column="TSO_APPLYDATE" />
  36. <result property="state" column="TSO_STATE" />
  37. <result property="trainType" column="TSO_TRAINTYPE" />
  38. <result property="photoPath" column="TSO_PHOTO_PATH" />
  39. <result property="remark" column="TSO_REMARK" />
  40. <result property="bmType" column="BM_TYPE" />
  41. </resultMap>
  42. <resultMap id="TmsStudentInfoIdResultMap" type="com.miaxis.tms.vo.TmsStudentInfoIdVo">
  43. <id property="id" column="TSO_ID" />
  44. <result property="cardType" column="TSO_CARDTYPE" />
  45. <result property="idcard" column="TSO_IDCARD" />
  46. <result property="name" column="TSO_NAME" />
  47. <result property="sex" column="TSO_SEX" />
  48. <result property="phone" column="TSO_PHONE" />
  49. <result property="source" column="TSO_SOURCE" />
  50. <result property="nationality" column="TSO_NATIONALITY" />
  51. <result property="trainType" column="TSO_TRAINTYPE" />
  52. <result property="active" column="TSO_ACTIVE" />
  53. <result property="recordDate" column="TSO_RECORD_DATE" />
  54. <result property="address" column="TSO_ADDRESS" />
  55. <result property="photoPath" column="TSO_PHOTO_PATH" />
  56. <result property="password" column="TSO_PASSWORD" />
  57. <result property="face" column="FACE" />
  58. <result property="schoolId" column="TSI_ID" />
  59. <result property="schoolName" column="TSI_NAME" />
  60. <result property="schoolShortName" column="TSI_SHORTNAME" />
  61. <result property="schoolAddress" column="TSI_ADDRESS" />
  62. <result property="schollInscode" column="TSI_INSCODE" />
  63. <result property="qxbh" column="TSI_QXBH" />
  64. <result property="qxmc" column="TSI_QXMC" />
  65. <result property="dqbh" column="TSI_DQBH" />
  66. <result property="dqmc" column="TSI_DQMC" />
  67. <result property="trainOneStatus" column="SRI_TRAIN_ONE_STATUS" />
  68. <result property="trainOneExamStatus" column="SRI_TRAIN_ONE_EXAM_STATUS" />
  69. <result property="trainOneExamTime" column="SRI_TRAIN_ONE_EXAM_TIME" />
  70. <result property="trainTwoStatus" column="SRI_TRAIN_TWO_STATUS" />
  71. <result property="trainTwoExamStatus" column="SRI_TRAIN_TWO_EXAM_STATUS" />
  72. <result property="trainTwoExamTime" column="SRI_TRAIN_TWO_EXAM_TIME" />
  73. <result property="trainThreeStatus" column="SRI_TRAIN_THREE_STATUS" />
  74. <result property="trainThreeExamStatus" column="SRI_TRAIN_THREE_EXAM_STATUS" />
  75. <result property="trainThreeExamTime" column="SRI_TRAIN_THREE_EXAM_TIME" />
  76. <result property="trainFourStatus" column="SRI_TRAIN_FOUR_STATUS" />
  77. <result property="trainFourExamStatus" column="SRI_TRAIN_FOUR_EXAM_STATUS" />
  78. <result property="trainFourExamTime" column="SRI_TRAIN_FOUR_EXAM_TIME" />
  79. <result property="k1" column="K1" />
  80. <result property="k2" column="K2" />
  81. <result property="k3" column="K3" />
  82. <result property="k4" column="K4" />
  83. <result property="totalKm1" column="TOTAL_KM1" />
  84. <result property="totalKm2" column="TOTAL_KM2" />
  85. <result property="totalKm3" column="TOTAL_KM3" />
  86. <result property="totalKm4" column="TOTAL_KM4" />
  87. <result property="k2Mileage" column="K2MILEAGE" />
  88. <result property="mileage" column="MILEAGE" />
  89. <result property="k3Mileage" column="K3MILEAGE" />
  90. </resultMap>
  91. <resultMap id="TmsSignResultMap" type="com.miaxis.tms.vo.TmsSignVo">
  92. <result property="trainCarLicnum" column="TDI_TRAIN_CAR_LICNUM" />
  93. <result property="sim" column="TDI_SIM" />
  94. <result property="loginTime" column="LSL_LOGIN_TIME" />
  95. <result property="loginFlag" column="LSL_LOGIN_FLAG" />
  96. </resultMap>
  97. <resultMap id="TmsStudentTeachLogResultMap" type="com.miaxis.tms.vo.TmsStudentTeachLogVo">
  98. <result property="id" column="CRI_ID" />
  99. <result property="recnum" column="CRI_RECNUM" />
  100. <result property="pxlxName" column="PXLX_NAME" />
  101. <result property="mile" column="MILE" />
  102. <result property="duration" column="CRI_DURATION" />
  103. <result property="vaildTime" column="CRI_VAILD_TIME" />
  104. <result property="trainSubject" column="CRI_TRAIN_SUBJECT" />
  105. <result property="startTime" column="CRI_STARTTIME" />
  106. <result property="endTime" column="CRI_ENDTIME" />
  107. <result property="coachName" column="COACH_NAME" />
  108. <result property="carLicnum" column="CAR_LICNUM" />
  109. <result property="sim" column="SIM" />
  110. <result property="auditResult" column="CRI_AUDIT_RESULT" />
  111. <result property="recordStatus" column="CRI_RECORD_STATUS" />
  112. <result property="classid" column="CRI_CLASSID" />
  113. <result property="auditReason" column="CRI_AUDIT_REASON" />
  114. </resultMap>
  115. <resultMap id="TmsPasswordResultMap" type="com.miaxis.tms.vo.TmsPasswordVo">
  116. <result property="name" column="TSO_NAME" />
  117. <result property="idcard" column="TSO_IDCARD" />
  118. <result property="password" column="TSO_PASSWORD" />
  119. </resultMap>
  120. <select id="getTmsMyStudentInfoList" parameterType="com.miaxis.tms.dto.TmsStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  121. 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,
  122. t2.SRI_TRAIN_ONE_STATUS,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time, t2.SRI_TRAIN_TWO_STATUS,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  123. t2.SRI_TRAIN_Three_STATUS,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,
  124. t3.tsi_shortname as school_name
  125. from tms_student_info@tms${city} t1
  126. left join tms_student_train_info@tms${city} t2
  127. on t1.tso_id = t2.sri_student_id
  128. left join tms_school_info@tms${city} t3
  129. on t1.tso_school_id = t3.tsi_id
  130. <where>
  131. AND t1.TSO_BUSITYPE in ('0', '1')
  132. AND t1.TSO_LOGOUT = 0
  133. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  134. <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>
  135. <if test="schoolId != null and schoolId!=''"> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>
  136. <if test="state != null and state != ''"> AND t1.TSO_STATE = #{state,jdbcType=VARCHAR }</if>
  137. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  138. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  139. </where>
  140. ORDER BY t1.TSO_ID desc
  141. </select>
  142. <select id="getTmsStudentInfoList" parameterType="com.miaxis.tms.dto.TmsStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  143. 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,
  144. t2.SRI_TRAIN_ONE_STATUS,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time, t2.SRI_TRAIN_TWO_STATUS,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  145. t2.SRI_TRAIN_Three_STATUS,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,
  146. t3.tsi_shortname as school_name
  147. from tms_student_info@tms${city} t1
  148. left join tms_student_train_info@tms${city} t2
  149. on t1.tso_id = t2.sri_student_id
  150. left join tms_school_info@tms${city} t3
  151. on t1.tso_school_id = t3.tsi_id
  152. <where>
  153. AND t1.TSO_BUSITYPE in ('0', '1')
  154. AND t1.TSO_LOGOUT = 0
  155. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  156. <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>
  157. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  158. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  159. #{sid}
  160. </foreach>
  161. </if>
  162. <if test="state != null and state != ''"> AND t1.TSO_STATE = #{state,jdbcType=VARCHAR }</if>
  163. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  164. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  165. <if test="startDate!=null and startDate!='' " > and t1.tso_applydate <![CDATA[ >= ]]> to_date(#{startDate},'yyyy-MM-dd') </if>
  166. <if test="endDate!=null and endDate!='' " > and t1.tso_applydate <![CDATA[ < ]]> to_date(#{endDate},'yyyy-MM-dd')+1 </if>
  167. </where>
  168. ORDER BY t1.TSO_ID desc
  169. </select>
  170. <select id="getTmsMyStudentInfoTempList" parameterType="com.miaxis.tms.dto.TmsStudentInfoTempDTO" resultMap="TmsStudentInfoTempResultMap">
  171. 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,
  172. t3.tsi_shortname as school_name
  173. from tms_student_info_temp@tms${city} t1
  174. left join tms_school_info@tms${city} t3
  175. on t1.tso_school_id = t3.tsi_id
  176. <where>
  177. AND t1.TSO_BUSITYPE in ('0', '1')
  178. AND t1.TSO_LOGOUT = 0
  179. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  180. <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>
  181. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>
  182. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  183. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  184. </where>
  185. ORDER BY t1.TSO_ID desc
  186. </select>
  187. <select id="getTmsStudentInfoTempList" parameterType="com.miaxis.tms.dto.TmsStudentInfoTempDTO" resultMap="TmsStudentInfoTempResultMap">
  188. 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,
  189. t3.tsi_shortname as school_name
  190. from tms_student_info_temp@tms${city} t1
  191. left join tms_school_info@tms${city} t3
  192. on t1.tso_school_id = t3.tsi_id
  193. <where>
  194. AND t1.TSO_BUSITYPE in ('0', '1')
  195. AND t1.TSO_LOGOUT = 0
  196. <if test="appCoachId!=null" > AND t1.TSO_APP_COACH_ID = #{appCoachId,jdbcType=NUMERIC } </if>
  197. <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>
  198. <!--<if test="schoolId != null "> and t1.TSO_SCHOOL_ID = #{schoolId,jdbcType=NUMERIC} </if>-->
  199. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  200. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  201. #{sid}
  202. </foreach>
  203. </if>
  204. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  205. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  206. </where>
  207. ORDER BY t1.TSO_ID desc
  208. </select>
  209. <select id="getTmsAllStudentInfoList" parameterType="com.miaxis.tms.dto.TmsAllStudentInfoDTO" resultMap="TmsStudentInfoResultMap">
  210. select * from (
  211. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE ,
  212. t1.TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  213. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  214. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'1' as bm_type,
  215. t3.tsi_shortname as school_name
  216. from tms_student_info_temp@tms${city} t1
  217. left join tms_student_train_info@tms${city} t2
  218. on t1.tso_id = t2.sri_student_id
  219. left join tms_school_info@tms${city} t3
  220. on t1.tso_school_id = t3.tsi_id
  221. <where>
  222. AND t1.TSO_BUSITYPE in ('0', '1')
  223. AND t1.TSO_LOGOUT = 0
  224. <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>
  225. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  226. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  227. #{sid}
  228. </foreach>
  229. </if>
  230. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  231. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } ) </if>
  232. <if test="startDate!=null and startDate!='' " > and t1.tso_applydate <![CDATA[ >= ]]> to_date(#{startDate},'yyyy-MM-dd') </if>
  233. <if test="endDate!=null and endDate!='' " > and t1.tso_applydate <![CDATA[ < ]]> to_date(#{endDate},'yyyy-MM-dd')+1 </if>
  234. </where>
  235. union
  236. select t1.TSO_ID, t1.TSO_IDCARD, t1.TSO_NAME,t1.TSO_SEX,t1.Tso_Phone,t1.TSO_APPLYDATE, t1.TSO_STATE , t1.
  237. TSO_TRAINTYPE, t1.tso_photo_path, t1.TSO_REMARK,
  238. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  239. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,'2' as bm_type,
  240. t3.tsi_shortname as school_name
  241. from tms_student_info@tms${city} t1
  242. left join tms_student_train_info@tms${city} t2
  243. on t1.tso_id = t2.sri_student_id
  244. left join tms_school_info@tms${city} t3
  245. on t1.tso_school_id = t3.tsi_id
  246. <where>
  247. AND t1.TSO_BUSITYPE in ('0', '1')
  248. AND t1.TSO_LOGOUT = 0
  249. <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>
  250. <if test="schoolId != null and schoolId !='' "> and t1.TSO_SCHOOL_ID in
  251. <foreach item="sid" index="index" collection="schoolId.split(',')" open="(" separator="," close=")">
  252. #{sid}
  253. </foreach>
  254. </if>
  255. <if test="coachId!=null" > AND ( t1.TSO_COACHID = #{coachId,jdbcType=NUMERIC }
  256. or t1.TSO_COACH_LEADER = #{coachId,jdbcType=NUMERIC } )</if>
  257. <if test="startDate!=null and startDate!='' " > and t1.tso_applydate <![CDATA[ >= ]]> to_date(#{startDate},'yyyy-MM-dd') </if>
  258. <if test="endDate!=null and endDate!='' " > and t1.tso_applydate <![CDATA[ < ]]> to_date(#{endDate},'yyyy-MM-dd')+1 </if>
  259. </where>
  260. )
  261. ORDER BY TSO_ID desc
  262. </select>
  263. <select id="getTmsStudentInfoTempById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  264. SELECT t.tso_id,
  265. t.tso_cardtype,
  266. t.tso_Idcard,
  267. t.tso_name,
  268. t.tso_sex,
  269. t.tso_phone,
  270. t.tso_source,
  271. t.TSO_NATIONALITY,
  272. t.tso_traintype,
  273. t.tso_active,
  274. t.tso_record_date,
  275. t.tso_address,
  276. t.tso_photo_path,
  277. t.tso_password,
  278. S.TSI_ID,
  279. S.TSI_NAME,
  280. S.TSI_SHORTNAME,
  281. S.TSI_ADDRESS,
  282. S.TSI_INSCODE,
  283. S.TSI_QXBH,
  284. S.TSI_QXMC,
  285. S.TSI_DQBH,
  286. S.TSI_DQMC
  287. FROM TMS_STUDENT_INFO_temp@tms${city} T
  288. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  289. ON T.TSO_SCHOOL_ID = S.TSI_ID
  290. WHERE T.TSO_ID = #{id}
  291. </select>
  292. <select id="getTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  293. SELECT t.tso_id,
  294. t.tso_cardtype,
  295. t.tso_Idcard,
  296. t.tso_name,
  297. t.tso_sex,
  298. t.tso_phone,
  299. t.tso_source,
  300. t.TSO_NATIONALITY,
  301. t.tso_traintype,
  302. t.tso_active,
  303. t.tso_record_date,
  304. t.tso_address,
  305. t.tso_photo_path,
  306. t.tso_password,
  307. fi.face,
  308. S.TSI_ID,
  309. S.TSI_NAME,
  310. S.TSI_SHORTNAME,
  311. S.TSI_ADDRESS,
  312. S.TSI_INSCODE,
  313. S.TSI_QXBH,
  314. S.TSI_QXMC,
  315. S.TSI_DQBH,
  316. S.TSI_DQMC,
  317. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  318. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  319. nvl(trunc(t2.sri_train_one / 45), 0) || '学时' ||nvl((mod(t2.sri_train_one, 45)), 0) || '分钟' as K1,
  320. nvl(trunc(t2.sri_train_two / 45), 0) || '学时' ||nvl((mod(t2.sri_train_two, 45)), 0) || '分钟' as K2,
  321. nvl(trunc(t2.sri_train_three / 45), 0) || '学时' ||nvl((mod(t2.sri_train_three, 45)), 0) || '分钟' as K3,
  322. nvl(trunc(t2.sri_train_four / 45), 0) || '学时' ||nvl((mod(t2.sri_train_four, 45)), 0) || '分钟' as K4,
  323. (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,
  324. (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,
  325. (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,
  326. (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,
  327. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  328. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  329. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  330. FROM TMS_STUDENT_INFO@tms${city} T
  331. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  332. ON T.TSO_SCHOOL_ID = S.TSI_ID
  333. left join tms_student_train_info@tms${city} t2
  334. on t.tso_id = t2.sri_student_id
  335. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  336. on ttv.studentId = tso_id
  337. left join tms_student_face_info@tms${city} fi
  338. on t.tso_id = fi.student_id
  339. WHERE T.TSO_ID = #{id}
  340. </select>
  341. <select id="getWzTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoApplyIdDTO" resultMap="TmsStudentInfoIdResultMap">
  342. SELECT t.tso_id,
  343. t.tso_cardtype,
  344. t.tso_Idcard,
  345. t.tso_name,
  346. t.tso_sex,
  347. t.tso_phone,
  348. t.tso_source,
  349. t.TSO_NATIONALITY,
  350. t.tso_traintype,
  351. t.tso_active,
  352. t.tso_record_date,
  353. t.tso_address,
  354. t.tso_photo_path,
  355. t.tso_password,
  356. fi.face,
  357. S.TSI_ID,
  358. S.TSI_NAME,
  359. S.TSI_SHORTNAME,
  360. S.TSI_ADDRESS,
  361. S.TSI_INSCODE,
  362. S.TSI_QXBH,
  363. S.TSI_QXMC,
  364. S.TSI_DQBH,
  365. S.TSI_DQMC,
  366. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  367. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  368. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  369. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  370. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  371. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  372. (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,
  373. (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,
  374. (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,
  375. (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,
  376. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  377. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  378. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  379. FROM TMS_STUDENT_INFO@tms${city} T
  380. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  381. ON T.TSO_SCHOOL_ID = S.TSI_ID
  382. left join tms_student_train_info@tms${city} t2
  383. on t.tso_id = t2.sri_student_id
  384. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  385. on ttv.studentId = tso_id
  386. left join tms_student_face_info@tms${city} fi
  387. on t.tso_id = fi.student_id
  388. WHERE T.TSO_ID = #{id}
  389. </select>
  390. <select id="getTzTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentInfoIdResultMap">
  391. SELECT t.tso_id,
  392. t.tso_cardtype,
  393. t.tso_Idcard,
  394. t.tso_name,
  395. t.tso_sex,
  396. t.tso_phone,
  397. t.tso_source,
  398. t.TSO_NATIONALITY,
  399. t.tso_traintype,
  400. t.tso_active,
  401. t.tso_record_date,
  402. t.tso_address,
  403. t.tso_photo_path,
  404. t.tso_password,
  405. fi.face,
  406. S.TSI_ID,
  407. S.TSI_NAME,
  408. S.TSI_SHORTNAME,
  409. S.TSI_ADDRESS,
  410. S.TSI_INSCODE,
  411. S.TSI_QXBH,
  412. S.TSI_QXMC,
  413. S.TSI_DQBH,
  414. S.TSI_DQMC,
  415. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  416. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  417. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  418. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  419. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  420. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  421. (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,
  422. (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,
  423. (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,
  424. (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,
  425. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  426. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  427. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  428. FROM TMS_STUDENT_INFO@tms${city} T
  429. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  430. ON T.TSO_SCHOOL_ID = S.TSI_ID
  431. left join tms_student_train_info@tms${city} t2
  432. on t.tso_id = t2.sri_student_id
  433. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  434. on ttv.studentId = tso_id
  435. left join tms_student_face_info@tms${city} fi
  436. on t.tso_id = fi.student_id
  437. WHERE T.TSO_ID = #{id}
  438. </select>
  439. <select id="getWzOldTmsStudentInfoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoApplyIdDTO" resultMap="TmsStudentInfoIdResultMap">
  440. SELECT t.tso_id,
  441. t.tso_cardtype,
  442. t.tso_Idcard,
  443. t.tso_name,
  444. t.tso_sex,
  445. t.tso_phone,
  446. t.tso_source,
  447. t.TSO_NATIONALITY,
  448. t.tso_traintype,
  449. t.tso_active,
  450. t.tso_record_date,
  451. t.tso_address,
  452. t.tso_photo_path,
  453. t.tso_password,
  454. fi.face,
  455. S.TSI_ID,
  456. S.TSI_NAME,
  457. S.TSI_SHORTNAME,
  458. S.TSI_ADDRESS,
  459. S.TSI_INSCODE,
  460. S.TSI_QXBH,
  461. S.TSI_QXMC,
  462. S.TSI_DQBH,
  463. S.TSI_DQMC,
  464. t2.Sri_Train_One_Status,t2.Sri_Train_One_Exam_Status,t2.Sri_Train_One_Exam_Time,t2.Sri_Train_TWO_Status,t2.Sri_Train_TWO_Exam_Status,t2.Sri_Train_Two_Exam_Time,
  465. t2.Sri_Train_Three_Status,t2.Sri_Train_Three_Exam_Status,t2.Sri_Train_Three_Exam_Time,t2.Sri_Train_Four_Status,t2.Sri_Train_Four_Exam_Status,t2.Sri_Train_Four_Exam_Time,
  466. nvl(trunc(t2.sri_train_one / 60), 0) || '学时' ||nvl((mod(t2.sri_train_one, 60)), 0) || '分钟' as K1,
  467. nvl(trunc(t2.sri_train_two / 60), 0) || '学时' ||nvl((mod(t2.sri_train_two, 60)), 0) || '分钟' as K2,
  468. nvl(trunc(t2.sri_train_three / 60), 0) || '学时' ||nvl((mod(t2.sri_train_three, 60)), 0) || '分钟' as K3,
  469. nvl(trunc(t2.sri_train_four / 60), 0) || '学时' ||nvl((mod(t2.sri_train_four, 60)), 0) || '分钟' as K4,
  470. (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,
  471. (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,
  472. (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,
  473. (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,
  474. nvl(ttv.SCTWOTOTALMILE, 0) K2MILEAGE,
  475. nvl(ttv.SCTOTALMILE, 0) MILEAGE,
  476. nvl(ttv.SCTHREETOTALMILE, 0) K3MILEAGE
  477. FROM TMS_STUDENT_INFO@tms${city} T
  478. LEFT JOIN TMS_SCHOOL_INFO@tms${city} S
  479. ON T.TSO_SCHOOL_ID = S.TSI_ID
  480. left join tms_student_train_info@tms${city} t2
  481. on t.tso_id = t2.sri_student_id
  482. left join TMS_TRAIN_TIME_VIEW@tms${city} ttv
  483. on ttv.studentId = tso_id
  484. left join tms_student_face_info@tms${city} fi
  485. on t.tso_id = fi.student_id
  486. WHERE T.TSO_ID = #{id}
  487. </select>
  488. <select id="getTmsLogFaceListByStuId" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultType="com.miaxis.tms.vo.TmsLogFaceVo" >
  489. select f.crdate,f.sim,f.sourceimg,f.img, f.similar, f.type from tms_log_face_info@tms${city} f
  490. where f.stu_out_id = #{id}
  491. order by f.crdate desc
  492. </select>
  493. <select id="getTmsSignListByStuId" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsSignResultMap" >
  494. SELECT D.TDI_TRAIN_CAR_LICNUM, D.TDI_SIM, t.lsl_login_time,t.lsl_login_flag
  495. FROM TMS_LOG_STUDENT_LOGIN@tms${city} T
  496. LEFT JOIN TMS_STUDENT_INFO@tms${city} s
  497. ON s.TSO_ID = T.LSL_STU_ID
  498. LEFT JOIN TMS_DEVICE_INFO@tms${city} D
  499. ON D.TDI_ID = T.LSL_DEV_ID
  500. WHERE T.LSL_STU_ID = #{id}
  501. ORDER BY T.LSL_ID DESC
  502. </select>
  503. <select id="getDayStuTempCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  504. select trunc(t.tso_applydate) as dateTime,count(1) as stuCount
  505. from tms_student_info_temp@tms${city} t
  506. where 1=1
  507. and t.tso_school_id = #{schoolId}
  508. and trunc(t.tso_applydate) = trunc(sysdate - #{day})
  509. group by trunc(t.tso_applydate)
  510. </select>
  511. <select id="getDayStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  512. select trunc(t.tso_applydate) as dateTime,count(1) as stuCount
  513. from tms_student_info@tms${city} t
  514. where 1=1
  515. and t.tso_school_id = #{schoolId}
  516. and trunc(t.tso_applydate) = trunc(sysdate - #{day})
  517. group by trunc(t.tso_applydate)
  518. </select>
  519. <select id="getMonthStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  520. select to_char(tso_applydate, 'yyyy-MM') as dateTime,count(1) as stuCount
  521. from tms_student_info@tms${city} t
  522. where 1=1
  523. and t.tso_school_id = #{schoolId}
  524. and trunc(t.tso_applydate,'MONTH') = ADD_MONTHS(TRUNC(SYSDATE, 'MONTH'), #{month})
  525. group by to_char(tso_applydate, 'yyyy-MM')
  526. order by to_char(tso_applydate, 'yyyy-MM')
  527. </select>
  528. <select id="getYearStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  529. select to_char(tso_applydate, 'yyyy') as dateTime,count(1) as stuCount
  530. from tms_student_info@tms${city} t
  531. where 1=1
  532. and t.tso_school_id = #{schoolId}
  533. and TO_CHAR(t.tso_applydate, 'yyyy') = TO_CHAR(ADD_MONTHS(sysdate, #{month}), 'YYYY')
  534. group by to_char(tso_applydate, 'yyyy')
  535. order by to_char(tso_applydate, 'yyyy')
  536. </select>
  537. <select id="getEveryDayStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmDayListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  538. select to_char(tso_applydate, 'yyyy-MM-dd') as dateTime,count(1) as stuCount
  539. from tms_student_info@tms${city} t
  540. where 1=1
  541. and t.tso_school_id = #{schoolId}
  542. and t.tso_applydate <![CDATA[ >= ]]> to_date(#{startDate},'yyyy-MM-dd')
  543. and t.tso_applydate <![CDATA[ < ]]> to_date(#{endDate},'yyyy-MM-dd')+1
  544. group by to_char(tso_applydate, 'yyyy-MM-dd')
  545. order by ${field} ${sort}
  546. </select>
  547. <select id="getEveryMonthStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmMonthListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  548. SELECT TO_CHAR(tso_applydate, 'yyyy-MM') AS dateTime, COUNT(1) AS stuCount
  549. FROM tms_student_info@tms${city} t
  550. WHERE t.tso_school_id = #{schoolId}
  551. and t.tso_applydate <![CDATA[ >= ]]> to_date(#{startMonth},'yyyy-MM')
  552. and t.tso_applydate <![CDATA[ < ]]> to_date(#{endMonth},'yyyy-MM')+1
  553. GROUP BY TO_CHAR(tso_applydate, 'yyyy-MM')
  554. ORDER BY ${field} ${sort}
  555. </select>
  556. <select id="getEveryYearStuCountBySchoolId" parameterType="com.miaxis.tms.dto.TmsBmYearListDTO" resultType="com.miaxis.tms.vo.TmsBmCountVo" >
  557. SELECT TO_CHAR(tso_applydate, 'yyyy') AS dateTime, COUNT(1) AS stuCount
  558. FROM tms_student_info@tms${city} t
  559. WHERE t.tso_school_id = #{schoolId}
  560. AND EXTRACT(YEAR FROM t.tso_applydate) <![CDATA[ >= ]]> #{startYear}
  561. AND EXTRACT(YEAR FROM t.tso_applydate) <![CDATA[ <= ]]> #{endYear}
  562. GROUP BY TO_CHAR(tso_applydate, 'yyyy')
  563. ORDER BY ${field} ${sort}
  564. </select>
  565. <update id="upStuAppCoachIdById" parameterType="com.miaxis.tms.dto.TmsStudentInfoQrDTO">
  566. update TMS_STUDENT_INFO@tms${city} set tso_app_coach_id = #{appCoachId} where tso_id = #{id}
  567. </update>
  568. <select id="getTmsStudentTeachLogById" parameterType="com.miaxis.tms.dto.TmsStudentInfoIdDTO" resultMap="TmsStudentTeachLogResultMap" >
  569. SELECT CRI_RECNUM,DECODE(SUBSTR(T.CRI_SUBJCODE,0,1),1,'实操',2,'课堂教学',3,'模拟器教学',4,'远程教学','') PXLX_NAME,
  570. round(t.cri_mileage/1000,3) as mile,
  571. t.cri_duration,t.cri_vaild_time,CRI_TRAIN_SUBJECT,
  572. t.cri_starttime,t.cri_endtime,c.TCI_NAME COACH_NAME,
  573. car.tco_licnum CAR_LICNUM,t.cri_device_id sim,t.CRI_ID,t.CRI_AUDIT_RESULT,t.CRI_RECORD_STATUS,T.CRI_CLASSID,CRI_AUDIT_REASON
  574. FROM TMS_TRAIN_CLASS_RECORD@tms${city} T LEFT JOIN TMS_SCHOOL_INFO@tms${city} S ON T.CRI_SCHOOL_ID = S.TSI_ID
  575. LEFT JOIN TMS_STUDENT_INFO@tms${city} STU ON T.CRI_STUDENT_ID = STU.TSO_ID
  576. LEFT JOIN TMS_COACH_INFO@tms${city} C ON T.CRI_COACH_ID = C.TCI_ID
  577. LEFT JOIN tms_train_car_info@tms${city} car on car.tco_id=t.cri_train_car_id WHERE STU.TSO_ID = #{id}
  578. ORDER BY T.cri_id DESC
  579. </select>
  580. <select id="getTmsStudentPhotoById" parameterType="com.miaxis.tms.dto.TmsStudentInfoPhotoDTO" resultType="com.miaxis.tms.vo.TmsStudentPhotoVo" >
  581. SELECT T.EVENT,T.FILEPATH,T.PTIME FROM TMS_TRAIN_FILE_INFO@tms${city} T WHERE T.type =1
  582. <if test="city != '3310'">
  583. and is_del=0 and is_show=0
  584. </if>
  585. AND T.STU_ID = #{id}
  586. AND T.CLASSID = #{classId}
  587. ORDER BY T.ID DESC
  588. </select>
  589. <select id="getXmBmLimit" parameterType="com.miaxis.tms.dto.TmsBmDTO" resultType="com.miaxis.tms.vo.TmsBmLimitVo">
  590. select F_SCH_KYME_SHOW@TMS${city}(${schoolId}) KYME,
  591. F_SCH_JCME@TMS${city}(${schoolId}) JCME,
  592. F_SCH_KYZX@TMS${city}(${schoolId}) KYZX,
  593. decode(sign(F_SCH_KYME_SHOW@TMS${city}(${schoolId}) - F_SCH_KYZX@TMS${city}(${schoolId})),-1,
  594. F_SCH_KYME_SHOW@TMS${city}(${schoolId}),
  595. F_SCH_KYZX@TMS${city}(${schoolId})) ME
  596. from dual
  597. </select>
  598. <select id="getFzBmLimit" parameterType="com.miaxis.tms.dto.TmsBmDTO" resultType="com.miaxis.tms.vo.TmsFzLimitVo">
  599. select year, school_id, tsi_name, tsi_dqbh, tsi_dqmc,tsi_qxbh, tsi_qxmc, car_num, p_num, month_num, month, diff_num,
  600. (month_num + diff_num) as kbrs, ybrs,txrs,(ybrs + txrs) all_ybrs
  601. from (select l.year, l.school_id, s.tsi_name, s.tsi_dqbh, s.tsi_dqmc, s.tsi_qxbh, s.tsi_qxmc, l.car_num, l.p_num, l.month_num, l.month, l.diff_num,
  602. (l.month_num + l.diff_num) as kbrs,
  603. (select count(0)
  604. from tms_student_info@TMS${city} si
  605. where si.tso_school_id = l.school_id
  606. and si.tso_logout = '0'
  607. and si.tso_history = 0
  608. and si.tso_traintype in ('C1', 'C2')
  609. and l.school_id = #{schoolId }
  610. and to_char(si.tso_record_date, 'yyyy-MM') = to_char(sysdate,'yyyy-MM')) ybrs,
  611. (select count(0)
  612. from tms_student_logout@TMS${city} sl, tms_student_logout_temp@TMS${city} lt
  613. where sl.sl_school_id = l.school_id
  614. and sl.sl_stu_id = lt.tso_id
  615. and lt.tso_history = 0
  616. and sl.sl_traintype in ('C1', 'C2')
  617. and sl.sl_reason != '预报名退学'
  618. and to_char(sl.sl_applydate, 'yyyy-MM') = to_char(sysdate,'yyyy-MM')
  619. and to_char(sl.sl_crdate, 'yyyy-MM') = to_char(sysdate,'yyyy-MM') ) txrs
  620. from tms_school_limit@TMS${city} l, tms_school_info@TMS${city} s
  621. where l.school_id = s.tsi_id and s.tsi_id = #{schoolId } and year = to_char(sysdate,'yyyy') and month = to_char(sysdate,'MM'))
  622. </select>
  623. <select id="getQzBmLimit" parameterType="com.miaxis.tms.dto.TmsBmDTO" resultType="com.miaxis.tms.vo.TmsFzLimitVo">
  624. select l.traintype, l.year,l.crtime, l.id,l.school_id,s.tsi_name,s.tsi_dqbh,s.tsi_dqmc,s.tsi_qxbh,s.tsi_qxmc,s.tsi_bm_lock,s.tsi_bm_lock_date,l.car_num,l.p_num,l.month_num,l.month,l.sbn_num,l.xbn_num,l.diff_num,(l.month_num+l.diff_num) as kbrs,l.reason,
  625. (select count(0) from tms_student_info si
  626. where si.tso_school_id=l.school_id
  627. and si.tso_logout=0
  628. and si.tso_history=0
  629. and si.tso_traintype =l.traintype
  630. and to_char(si.tso_record_date,'yyyy-MM')= to_char(sysdate,'yyyy-MM')) ybrs
  631. from tms_school_limit l,tms_school_info s where l.school_id=s.tsi_id and s.tsi_id = 3505030009 and year = to_char(sysdate,'yyyy') and month = to_char(sysdate,'MM') ;
  632. </select>
  633. <select id="getPasswordByIdcard" parameterType="com.miaxis.tms.dto.TmsIdcardPhoneDTO" resultMap="TmsPasswordResultMap">
  634. select tso_idcard,tso_password,tso_name from TMS_STUDENT_INFO@tms${city} t
  635. <where>
  636. AND t.TSO_LOGOUT = 0
  637. AND t.tso_id = (SELECT MAX(tso_id) FROM tms_student_info@tms${city} t2
  638. <where>
  639. <if test="idcard != null and idcard != ''">
  640. and t2.tso_idcard = #{idcard,jdbcType=VARCHAR}
  641. </if>
  642. <if test="phone != null and phone != ''">
  643. and t2.tso_phone = #{phone,jdbcType=VARCHAR}
  644. </if>
  645. </where>
  646. )
  647. </where>
  648. </select>
  649. </mapper>