123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.juxiao.xchat.module.xbd.mapper.users.UserBankCardMapper" >
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="bank_card" property="bankCard" jdbcType="VARCHAR" />
- <result column="bank_card_name" property="bankCardName" jdbcType="VARCHAR" />
- <result column="open_bank_code" property="openBankCode" jdbcType="VARCHAR" />
- <result column="is_use" property="isUse" jdbcType="BIT" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, uid, bank_card, bank_card_name, open_bank_code, is_use, create_time
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from user_bank_card
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from user_bank_card
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into user_bank_card (uid, bank_card, bank_card_name,
- open_bank_code, is_use, create_time
- )
- values (#{uid,jdbcType=BIGINT}, #{bankCard,jdbcType=VARCHAR}, #{bankCardName,jdbcType=VARCHAR},
- #{openBankCode,jdbcType=VARCHAR}, #{isUse,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into user_bank_card
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- uid,
- </if>
- <if test="bankCard != null" >
- bank_card,
- </if>
- <if test="bankCardName != null" >
- bank_card_name,
- </if>
- <if test="openBankCode != null" >
- open_bank_code,
- </if>
- <if test="isUse != null" >
- is_use,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="bankCard != null" >
- #{bankCard,jdbcType=VARCHAR},
- </if>
- <if test="bankCardName != null" >
- #{bankCardName,jdbcType=VARCHAR},
- </if>
- <if test="openBankCode != null" >
- #{openBankCode,jdbcType=VARCHAR},
- </if>
- <if test="isUse != null" >
- #{isUse,jdbcType=BIT},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
- update user_bank_card
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="bankCard != null" >
- bank_card = #{bankCard,jdbcType=VARCHAR},
- </if>
- <if test="bankCardName != null" >
- bank_card_name = #{bankCardName,jdbcType=VARCHAR},
- </if>
- <if test="openBankCode != null" >
- open_bank_code = #{openBankCode,jdbcType=VARCHAR},
- </if>
- <if test="isUse != null" >
- is_use = #{isUse,jdbcType=BIT},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
- update user_bank_card
- set uid = #{uid,jdbcType=BIGINT},
- bank_card = #{bankCard,jdbcType=VARCHAR},
- bank_card_name = #{bankCardName,jdbcType=VARCHAR},
- open_bank_code = #{openBankCode,jdbcType=VARCHAR},
- is_use = #{isUse,jdbcType=BIT},
- create_time = #{createTime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <select id="selectByUsersBankCardQuery" resultType="com.juxiao.xchat.module.xbd.vo.UsersBankCardVO">
- SELECT bc.id, bc.uid, bc.bank_card as bankCard, bc.bank_card_name as bankCardName, bc.open_bank_code as openBankCode, bc.is_use as isUse, u.erban_no as erbanNo, u.nick,bc.create_time as createTime
- from user_bank_card bc
- INNER JOIN users u on bc.uid = u.uid
- <where> 1 = 1
- <if test="uidList != null">
- and u.erban_no in
- <foreach collection="uidList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="bankCode != null and bankCode !=''">
- and bc.open_bank_code = #{bankCode}
- </if>
- </where>
- ORDER BY bc.create_time desc
- </select>
- <select id="selectByUidOrBankCode" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from user_bank_card
- where uid = #{uid} and open_bank_code = #{bankCode}
- </select>
- <select id="selectByUidOrIsUse" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from user_bank_card
- where uid = #{uid} and is_use = #{isUse}
- </select>
- <select id="selectByUid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from user_bank_card
- where uid = #{uid}
- </select>
- <update id="updateIsUseByUid">
- update user_bank_card set is_use = #{isUse} where uid = #{uid}
- </update>
- <select id="selectUsersUseBankCard" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from user_bank_card
- where uid = #{uid} and is_use = 1
- </select>
- </mapper>
|