feat(后台管理): 会员模块

会员列表开发完成
master
waynaqua 4 years ago
parent c0fe5bd03b
commit 4248265e34

@ -22,7 +22,7 @@
<properties>
<java.version>1.8</java.version>
<druid.version>1.1.14</druid.version>
<druid.version>1.1.23</druid.version>
<mybatis-plus.version>3.3.2</mybatis-plus.version>
<commons.io.version>2.5</commons.io.version>
<commons.collections.version>3.2.2</commons.collections.version>

@ -0,0 +1,42 @@
package com.wayn.admin.api.controller.shop;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.admin.api.domain.shop.Goods;
import com.wayn.admin.api.domain.shop.Member;
import com.wayn.admin.api.service.shop.IMemberService;
import com.wayn.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wayn.common.base.BaseController;
/**
* <p>
*
* </p>
*
* @author wayn
* @since 2020-07-21
*/
@RestController
@RequestMapping("shop/member")
public class MemberController extends BaseController {
@Autowired
private IMemberService iMemberService;
@GetMapping("list")
public R list(Member member) {
Page<Member> page = getPage();
return R.success().add("page", iMemberService.listPage(page, member));
}
@GetMapping("{memberId}")
public R getMember(@PathVariable Long memberId) {
return R.success().add("data", iMemberService.getById(memberId));
}
}

@ -0,0 +1,110 @@
package com.wayn.admin.api.domain.shop;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.wayn.common.base.ShopBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.LocalDateTimeTypeHandler;
import org.apache.ibatis.type.LocalDateTypeHandler;
/**
* <p>
*
* </p>
*
* @author wayn
* @since 2020-07-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "shop_member")
public class Member extends ShopBaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
private String username;
/**
*
*/
private String password;
/**
* 0 1 1
*/
private Integer gender;
/**
*
*/
private LocalDate birthday;
/**
*
*/
private LocalDateTime lastLoginTime;
/**
* IP
*/
private String lastLoginIp;
/**
* 0 1 VIP2 VIP
*/
private Integer userLevel;
/**
*
*/
private String nickname;
/**
*
*/
private String mobile;
/**
*
*/
private String avatar;
/**
* openid
*/
private String weixinOpenid;
/**
* KEY
*/
private String sessionKey;
/**
* 0 , 1 , 2
*/
private Integer status;
/**
* 0 1
*/
private Boolean delFlag;
}

@ -0,0 +1,21 @@
package com.wayn.admin.api.mapper.shop;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.admin.api.domain.shop.Goods;
import com.wayn.admin.api.domain.shop.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author wayn
* @since 2020-07-21
*/
public interface MemberMapper extends BaseMapper<Member> {
IPage<Member> selectMemberListPage(Page<Member> page, Member member);
}

@ -0,0 +1,30 @@
package com.wayn.admin.api.service.impl.shop;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.admin.api.domain.shop.Member;
import com.wayn.admin.api.mapper.shop.MemberMapper;
import com.wayn.admin.api.service.shop.IMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author wayn
* @since 2020-07-21
*/
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements IMemberService {
@Autowired
private MemberMapper memberMapper;
@Override
public IPage<Member> listPage(Page<Member> page, Member member) {
return memberMapper.selectMemberListPage(page,member);
}
}

@ -0,0 +1,28 @@
package com.wayn.admin.api.service.shop;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.admin.api.domain.shop.Banner;
import com.wayn.admin.api.domain.shop.Member;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author wayn
* @since 2020-07-21
*/
public interface IMemberService extends IService<Member> {
/**
*
*
* @param page
* @param member
* @return
*/
IPage<Member> listPage(Page<Member> page, Member member);
}

@ -0,0 +1,52 @@
<?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.wayn.admin.api.mapper.shop.MemberMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ShopMemberResult" type="com.wayn.admin.api.domain.shop.Member">
<result column="id" property="id" />
<result column="username" property="username" />
<result column="password" property="password" />
<result column="gender" property="gender" />
<result column="birthday" property="birthday"/>
<result column="last_login_time" property="lastLoginTime"/>
<result column="last_login_ip" property="lastLoginIp" />
<result column="user_level" property="userLevel" />
<result column="nickname" property="nickname" />
<result column="mobile" property="mobile" />
<result column="avatar" property="avatar" />
<result column="weixin_openid" property="weixinOpenid" />
<result column="session_key" property="sessionKey" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="del_flag" property="delFlag" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="selectMemberVo">
select id,
username, password, gender, birthday, last_login_time, last_login_ip, user_level, nickname, mobile, avatar, weixin_openid, session_key, status, create_time, update_time, del_flag
from shop_member
</sql>
<select id="selectMemberListPage" resultMap="ShopMemberResult">
<include refid="selectMemberVo"/>
<where>
del_flag = 0
<if test="member.id != null">
AND id like concat('%', #{member.id}, '%')
</if>
<if test="member.username != null and member.username != ''">
AND username like concat('%', #{member.username}, '%')
</if>
<if test="member.startTime != null and member.startTime != ''">
AND DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> DATE_FORMAT(#{member.startTime},'%Y-%m-%d')
</if>
<if test="member.endTime != null and member.endTime != ''">
AND DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> DATE_FORMAT(#{member.endTime},'%Y-%m-%d')
</if>
order by create_time desc
</where>
</select>
</mapper>
Loading…
Cancel
Save