MgrUserMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE mapper
  2. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.bosshand.virgo.core.dao.MgrUserDao">
  5. <resultMap type="com.bosshand.virgo.core.model.MgrUser" id="MgrUserResult" >
  6. <id column="id" property="id"/>
  7. <result column="name" property="name"/>
  8. <result column="sex" property="sex"/>
  9. <result column="phone" property="phone"/>
  10. <result column="pwd" property="pwd"/>
  11. <result column="email" property="email"/>
  12. <result column="portrait" property="portrait"/>
  13. <result column="create_time" property="createTime"/>
  14. <result column="rsonal_signature" property="rsonalSignature"/>
  15. <result column="id_card" property="idCard"/>
  16. <result column="practice_certificate" property="practiceCertificate"/>
  17. <result column="practice_seal" property="practiceSeal"/>
  18. <result column="status" property="status"/>
  19. <result column="lastOrganizationId" property="lastOrganizationId"/>
  20. <result column="lastProjectId" property="lastProjectId"/>
  21. </resultMap>
  22. <select id="getById" resultMap="MgrUserResult">
  23. select * from mgr_user where id = #{id} limit 1
  24. </select>
  25. <select id="getByPhone" resultMap="MgrUserResult">
  26. select * from mgr_user where phone = #{phone} limit 1
  27. </select>
  28. <select id="getUserByPhone" resultType="com.bosshand.virgo.core.model.MgrUser">
  29. SELECT * FROM mgr_user where phone=#{phone}
  30. </select>
  31. <select id="getIds" parameterType="list" resultType="com.bosshand.virgo.core.model.MgrUser">
  32. select * from mgr_user
  33. <trim>
  34. <if test="list.size > 0">
  35. where id in (
  36. <foreach collection="list" item="item" index="index" separator=",">
  37. #{item}
  38. </foreach>
  39. )
  40. </if>
  41. <if test="list.size = 0">
  42. where 1=0
  43. </if>
  44. </trim>
  45. </select>
  46. <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrUser" useGeneratedKeys="true" keyProperty="id">
  47. INSERT into mgr_user(name, sex, phone, email, portrait, create_time, rsonal_signature, id_card, practice_certificate, practice_seal)
  48. values(#{name}, #{sex}, #{phone}, #{email}, #{portrait}, #{createTime}, #{rsonalSignature}, #{idCard}, #{practiceCertificate}, #{practiceSeal})
  49. </insert>
  50. <delete id="delete">
  51. DELETE from mgr_user where id = #{id}
  52. </delete>
  53. <update id="updateLastOrganizationId" parameterType="com.bosshand.virgo.core.model.MgrUser">
  54. UPDATE mgr_user set lastOrganizationId = #{lastOrganizationId} WHERE id=#{id}
  55. </update>
  56. <update id="updateLastProjectId" parameterType="com.bosshand.virgo.core.model.MgrUser">
  57. UPDATE mgr_user set lastProjectId = #{lastProjectId} WHERE id=#{id}
  58. </update>
  59. <update id="updateLastIdentityId" parameterType="com.bosshand.virgo.core.model.MgrUser">
  60. UPDATE mgr_user set lastIdentityId = #{lastIdentityId} WHERE id=#{id}
  61. </update>
  62. <update id="update" parameterType="com.bosshand.virgo.core.model.MgrUser">
  63. UPDATE mgr_user
  64. <trim prefix="set" suffixOverrides=",">
  65. <if test="id!=0">id=#{id},</if>
  66. <if test="name!=null">name=#{name},</if>
  67. <if test="sex!=null">sex=#{sex},</if>
  68. <if test="phone!=null">phone=#{phone},</if>
  69. <if test="email!=null">email=#{email},</if>
  70. <if test="portrait!=null">portrait=#{portrait},</if>
  71. <if test="face!=null">face=#{face},</if>
  72. <if test="faceStatus!=0">faceStatus=#{faceStatus},</if>
  73. <if test="lastOrganizationId!=0">lastOrganizationId=#{lastOrganizationId},</if>
  74. <if test="lastProjectId!=0">lastProjectId=#{lastProjectId},</if>
  75. <if test="rsonalSignature!=null">rsonal_signature=#{rsonalSignature},</if>
  76. <if test="idCard!=null">id_card=#{idCard},</if>
  77. <if test="practiceCertificate!=null">practice_certificate=#{practiceCertificate},</if>
  78. <if test="practiceSeal!=null">practice_seal=#{practiceSeal},</if>
  79. </trim>
  80. WHERE id=#{id}
  81. </update>
  82. <update id="updatePhone" parameterType="com.bosshand.virgo.core.model.MgrUser">
  83. UPDATE mgr_user SET phone = #{phone} where id =#{id}
  84. </update>
  85. <update id="updatePwd" parameterType="com.bosshand.virgo.core.model.MgrUser">
  86. UPDATE mgr_user SET pwd = #{pwd} where id =#{id}
  87. </update>
  88. <update id="banUser" parameterType="com.bosshand.virgo.core.model.MgrUser">
  89. UPDATE mgr_user set status = #{status} WHERE id=#{id}
  90. </update>
  91. <update id="checkFace" parameterType="com.bosshand.virgo.core.model.MgrUser">
  92. UPDATE mgr_user SET faceStatus = 1 where id =#{id}
  93. </update>
  94. </mapper>