TmsStudentInfoMapper.xml 43 KB

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