添加“member”相关CRUD代码

This commit is contained in:
longbinbin
2024-11-29 16:22:35 +08:00
parent a3ba944745
commit 81003d6d16
5 changed files with 310 additions and 0 deletions

View File

@ -0,0 +1,88 @@
<?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.ycwl.basic.mapper.pc.MemberMapper">
<insert id="add">
insert into member(id, openid, nickname, real_name, promo_code, broker_id, agreement, phone, country, province, city)
values (#{id}, #{openid}, #{nickname}, #{realName}, #{promoCode}, #{brokerId}, #{agreement}, #{phone}, #{country}, #{province}, #{city})
</insert>
<update id="update">
update member
<set>
<if test="openid!= null and openid!= ''">
openid = #{openid},
</if>
<if test="nickname!= null and nickname!= ''">
nickname = #{nickname},
</if>
<if test="realName!= null and realName!= ''">
real_name = #{realName},
</if>
<if test="promoCode!= null and promoCode!= ''">
promo_code = #{promoCode},
</if>
<if test="brokerId!= null ">
broker_id = #{brokerId},
</if>
<if test="agreement!= null ">
agreement = #{agreement},
</if>
<if test="phone!= null and phone!= ''">
phone = #{phone},
</if>
<if test="country!= null and country!= ''">
country = #{country},
</if>
<if test="province!= null and province!= ''">
province = #{province},
</if>
<if test="city!= null and city!= ''">
city = #{city},
</if>
</set>
where id = #{id}
</update>
<delete id="deleteById">
delete from member where id = #{id}
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.member.entity.MemberEntity">
select id, openid, nickname, real_name, promo_code, broker_id, agreement, phone, country, province, city
from member
<where>
<if test="openid!= null and openid!= ''">
and openid like concat('%',#{openid},'%')
</if>
<if test="nickname!= null and nickname!= ''">
and nickname like concat('%',#{nickname},'%')
</if>
<if test="realName!= null and realName!= ''">
and real_name like concat('%',#{realName},'%')
</if>
<if test="promoCode!= null and promoCode!= ''">
and promo_code = #{promoCode}
</if>
<if test="brokerId!= null ">
and broker_id = #{brokerId}
</if>
<if test="agreement!= null ">
and agreement = #{agreement}
</if>
<if test="phone!= null and phone!= ''">
and phone like concat('%',#{phone},'%')
</if>
<if test="country!= null and country!= ''">
and country = #{country}
</if>
<if test="province!= null and province!= ''">
and province = #{province}
</if>
<if test="city!= null and city!= ''">
and city = #{city}
</if>
</where>
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.member.entity.MemberEntity">
select id, openid, nickname, real_name, promo_code, broker_id, agreement, phone, country, province, city
from member
where id = #{id}
</select>
</mapper>