添加“member”相关CRUD代码
This commit is contained in:
parent
a3ba944745
commit
81003d6d16
20
src/main/java/com/ycwl/basic/mapper/pc/MemberMapper.java
Normal file
20
src/main/java/com/ycwl/basic/mapper/pc/MemberMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.broker.entity.BrokerEntity;
|
||||
import com.ycwl.basic.model.pc.broker.req.BrokerReqQuery;
|
||||
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
||||
import com.ycwl.basic.model.pc.member.req.MemberReqQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:57
|
||||
*/
|
||||
public interface MemberMapper {
|
||||
List<MemberEntity> list(MemberReqQuery memberReqQuery);
|
||||
MemberEntity getById(Long id);
|
||||
int add(MemberEntity member);
|
||||
int deleteById(Long id);
|
||||
int update(MemberEntity member);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.ycwl.basic.model.pc.member.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:59
|
||||
*/
|
||||
@Data
|
||||
@TableName("member")
|
||||
public class MemberEntity {
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
private String openId;
|
||||
/**
|
||||
* 微信昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
private String realName;
|
||||
/**
|
||||
* 推客优惠码
|
||||
*/
|
||||
private String promoCode;
|
||||
/**
|
||||
* 推客id
|
||||
*/
|
||||
private Long brokerId;
|
||||
/**
|
||||
* 是否同意用户协议,1同意0未同意
|
||||
*/
|
||||
private Integer agreement;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
private Date createDate;
|
||||
private Date updateAt;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.ycwl.basic.model.pc.member.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:59
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("查询用户列表请求参数")
|
||||
public class MemberReqQuery {
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
@ApiModelProperty("微信openId")
|
||||
private String openId;
|
||||
/**
|
||||
* 微信昵称
|
||||
*/
|
||||
@ApiModelProperty("微信昵称")
|
||||
private String nickname;
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
/**
|
||||
* 推客优惠码
|
||||
*/
|
||||
@ApiModelProperty("推客优惠码")
|
||||
private String promoCode;
|
||||
/**
|
||||
* 推客id
|
||||
*/
|
||||
@ApiModelProperty("推客id")
|
||||
private Long brokerId;
|
||||
/**
|
||||
* 是否同意用户协议,1同意0未同意
|
||||
*/
|
||||
@ApiModelProperty("是否同意用户协议,1同意0未同意")
|
||||
private Integer agreement;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
@ApiModelProperty("电话号码")
|
||||
private String phone;
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
@ApiModelProperty("国家")
|
||||
private String country;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@ApiModelProperty("省份")
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@ApiModelProperty("城市")
|
||||
private String city;
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date startTime;
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date endTime;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.ycwl.basic.model.pc.member.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:59
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("查询用户信息响应参数")
|
||||
public class MemberRespVO {
|
||||
private Long id;
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
@ApiModelProperty("微信openId")
|
||||
private String openId;
|
||||
/**
|
||||
* 微信昵称
|
||||
*/
|
||||
@ApiModelProperty("微信昵称")
|
||||
private String nickname;
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
/**
|
||||
* 推客优惠码
|
||||
*/
|
||||
@ApiModelProperty("推客优惠码")
|
||||
private String promoCode;
|
||||
/**
|
||||
* 推客id
|
||||
*/
|
||||
@ApiModelProperty("推客id")
|
||||
private Long brokerId;
|
||||
/**
|
||||
* 是否同意用户协议,1同意0未同意
|
||||
*/
|
||||
@ApiModelProperty("是否同意用户协议,1同意0未同意")
|
||||
private Integer agreement;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
@ApiModelProperty("电话号码")
|
||||
private String phone;
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
@ApiModelProperty("国家")
|
||||
private String country;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@ApiModelProperty("省份")
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@ApiModelProperty("城市")
|
||||
private String city;
|
||||
private Date createDate;
|
||||
private Date updateAt;
|
||||
}
|
88
src/main/resources/mapper/pc/MemberMapper.xml
Normal file
88
src/main/resources/mapper/pc/MemberMapper.xml
Normal 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>
|
Loading…
x
Reference in New Issue
Block a user