TenantInfoMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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.yonge.cooleshow.biz.dal.mapper.TenantInfoMapper">
  4. <!-- 表字段 -->
  5. <sql id="baseColumns">
  6. t.id_ AS id
  7. , t.name_ AS name
  8. , t.logo_ AS logo
  9. , t.province_code_ AS provinceCode
  10. , t.city_code_ AS cityCode
  11. , t.region_code_ AS regionCode
  12. , t.username_ AS username
  13. , t.user_id_ AS userId
  14. , t.phone_ AS phone
  15. , t.enable_flag_ AS enableFlag
  16. , t.update_time_ AS updateTime
  17. , t.create_time_ AS createTime
  18. , t.brief_Introduction_ AS briefIntroduction
  19. </sql>
  20. <insert id="insertInfo" parameterType="com.yonge.cooleshow.biz.dal.entity.TenantInfo">
  21. insert into tenant_info
  22. (name_,logo_,brief_Introduction_,province_code_,city_code_,region_code_,username_,phone_)
  23. values (#{param.name},#{param.logo},#{param.briefIntroduction},#{param.provinceCode},#{param.cityCode},#{param.regionCode},#{param.username},#{param.phone})
  24. </insert>
  25. <update id="updateInfo">
  26. update tenant_info
  27. set
  28. <if test="param.name != null and param.name != ''">
  29. name_ = #{param.name},
  30. </if>
  31. <if test="param.logo != null and param.logo != ''">
  32. logo_ = #{param.logo},
  33. </if>
  34. <if test="param.provinceCode != null and param.provinceCode != ''">
  35. province_code_ = #{param.provinceCode},
  36. </if>
  37. <if test="param.cityCode != null and param.cityCode != ''">
  38. city_code_ = #{param.cityCode},
  39. </if>
  40. <if test="param.regionCode != null and param.regionCode != ''">
  41. region_code_ = #{param.regionCode},
  42. </if>
  43. <if test="param.briefIntroduction != null and param.briefIntroduction != ''">
  44. brief_introduction_= #{param.briefIntroduction},
  45. </if>
  46. <if test="param.username != null and param.username != ''">
  47. username_ = #{param.username},
  48. </if>
  49. <if test="param.phone != null and param.phone != ''">
  50. phone_ = #{param.phone}
  51. </if>
  52. WHERE id_ = #{param.id}
  53. </update>
  54. <update id="updateFlag">
  55. update tenant_info
  56. set enable_flag_ = 0
  57. where id_ = #{id}
  58. </update>
  59. <update id="updateMethod">
  60. update teacher
  61. set settlement_from_ = 'TEACHER'
  62. where tenant_id_ = #{id}
  63. </update>
  64. <update id="updateStatusById">
  65. update tenant_apply_record
  66. set status_ = 'PASS'
  67. where id_ =#{id}
  68. </update>
  69. <update id="updateUnpassStatusById">
  70. update tenant_apply_record
  71. set status_ = 'UNPASS'
  72. where id_ =#{id}
  73. </update>
  74. <update id="updateIdPhone">
  75. update tenant_info set user_id_ = #{newId} and phone_ =#{phone} where user_id_ = #{oldId}
  76. </update>
  77. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  78. SELECT
  79. <include refid="baseColumns"/>
  80. FROM tenant_info t
  81. <where>
  82. <if test="param.keyword != null and param.keyword != ''">
  83. and (
  84. t.name_ like concat('%',#{param.keyword},'%')
  85. or t.username_ like concat('%',#{param.keyword},'%')
  86. or t.phone_ like concat('%',#{param.keyword},'%')
  87. )
  88. </if>
  89. <if test="param.provinceCode != null">
  90. and t.province_code_ = #{param.provinceCode}
  91. </if>
  92. <if test="param.cityCode != null">
  93. and t.city_code_ = #{param.cityCode}
  94. </if>
  95. <if test="param.regionCode != null">
  96. and t.region_code_ = #{param.regionCode}
  97. </if>
  98. <if test="param.enableFlag != null">
  99. and t.enable_flag_ = #{param.enableFlag}
  100. </if>
  101. </where>
  102. order by t.create_time_ desc
  103. </select>
  104. <select id="queryTeacherCounts" resultType="com.yonge.cooleshow.biz.dal.entity.TeacherCounts">
  105. SELECT count(t.tenant_id_) as teacherCounts ,t.tenant_id_ as id FROM teacher t where t.tenant_id_ = #{id}
  106. </select>
  107. <select id="queryTeacherCount" resultType="java.lang.String">
  108. SELECT count(t.tenant_id_) FROM teacher t where t.tenant_id_ = #{id}
  109. </select>
  110. <select id="queryStudentCounts" resultType="com.yonge.cooleshow.biz.dal.entity.StudentCounts">
  111. SELECT count(s.tenant_id_) as studentCounts, s.tenant_id_ as id FROM student s where s.tenant_id_ = #{id}
  112. </select>
  113. <select id="queryStudentCount" resultType="java.lang.String">
  114. SELECT count(s.tenant_id_) FROM student s where s.tenant_id_ = #{id}
  115. </select>
  116. <select id="selectApplyPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  117. SELECT
  118. id_ as id,
  119. name_ AS name,
  120. logo_ AS logo,
  121. brief_Introduction_ AS briefIntroduction,
  122. username_ AS username,
  123. phone_ AS phone,
  124. province_code_ AS provinceCode,
  125. city_code_ AS cityCode,
  126. region_code_ AS regionCode,
  127. status_ AS status
  128. FROM tenant_apply_record t
  129. where 1=1
  130. <if test="param.keyword != null and param.keyword.trim() != ''">
  131. and (
  132. t.name_ like concat('%',#{param.keyword},'%')
  133. or t.username_ like concat('%',#{param.keyword},'%')
  134. or t.phone_ like concat('%',#{param.keyword},'%')
  135. )
  136. </if>
  137. <if test="param.provinceCode != null and param.provinceCode != ''
  138. and param.cityCode != null and param.cityCode != ''
  139. and param.regionCode != null and param.regionCode != ''">
  140. and
  141. t.province_code_ = #{param.provinceCode}
  142. and
  143. t.city_code_ = #{param.cityCode}
  144. and
  145. t.region_code_ = #{param.regionCode}
  146. </if>
  147. </select>
  148. <select id="selectHistoryPage"
  149. resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  150. select
  151. id_ AS id,
  152. tenant_apply_record_id_ AS tenantApplyRecordId,
  153. name_ AS name,
  154. logo_ as logo,
  155. province_code_ AS provinceCode,
  156. city_code_ AS cityCode,
  157. region_code_ AS regionCode,
  158. username_ AS username,
  159. phone_ AS phone,
  160. status_ AS status,
  161. verify_user_id_ AS verifyUserId,
  162. reason_ AS reason,
  163. update_time_ AS updateTime,
  164. create_time_ AS createTime
  165. FROM
  166. tenant_entry_record
  167. WHERE
  168. 1=1
  169. <if test="id != null">
  170. and id_ = #{id}
  171. </if>
  172. </select>
  173. <select id="queryNow" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  174. select
  175. id_ AS id,
  176. tenant_id_ AS tenantId,
  177. name_ AS name,
  178. logo_ as logo,
  179. province_code_ AS provinceCode,
  180. city_code_ AS cityCode,
  181. region_code_ AS regionCode,
  182. username_ AS username,
  183. phone_ AS phone,
  184. status_ AS status,
  185. reason_ AS reason
  186. from
  187. tenant_apply_record
  188. where
  189. 1=1
  190. <if test="param.id != null">
  191. and
  192. id_ = #{param.id}
  193. </if>
  194. </select>
  195. <select id="selectInfoById" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  196. select
  197. t.id_ AS id
  198. , t.name_ AS name
  199. , t.logo_ AS logo
  200. , t.province_code_ AS provinceCode
  201. , t.city_code_ AS cityCode
  202. , t.region_code_ AS regionCode
  203. , t.username_ AS userName
  204. , t.user_id_ AS userId
  205. , t.phone_ AS phone
  206. , t.update_time_ AS updateTime
  207. , t.create_time_ AS createTime
  208. , t.brief_Introduction_ AS briefIntroduction
  209. from tenant_info t
  210. where 1=1
  211. <if test="id != null">
  212. and id_ = #{id}
  213. </if>
  214. </select>
  215. <update id="updatePhoneByUserId">
  216. update tenant_info
  217. set phone_ = #{phone}
  218. where user_id_ = #{userId}
  219. </update>
  220. </mapper>