UserInfoMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.miaxis.app.user.mapper.UserInfoMapper">
  6. <resultMap type="UserInfo" id="UserInfoResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="sex" column="sex" />
  10. <result property="sfzmlx" column="sfzmlx" />
  11. <result property="idCard" column="id_card" />
  12. <result property="crdate" column="crdate" />
  13. <result property="birthday" column="birthday" />
  14. <result property="mobile" column="mobile" />
  15. <result property="password" column="password" />
  16. <result property="wechar" column="wechar" />
  17. <result property="openid" column="openid" />
  18. <result property="inscode" column="inscode" />
  19. <result property="createTime" column="create_time" />
  20. <result property="schoolClassTypeId" column="school_class_type_id" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="pxcx" column="pxcx" />
  23. <result property="coachnum" column="coachnum" />
  24. <result property="status" column="status" />
  25. </resultMap>
  26. <sql id="selectUserInfoVo">
  27. select id, name, sex, sfzmlx, id_card, crdate, birthday, mobile, password, wechar, openid, inscode, create_time, school_class_type_id, update_time, pxcx, coachnum, status from user_info
  28. </sql>
  29. <select id="selectUserInfoList" parameterType="UserInfo" resultMap="UserInfoResult">
  30. <include refid="selectUserInfoVo"/>
  31. <where>
  32. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  33. <if test="sex != null "> and sex = #{sex}</if>
  34. <if test="sfzmlx != null "> and sfzmlx = #{sfzmlx}</if>
  35. <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
  36. <if test="crdate != null "> and crdate = #{crdate}</if>
  37. <if test="birthday != null "> and birthday = #{birthday}</if>
  38. <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
  39. <if test="password != null and password != ''"> and password = #{password}</if>
  40. <if test="wechar != null and wechar != ''"> and wechar = #{wechar}</if>
  41. <if test="openid != null and openid != ''"> and openid = #{openid}</if>
  42. <if test="inscode != null and inscode != ''"> and inscode = #{inscode}</if>
  43. <if test="schoolClassTypeId != null "> and school_class_type_id = #{schoolClassTypeId}</if>
  44. <if test="pxcx != null and pxcx != ''"> and pxcx = #{pxcx}</if>
  45. <if test="coachnum != null and coachnum != ''"> and coachnum = #{coachnum}</if>
  46. <if test="status != null "> and status = #{status}</if>
  47. </where>
  48. </select>
  49. <select id="selectUserInfoById" parameterType="Long" resultMap="UserInfoResult">
  50. <include refid="selectUserInfoVo"/>
  51. where id = #{id}
  52. </select>
  53. <insert id="insertUserInfo" parameterType="UserInfo">
  54. insert into user_info
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="id != null">id,</if>
  57. <if test="name != null">name,</if>
  58. <if test="sex != null">sex,</if>
  59. <if test="sfzmlx != null">sfzmlx,</if>
  60. <if test="idCard != null">id_card,</if>
  61. <if test="crdate != null">crdate,</if>
  62. <if test="birthday != null">birthday,</if>
  63. <if test="mobile != null">mobile,</if>
  64. <if test="password != null">password,</if>
  65. <if test="wechar != null">wechar,</if>
  66. <if test="openid != null">openid,</if>
  67. <if test="inscode != null">inscode,</if>
  68. <if test="createTime != null">create_time,</if>
  69. <if test="schoolClassTypeId != null">school_class_type_id,</if>
  70. <if test="updateTime != null">update_time,</if>
  71. <if test="pxcx != null">pxcx,</if>
  72. <if test="coachnum != null">coachnum,</if>
  73. <if test="status != null">status,</if>
  74. </trim>
  75. <trim prefix="values (" suffix=")" suffixOverrides=",">
  76. <if test="id != null">#{id},</if>
  77. <if test="name != null">#{name},</if>
  78. <if test="sex != null">#{sex},</if>
  79. <if test="sfzmlx != null">#{sfzmlx},</if>
  80. <if test="idCard != null">#{idCard},</if>
  81. <if test="crdate != null">#{crdate},</if>
  82. <if test="birthday != null">#{birthday},</if>
  83. <if test="mobile != null">#{mobile},</if>
  84. <if test="password != null">#{password},</if>
  85. <if test="wechar != null">#{wechar},</if>
  86. <if test="openid != null">#{openid},</if>
  87. <if test="inscode != null">#{inscode},</if>
  88. <if test="createTime != null">#{createTime},</if>
  89. <if test="schoolClassTypeId != null">#{schoolClassTypeId},</if>
  90. <if test="updateTime != null">#{updateTime},</if>
  91. <if test="pxcx != null">#{pxcx},</if>
  92. <if test="coachnum != null">#{coachnum},</if>
  93. <if test="status != null">#{status},</if>
  94. </trim>
  95. </insert>
  96. <update id="updateUserInfo" parameterType="UserInfo">
  97. update user_info
  98. <trim prefix="SET" suffixOverrides=",">
  99. <if test="name != null">name = #{name},</if>
  100. <if test="sex != null">sex = #{sex},</if>
  101. <if test="sfzmlx != null">sfzmlx = #{sfzmlx},</if>
  102. <if test="idCard != null">id_card = #{idCard},</if>
  103. <if test="crdate != null">crdate = #{crdate},</if>
  104. <if test="birthday != null">birthday = #{birthday},</if>
  105. <if test="mobile != null">mobile = #{mobile},</if>
  106. <if test="password != null">password = #{password},</if>
  107. <if test="wechar != null">wechar = #{wechar},</if>
  108. <if test="openid != null">openid = #{openid},</if>
  109. <if test="inscode != null">inscode = #{inscode},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="schoolClassTypeId != null">school_class_type_id = #{schoolClassTypeId},</if>
  112. <if test="updateTime != null">update_time = #{updateTime},</if>
  113. <if test="pxcx != null">pxcx = #{pxcx},</if>
  114. <if test="coachnum != null">coachnum = #{coachnum},</if>
  115. <if test="status != null">status = #{status},</if>
  116. </trim>
  117. where id = #{id}
  118. </update>
  119. <delete id="deleteUserInfoById" parameterType="Long">
  120. delete from user_info where id = #{id}
  121. </delete>
  122. <delete id="deleteUserInfoByIds" parameterType="String">
  123. delete from user_info where id in
  124. <foreach item="id" collection="array" open="(" separator="," close=")">
  125. #{id}
  126. </foreach>
  127. </delete>
  128. <select id="getMyRegistrationInformation" resultType="UserVo">
  129. SELECT
  130. u.name,
  131. u.mobile,
  132. DATE_FORMAT(u.create_time,'%Y-%m-%d %H:%i:%s') AS createDate,
  133. s.name as schoolName,
  134. sct.class_name as className,
  135. sct.price as classPrice
  136. FROM
  137. user_info u
  138. LEFT JOIN school_info s ON s.inscode = u.inscode
  139. LEFT JOIN school_info_class_type sct ON sct.id = u.school_class_type_id
  140. where u.id = #{userId}
  141. </select>
  142. </mapper>