parent
c0fe5bd03b
commit
4248265e34
@ -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,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…
Reference in New Issue