微信网页登录

This commit is contained in:
starrySky
2024-04-09 10:17:49 +08:00
parent b2f6921ef1
commit e8b6c8e0aa
128 changed files with 2861 additions and 4243 deletions

View File

@@ -0,0 +1,92 @@
package com.starry.admin.modules.custom.controller;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import com.starry.common.annotation.Log;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 顾客Controller
*
* @author admin
* @since 2024-04-08
*/
@RestController
@RequestMapping("/play/info")
public class PlayCustomUserInfoController {
@Resource
private IPlayCustomUserInfoService playCustomUserInfoService;
/**
* 查询顾客列表
*/
@PreAuthorize("@customSs.hasPermission('play:info:list')")
@GetMapping("/list")
public R list(PlayCustomUserInfoEntity playCustomUserInfo) {
IPage<PlayCustomUserInfoEntity> list = playCustomUserInfoService.selectPlayCustomUserInfoByPage(playCustomUserInfo);
return R.ok(list);
}
/**
* 获取顾客详细信息
*/
@PreAuthorize("@customSs.hasPermission('play:info:query')")
@GetMapping(value = "/{id}")
public R getInfo(@PathVariable("id") String id) {
return R.ok(playCustomUserInfoService.selectPlayCustomUserInfoById(id));
}
/**
* 新增顾客
*/
@PreAuthorize("@customSs.hasPermission('play:info:create')")
@Log(title = "顾客", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
boolean success = playCustomUserInfoService.create(playCustomUserInfo);
if (success) {
return R.ok();
}
return R.error("添加失败");
}
/**
* 修改顾客
*/
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
@Log(title = "顾客", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update/{id}")
public R update(@PathVariable String id, @RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
playCustomUserInfo.setId(id);
boolean success = playCustomUserInfoService.update(playCustomUserInfo);
if (success) {
return R.ok();
}
return R.error("修改失败");
}
/**
* 删除顾客
*/
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
@Log(title = "顾客", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R remove(@PathVariable String[] ids) {
return R.ok(playCustomUserInfoService.deletePlayCustomUserInfoByIds(ids));
}
}

View File

@@ -0,0 +1,16 @@
package com.starry.admin.modules.custom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
/**
* 顾客Mapper接口
*
* @author admin
* @since 2024-04-08
*/
public interface PlayCustomUserInfoMapper extends BaseMapper<PlayCustomUserInfoEntity> {
}

View File

@@ -0,0 +1,150 @@
package com.starry.admin.modules.custom.module.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.starry.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 顾客对象 play_custom_user_info
*
* @author admin
* @since 2024-04-08
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("play_custom_user_info")
public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntity> {
/**
* UUID
*/
private String id;
/**
* 租户ID
*/
private String tenantId;
/**
* 用户的标识,对当前公众号唯一
*/
private String openid;
/**
* 用户的标识,对当前公众号唯一
*/
private String unionid;
/**
* 店员昵称
*/
private String nickname;
/**
* 店员性别0:位置;1:男,2:女)
*/
private Integer sex;
/**
* 头像
*/
private String avatar;
/**
* 电话号码
*/
private String phone;
/**
* 等级
*/
private String levelId;
/**
* 所在国家
*/
private String country;
/**
* 所在省份
*/
private String province;
/**
* 所在城市
*/
private String city;
/**
* 账户余额(单位分)
*/
private String accountBalance;
/**
* 余额状态[0:不存在余额1:存在余额]
*/
private String accountState;
/**
* 关注状态[0:未关注1:已关注]
*/
private String subscribeState;
/**
* 黑名单状态[0:黑名单1:非黑名单]
*/
private String blacklistState;
/**
* 违规状态[0:违规,1:未违规]
*/
private String violationState;
/**
* 是否下单状态[0:未未下单1:下单过]
*/
private String purchaseState;
/**
* 绑定手机状态[0:未绑定,1:绑定]
*/
private String mobilePhoneState;
/**
* 注册时间
*/
private Date registrationTime;
/**
* 上次登录时间
*/
private Date lastLoginTime;
/**
* 首次下单时间
*/
private Date firstPurchaseTime;
/**
* 最后一次下单时间
*/
private Date lastPurchaseTime;
/**
* 备注
*/
private String remark;
/**
* 最近一次登录token
*/
@JsonIgnore
private String token;
}

View File

@@ -0,0 +1,72 @@
package com.starry.admin.modules.custom.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
/**
* 顾客Service接口
*
* @author admin
* @since 2024-04-08
*/
public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoEntity> {
/**
* 查询顾客
*
* @param openId 顾客主键
* @return 顾客
*/
PlayCustomUserInfoEntity selectByOpenid(String openId);
/**
* 查询顾客
*
* @param id 顾客主键
* @return 顾客
*/
PlayCustomUserInfoEntity selectPlayCustomUserInfoById(String id);
/**
* 查询顾客列表
*
* @param playCustomUserInfo 顾客
* @return 顾客集合
*/
IPage<PlayCustomUserInfoEntity> selectPlayCustomUserInfoByPage(PlayCustomUserInfoEntity playCustomUserInfo);
/**
* 新增顾客
*
* @param playCustomUserInfo 顾客
* @return 结果
*/
boolean create(PlayCustomUserInfoEntity playCustomUserInfo);
/**
* 修改顾客
*
* @param playCustomUserInfo 顾客
* @return 结果
*/
boolean update(PlayCustomUserInfoEntity playCustomUserInfo);
/**
* 批量删除顾客
*
* @param ids 需要删除的顾客主键集合
* @return 结果
*/
int deletePlayCustomUserInfoByIds(String[] ids);
/**
* 删除顾客信息
*
* @param id 顾客主键
* @return 结果
*/
int deletePlayCustomUserInfoById(String id);
}

View File

@@ -0,0 +1,105 @@
package com.starry.admin.modules.custom.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.starry.admin.modules.custom.mapper.PlayCustomUserInfoMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
/**
* 顾客Service业务层处理
*
* @author admin
* @since 2024-04-08
*/
@Service
public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInfoMapper, PlayCustomUserInfoEntity> implements IPlayCustomUserInfoService {
@Resource
private PlayCustomUserInfoMapper playCustomUserInfoMapper;
@Override
public PlayCustomUserInfoEntity selectByOpenid(String openId) {
LambdaQueryWrapper<PlayCustomUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getOpenid, openId);
return this.baseMapper.selectOne(lambdaQueryWrapper);
}
/**
* 查询顾客
*
* @param id 顾客主键
* @return 顾客
*/
@Override
public PlayCustomUserInfoEntity selectPlayCustomUserInfoById(String id) {
return this.baseMapper.selectById(id);
}
/**
* 查询顾客列表
*
* @param playCustomUserInfo 顾客
* @return 顾客
*/
@Override
public IPage<PlayCustomUserInfoEntity> selectPlayCustomUserInfoByPage(PlayCustomUserInfoEntity playCustomUserInfo) {
Page<PlayCustomUserInfoEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
}
/**
* 新增顾客
*
* @param playCustomUserInfo 顾客
* @return 结果
*/
@Override
public boolean create(PlayCustomUserInfoEntity playCustomUserInfo) {
if (StrUtil.isBlankIfStr(playCustomUserInfo.getId())) {
playCustomUserInfo.setId(IdUtil.fastSimpleUUID());
}
return save(playCustomUserInfo);
}
/**
* 修改顾客
*
* @param playCustomUserInfo 顾客
* @return 结果
*/
@Override
public boolean update(PlayCustomUserInfoEntity playCustomUserInfo) {
return updateById(playCustomUserInfo);
}
/**
* 批量删除顾客
*
* @param ids 需要删除的顾客主键
* @return 结果
*/
@Override
public int deletePlayCustomUserInfoByIds(String[] ids) {
return playCustomUserInfoMapper.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除顾客信息
*
* @param id 顾客主键
* @return 结果
*/
@Override
public int deletePlayCustomUserInfoById(String id) {
return playCustomUserInfoMapper.deleteById(id);
}
}