UserBankCardMapper.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.dao.UserBankCardDao">
  4. <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.UserBankCard">
  5. <result column="id_" property="id" />
  6. <result column="user_id_" property="userId" />
  7. <result column="name_" property="name" />
  8. <result column="bank_name_" property="bankName" />
  9. <result column="bank_card_" property="bankCard" />
  10. <result column="phone_" property="phone" />
  11. <result column="bank_code_" property="bankCode" />
  12. <result column="default_flag_" property="defaultFlag" />
  13. <result column="create_time_" property="createTime" />
  14. <result column="update_time_" property="updateTime" />
  15. </resultMap>
  16. <!-- 表字段 -->
  17. <sql id="baseColumns">
  18. t.id_ as id
  19. , t.user_id_ as userId
  20. , t.name_ as `name`
  21. , t.bank_name_ as bankName
  22. , t.bank_card_ as bankCard
  23. , t.phone_ as phone
  24. , t.bank_code_ as bankCode
  25. , t.default_flag_ as defaultFlag
  26. , t.create_time_ as createTime
  27. , t.update_time_ as updateTime
  28. , t.del_flag_ as delFlag
  29. </sql>
  30. <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.UserBankCardVo">
  31. SELECT
  32. <include refid="baseColumns"/>
  33. FROM user_bank_card t
  34. where t.del_flag_ = 0 and t.id_ = #{id}
  35. </select>
  36. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserBankCardVo">
  37. SELECT
  38. <include refid="baseColumns" />
  39. FROM user_bank_card t
  40. where t.del_flag_ = 0
  41. <if test="param.userId !=null">
  42. AND t.user_id_ = #{param.userId}
  43. </if>
  44. </select>
  45. <select id="getDefaultBankByUserId" resultType="com.yonge.cooleshow.biz.dal.vo.UserBankCardVo">
  46. SELECT
  47. <include refid="baseColumns"/>
  48. FROM user_bank_card t
  49. where t.del_flag_ = 0 and t.user_id_ = #{userId}
  50. order by default_flag_ desc,create_time_ desc
  51. limit 1
  52. </select>
  53. <select id="getBankByUserIdAndCardId" resultType="com.yonge.cooleshow.biz.dal.vo.UserBankCardVo">
  54. SELECT
  55. <include refid="baseColumns"/>
  56. FROM user_bank_card t
  57. where t.del_flag_ = 0
  58. and t.user_id_ = #{userId}
  59. and t.id_ = #{bankCardId}
  60. </select>
  61. <update id="deleteById">
  62. update user_bank_card set del_flag_ = 1 where id_ = #{id} and del_flag_ = 0
  63. </update>
  64. <update id="deleteByUserId">
  65. update user_bank_card set del_flag_ = 1 where user_id_ = #{userId} and del_flag_ = 0
  66. </update>
  67. </mapper>