mapper.shop.StoreMemberMapper.xml Maven / Gradle / Ivy
The newest version!
<?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.jblv.shop.mapper.StoreMemberMapper"> <resultMap type="StoreMember" id="StoreMemberResult"> <result property="id" column="id" /> <result property="vipNo" column="vip_no" /> <result property="openid" column="openid" /> <result property="phone" column="phone" /> <result property="password" column="password" /> <result property="nickname" column="nickname" /> <result property="headimg" column="headimg" /> <result property="sex" column="sex" /> <result property="level" column="level" /> <result property="totalAmount" column="total_amount" /> <result property="userMoney" column="user_money" /> <result property="distributMoney" column="distribut_money" /> <result property="frozenMoney" column="frozen_money" /> <result property="underlingNumber" column="underling_number" /> <result property="payPoints" column="pay_points" /> <result property="addressId" column="address_id" /> <result property="remark" column="remark" /> <result property="status" column="status" /> <result property="createTime" column="create_time" /> <result property="createAt" column="create_at" /> <result property="statusTime" column="status_time" /> </resultMap> <sql id="selectStoreMemberVo"> select id, vip_no, openid, phone, password, nickname, headimg, sex, level, total_amount, user_money, distribut_money, frozen_money, underling_number, pay_points, address_id, remark, status, create_time, create_at, status_time from store_member </sql> <select id="selectStoreMemberList" parameterType="StoreMember" resultMap="StoreMemberResult"> <include refid="selectStoreMemberVo"/> <where> <if test="openid != null and openid != ''"> and openid = #{openid}</if> <if test="phone != null and phone != ''"> and phone = #{phone}</if> <if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if> <if test="level != null "> and level = #{level}</if> </where> </select> <select id="selectStoreMemberById" parameterType="Long" resultMap="StoreMemberResult"> <include refid="selectStoreMemberVo"/> where id = #{id} </select> <insert id="insertStoreMember" parameterType="StoreMember" useGeneratedKeys="true" keyProperty="id"> insert into store_member <trim prefix="(" suffix=")" suffixOverrides=","> <if test="vipNo != null and vipNo != ''">vip_no,</if> <if test="openid != null and openid != ''">openid,</if> <if test="phone != null and phone != ''">phone,</if> <if test="password != null and password != ''">password,</if> <if test="nickname != null and nickname != ''">nickname,</if> <if test="headimg != null and headimg != ''">headimg,</if> <if test="sex != null and sex != ''">sex,</if> <if test="level != null ">level,</if> <if test="totalAmount != null ">total_amount,</if> <if test="userMoney != null ">user_money,</if> <if test="distributMoney != null ">distribut_money,</if> <if test="frozenMoney != null ">frozen_money,</if> <if test="underlingNumber != null ">underling_number,</if> <if test="payPoints != null ">pay_points,</if> <if test="addressId != null ">address_id,</if> <if test="remark != null and remark != ''">remark,</if> <if test="status != null ">status,</if> <if test="createTime != null ">create_time,</if> <if test="createAt != null ">create_at,</if> <if test="statusTime != null ">status_time,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="vipNo != null and vipNo != ''">#{vipNo},</if> <if test="openid != null and openid != ''">#{openid},</if> <if test="phone != null and phone != ''">#{phone},</if> <if test="password != null and password != ''">#{password},</if> <if test="nickname != null and nickname != ''">#{nickname},</if> <if test="headimg != null and headimg != ''">#{headimg},</if> <if test="sex != null and sex != ''">#{sex},</if> <if test="level != null ">#{level},</if> <if test="totalAmount != null ">#{totalAmount},</if> <if test="userMoney != null ">#{userMoney},</if> <if test="distributMoney != null ">#{distributMoney},</if> <if test="frozenMoney != null ">#{frozenMoney},</if> <if test="underlingNumber != null ">#{underlingNumber},</if> <if test="payPoints != null ">#{payPoints},</if> <if test="addressId != null ">#{addressId},</if> <if test="remark != null and remark != ''">#{remark},</if> <if test="status != null ">#{status},</if> <if test="createTime != null ">#{createTime},</if> <if test="createAt != null ">#{createAt},</if> <if test="statusTime != null ">#{statusTime},</if> </trim> </insert> <update id="updateStoreMember" parameterType="StoreMember"> update store_member <trim prefix="SET" suffixOverrides=","> <if test="vipNo != null and vipNo != ''">vip_no = #{vipNo},</if> <if test="openid != null and openid != ''">openid = #{openid},</if> <if test="phone != null and phone != ''">phone = #{phone},</if> <if test="password != null and password != ''">password = #{password},</if> <if test="nickname != null and nickname != ''">nickname = #{nickname},</if> <if test="headimg != null and headimg != ''">headimg = #{headimg},</if> <if test="sex != null and sex != ''">sex = #{sex},</if> <if test="level != null ">level = #{level},</if> <if test="totalAmount != null ">total_amount = #{totalAmount},</if> <if test="userMoney != null ">user_money = #{userMoney},</if> <if test="distributMoney != null ">distribut_money = #{distributMoney},</if> <if test="frozenMoney != null ">frozen_money = #{frozenMoney},</if> <if test="underlingNumber != null ">underling_number = #{underlingNumber},</if> <if test="payPoints != null ">pay_points = #{payPoints},</if> <if test="addressId != null ">address_id = #{addressId},</if> <if test="remark != null and remark != ''">remark = #{remark},</if> <if test="status != null ">status = #{status},</if> <if test="createTime != null ">create_time = #{createTime},</if> <if test="createAt != null ">create_at = #{createAt},</if> <if test="statusTime != null ">status_time = #{statusTime},</if> </trim> where id = #{id} </update> <delete id="deleteStoreMemberById" parameterType="Long"> delete from store_member where id = #{id} </delete> <delete id="deleteStoreMemberByIds" parameterType="String"> delete from store_member where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>