SysUserIdcardMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.ruoyi.system.mapper.SysUserIdcardMapper">
  6. <resultMap type="SysUserIdcard" id="SysUserIdcardResult">
  7. <result property="userId" column="user_id" />
  8. <result property="idCard" column="id_card" />
  9. <result property="realName" column="real_name" />
  10. <result property="expirationDate" column="expiration_date" />
  11. <result property="phonenumber" column="phonenumber" />
  12. <result property="address" column="address" />
  13. <result property="front" column="front" />
  14. <result property="back" column="back" />
  15. <result property="delFlag" column="del_flag" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="remark" column="remark" />
  21. </resultMap>
  22. <sql id="selectSysUserIdcardVo">
  23. select user_id, id_card, real_name, expiration_date, phonenumber, address, front, back, del_flag, create_by, create_time, update_by, update_time, remark from sys_user_idcard
  24. </sql>
  25. <select id="selectSysUserIdcardList" parameterType="SysUserIdcard" resultMap="SysUserIdcardResult">
  26. <include refid="selectSysUserIdcardVo"/>
  27. <where>
  28. <if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
  29. <if test="expirationDate != null and expirationDate != ''"> and expiration_date = #{expirationDate}</if>
  30. <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
  31. <if test="address != null and address != ''"> and address = #{address}</if>
  32. <if test="front != null and front != ''"> and front = #{front}</if>
  33. <if test="back != null and back != ''"> and back = #{back}</if>
  34. </where>
  35. order by create_time
  36. </select>
  37. <select id="selectSysUserIdcardByUserId" parameterType="Long" resultMap="SysUserIdcardResult">
  38. <include refid="selectSysUserIdcardVo"/>
  39. where user_id = #{userId}
  40. </select>
  41. <select id="selectSysUserIdcardByIdCard" parameterType="string" resultMap="SysUserIdcardResult">
  42. <include refid="selectSysUserIdcardVo"/>
  43. where id_card = #{idCard} limit 1
  44. </select>
  45. <insert id="insertSysUserIdcard" parameterType="SysUserIdcard">
  46. insert into sys_user_idcard
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="userId != null">user_id,</if>
  49. <if test="idCard != null">id_card,</if>
  50. <if test="realName != null and realName != ''">real_name,</if>
  51. <if test="expirationDate != null and expirationDate != ''">expiration_date,</if>
  52. <if test="phonenumber != null">phonenumber,</if>
  53. <if test="address != null and address != ''">address,</if>
  54. <if test="front != null and front != ''">front,</if>
  55. <if test="back != null and back != ''">back,</if>
  56. <if test="delFlag != null">del_flag,</if>
  57. <if test="createBy != null">create_by,</if>
  58. <if test="updateBy != null">update_by,</if>
  59. <if test="updateTime != null">update_time,</if>
  60. <if test="remark != null">remark,</if>
  61. create_time
  62. </trim>
  63. <trim prefix="values (" suffix=")" suffixOverrides=",">
  64. <if test="userId != null">#{userId},</if>
  65. <if test="idCard != null">#{idCard},</if>
  66. <if test="realName != null and realName != ''">#{realName},</if>
  67. <if test="expirationDate != null and expirationDate != ''">#{expirationDate},</if>
  68. <if test="phonenumber != null">#{phonenumber},</if>
  69. <if test="address != null and address != ''">#{address},</if>
  70. <if test="front != null and front != ''">#{front},</if>
  71. <if test="back != null and back != ''">#{back},</if>
  72. <if test="delFlag != null">#{delFlag},</if>
  73. <if test="createBy != null">#{createBy},</if>
  74. <if test="updateBy != null">#{updateBy},</if>
  75. <if test="updateTime != null">#{updateTime},</if>
  76. <if test="remark != null">#{remark},</if>
  77. sysdate()
  78. </trim>
  79. </insert>
  80. <update id="updateSysUserIdcard" parameterType="SysUserIdcard">
  81. update sys_user_idcard
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="idCard != null">id_card = #{idCard},</if>
  84. <if test="realName != null and realName != ''">real_name = #{realName},</if>
  85. <if test="expirationDate != null and expirationDate != ''">expiration_date = #{expirationDate},</if>
  86. <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
  87. <if test="address != null and address != ''">address = #{address},</if>
  88. <if test="front != null and front != ''">front = #{front},</if>
  89. <if test="back != null and back != ''">back = #{back},</if>
  90. <if test="delFlag != null">del_flag = #{delFlag},</if>
  91. <if test="createBy != null">create_by = #{createBy},</if>
  92. <if test="createTime != null">create_time = #{createTime},</if>
  93. <if test="updateBy != null">update_by = #{updateBy},</if>
  94. <if test="updateTime != null">update_time = #{updateTime},</if>
  95. <if test="remark != null">remark = #{remark},</if>
  96. </trim>
  97. where user_id = #{userId}
  98. </update>
  99. <delete id="deleteSysUserIdcardByUserId" parameterType="Long">
  100. delete from sys_user_idcard where user_id = #{userId}
  101. </delete>
  102. <delete id="deleteSysUserIdcardByUserIds" parameterType="String">
  103. delete from sys_user_idcard where user_id in
  104. <foreach item="userId" collection="array" open="(" separator="," close=")">
  105. #{userId}
  106. </foreach>
  107. </delete>
  108. </mapper>