TenantInfoMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  75. SELECT
  76. <include refid="baseColumns"/>
  77. FROM tenant_info t
  78. <where>
  79. <if test="param.keyword != null and param.keyword != ''">
  80. and (
  81. t.name_ like concat('%',#{param.keyword},'%')
  82. or t.username_ like concat('%',#{param.keyword},'%')
  83. or t.phone_ like concat('%',#{param.keyword},'%')
  84. )
  85. </if>
  86. <if test="param.provinceCode != null">
  87. and t.province_code_ = #{param.provinceCode}
  88. </if>
  89. <if test="param.cityCode != null">
  90. and t.city_code_ = #{param.cityCode}
  91. </if>
  92. <if test="param.regionCode != null">
  93. and t.region_code_ = #{param.regionCode}
  94. </if>
  95. </where>
  96. </select>
  97. <select id="queryTeacherCounts" resultType="java.lang.Integer">
  98. SELECT count(t.tenant_id_) FROM teacher t where t.tenant_id_ IN (<foreach collection="listId" separator="," item="Id">#{Id}</foreach>)
  99. </select>
  100. <select id="queryTeacherCount" resultType="java.lang.String">
  101. SELECT count(t.tenant_id_) FROM teacher t where t.tenant_id_ = #{id}
  102. </select>
  103. <select id="queryStudentCounts" resultType="java.lang.Integer">
  104. SELECT count(s.tenant_id_) FROM student s where s.tenant_id_ IN (<foreach collection="listId" separator="," item="Id">#{Id}</foreach>)
  105. </select>
  106. <select id="queryStudentCount" resultType="java.lang.String">
  107. SELECT count(s.tenant_id_) FROM student s where s.tenant_id_ = #{id}
  108. </select>
  109. <select id="selectApplyPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  110. SELECT
  111. id_ as id,
  112. name_ AS name,
  113. logo_ AS logo,
  114. brief_Introduction_ AS briefIntroduction,
  115. username_ AS username,
  116. phone_ AS phone,
  117. province_code_ AS provinceCode,
  118. city_code_ AS cityCode,
  119. region_code_ AS regionCode,
  120. status_ AS status
  121. FROM tenant_apply_record t
  122. where 1=1
  123. <if test="param.keyword != null and param.keyword != ''">
  124. and (
  125. t.name_ like concat('%',#{param.keyword},'%')
  126. or t.username_ like concat('%',#{param.keyword},'%')
  127. or t.phone_ like concat('%',#{param.keyword},'%')
  128. )
  129. </if>
  130. <if test="param.provinceCode != null and param.provinceCode != ''
  131. and param.cityCode != null and param.cityCode != ''
  132. and param.regionCode != null and param.regionCode != ''">
  133. and
  134. t.province_code_ = #{param.provinceCode}
  135. and
  136. t.city_code_ = #{param.cityCode}
  137. and
  138. t.region_code_ = #{param.regionCode}
  139. </if>
  140. </select>
  141. <select id="selectHistoryPage"
  142. resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  143. select
  144. id_ AS id,
  145. tenant_apply_record_id_ AS tenantApplyRecordId,
  146. name_ AS name,
  147. logo_ as logo,
  148. province_code_ AS provinceCode,
  149. city_code_ AS cityCode,
  150. region_code_ AS regionCode,
  151. username_ AS username,
  152. phone_ AS phone,
  153. status_ AS status,
  154. verify_user_id_ AS verifyUserId,
  155. reason_ AS reason,
  156. update_time_ AS updateTime,
  157. create_time_ AS createTime
  158. FROM
  159. tenant_entry_record
  160. WHERE
  161. 1=1
  162. <if test="id != null">
  163. and id_ = #{id}
  164. </if>
  165. </select>
  166. <select id="queryNow" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  167. select
  168. id_ AS id,
  169. tenant_id_ AS tenantId,
  170. name_ AS name,
  171. logo_ as logo,
  172. province_code_ AS provinceCode,
  173. city_code_ AS cityCode,
  174. region_code_ AS regionCode,
  175. username_ AS username,
  176. phone_ AS phone,
  177. status_ AS status,
  178. verify_user_id_ AS verifyUserId,
  179. reason_ AS reason,
  180. update_time_ AS updateTime,
  181. create_time_ AS createTime
  182. from
  183. tenant_apply_record
  184. where
  185. 1=1
  186. <if test="param.id != null">
  187. and
  188. id_ = #{param.id}
  189. </if>
  190. </select>
  191. <select id="selectInfoById" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper$TenantInfo">
  192. select
  193. t.id_ AS id
  194. , t.name_ AS name
  195. , t.logo_ AS logo
  196. , t.province_code_ AS provinceCode
  197. , t.city_code_ AS cityCode
  198. , t.region_code_ AS regionCode
  199. , t.username_ AS userName
  200. , t.user_id_ AS userId
  201. , t.phone_ AS phone
  202. , t.update_time_ AS updateTime
  203. , t.create_time_ AS createTime
  204. , t.brief_Introduction_ AS briefIntroduction
  205. from tenant_info t
  206. where 1=1
  207. <if test="id != null">
  208. id_ = #{id}
  209. </if>
  210. }
  211. </select>
  212. </mapper>