会员管理
parent
b815ee0374
commit
1a198a5ef0
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -54,7 +55,13 @@ public class ProductSpuBaseVO {
|
|||
@Schema(description = "排序字段", required = true, example = "1")
|
||||
@NotNull(message = "商品排序字段不能为空")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 商品状态
|
||||
*
|
||||
* 枚举 {@link ProductSpuStatusEnum}
|
||||
*/
|
||||
@Schema(description = "商品状态")
|
||||
private Integer status;
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "规格类型", required = true, example = "true")
|
||||
|
@ -97,7 +104,7 @@ public class ProductSpuBaseVO {
|
|||
private List<Long> giveCouponTemplateIds;
|
||||
|
||||
@Schema(description = "分销类型")
|
||||
@NotNull(message = "商品分销类型不能为空")
|
||||
// @NotNull(message = "商品分销类型不能为空")
|
||||
private Boolean subCommissionType;
|
||||
|
||||
@Schema(description = "活动展示顺序") // TODO 这块前端还未实现
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,11 +19,25 @@ public class ProductSpuPageRespVO {
|
|||
private String name;
|
||||
@Schema(description = "商品价格", example = "1")
|
||||
private Integer price;
|
||||
/**
|
||||
* 市场价,单位使用:分
|
||||
*
|
||||
* 基于其对应的 {@link ProductSkuDO#getMarketPrice()} sku单价最低的商品的
|
||||
*/
|
||||
@Schema(description = "市场价", example = "1")
|
||||
private Integer marketPrice;
|
||||
/**
|
||||
* 成本价,单位使用:分
|
||||
*
|
||||
* 基于其对应的 {@link ProductSkuDO#getCostPrice()} sku单价最低的商品的
|
||||
*/
|
||||
@Schema(description = "成本价", example = "1")
|
||||
private Integer costPrice;
|
||||
@Schema(description = "商品销量", example = "1")
|
||||
private Integer salesCount;
|
||||
@Schema(description = "商品排序", example = "1")
|
||||
@Schema(description = "库存", example = "1")
|
||||
private Integer stock;
|
||||
@Schema(description = "商品封面图", example = "1")
|
||||
@Schema(description = "商品排序", example = "1")
|
||||
private Integer sort;
|
||||
@Schema(description = "商品创建时间", example = "1")
|
||||
private LocalDateTime createTime;
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AdminUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||
|
||||
@Tag(name = "管理后台 - 用户个人中心")
|
||||
@RestController
|
||||
@RequestMapping("/member/user")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AdminUserController {
|
||||
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
@Resource
|
||||
private WxMaService wxMaService;
|
||||
|
||||
@PutMapping("/update-nickname")
|
||||
@Operation(summary = "修改用户昵称")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
public CommonResult<Boolean> updateUserNickname(@RequestParam("nickname") String nickname) {
|
||||
userService.updateUserNickname(getLoginUserId(), nickname);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/update-avatar")
|
||||
@Operation(summary = "修改用户头像")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw exception(FILE_IS_EMPTY);
|
||||
}
|
||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<AdminUserInfoRespVO> getUserInfo(Long id) {
|
||||
MemberUserDO user = userService.getUser(id);
|
||||
AdminUserInfoRespVO adminUserInfoRespVO = UserConvert.INSTANCE.convertAdmin(user);
|
||||
if(StringUtils.isNotEmpty(adminUserInfoRespVO.getProvinceId())){
|
||||
Integer[] areaId = new Integer[]{Integer.valueOf(adminUserInfoRespVO.getProvinceId()),Integer.valueOf(adminUserInfoRespVO.getCityId()),Integer.valueOf(adminUserInfoRespVO.getDistrictId())};
|
||||
adminUserInfoRespVO.setAreaId(areaId);
|
||||
}
|
||||
return success(UserConvert.INSTANCE.convertAdmin(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param queryDTO
|
||||
* @return
|
||||
* @author perry
|
||||
* @date 2018/7/13 23:46
|
||||
*/
|
||||
@PostMapping(value = "page")
|
||||
@Operation(summary = "获取会员列表")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<PageResult<AdminUserInfoRespVO>> findPageList(@RequestBody AdminUserQueryDTO queryDTO) {
|
||||
// 获得用户分页列表
|
||||
PageResult<MemberUserDO> pageResult = userService.findPageList(queryDTO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
// 返回空
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
// 拼接结果返回
|
||||
List<AdminUserInfoRespVO> userList = UserConvert.INSTANCE.convertList3(pageResult.getList());
|
||||
return success(new PageResult<>(userList, pageResult.getTotal()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author perry
|
||||
*/
|
||||
@Data
|
||||
public class AdminUserEditDTO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "用户id", example = "15601691300")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户手机号", example = "15601691300")
|
||||
private String mobile;
|
||||
@Schema(description = "用户昵称", example = "芋艿")
|
||||
private String nickname;
|
||||
/**
|
||||
* 帐号状态
|
||||
* <p>
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
@Schema(description = "帐号状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Schema(description = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Schema(description = "生日")
|
||||
private LocalDate userBirthday;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@Schema(description = "身份证号码")
|
||||
private String idCard;
|
||||
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@Schema(description = "省份")
|
||||
private String provinceId;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@Schema(description = "市")
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@Schema(description = "区")
|
||||
private String districtId;
|
||||
|
||||
@Schema(description = "省市区")
|
||||
private Integer[] areaId;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@Schema(description = "地址")
|
||||
private String userAddress;
|
||||
|
||||
|
||||
/**
|
||||
* 出行最关注
|
||||
*/
|
||||
@Schema(description = "出行最关注")
|
||||
private String travelFollow;
|
||||
/**
|
||||
* 出行目的
|
||||
*/
|
||||
@Schema(description = "出行目的")
|
||||
private String travelPurpose;
|
||||
/**
|
||||
* 性格特征
|
||||
*/
|
||||
@Schema(description = "性格特征")
|
||||
private String characterFeatures;
|
||||
/**
|
||||
* 健康状况
|
||||
*/
|
||||
@Schema(description = "健康状况")
|
||||
private String healthyStatus;
|
||||
/**
|
||||
* 出行要求
|
||||
*/
|
||||
@Schema(description = "出行要求")
|
||||
private String travelClaim;
|
||||
/**
|
||||
* 个人服务说明
|
||||
*/
|
||||
@Schema(description = "个人服务说明")
|
||||
private String personalServiceExplain;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 用户性别
|
||||
* <p>
|
||||
* 枚举类 {@link SexEnum}
|
||||
*/
|
||||
@Schema(description = "用户性别")
|
||||
private Integer sex;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AdminUserQueryDTO extends PageParam {
|
||||
@Schema(description = "用户手机号", example = "15601691300")
|
||||
private String mobile;
|
||||
@Schema(description = "用户昵称", example = "芋艿")
|
||||
private String nickname;
|
||||
/**
|
||||
* 帐号状态
|
||||
* <p>
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
@Schema(description = "帐号状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
* <p>
|
||||
* 枚举类 {@link SexEnum}
|
||||
*/
|
||||
@Schema(description = "用户性别")
|
||||
private Integer sex;
|
||||
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Schema(description = "真实姓名")
|
||||
private String realName;
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author perry
|
||||
*/
|
||||
@Schema(description = "用户 APP - 用户个人信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AdminUserInfoRespVO {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户头像", example = "/infra/file/get/35a12e57-4297-4faa-bf7d-7ed2f211c952")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "用户手机号", example = "15601691300")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
* <p>
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
@Schema(description = "帐号状态")
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 注册 IP
|
||||
*/
|
||||
@Schema(description = "注册 IP")
|
||||
private String registerIp;
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
@Schema(description = "最后登录IP")
|
||||
private String loginIp;
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@Schema(description = "最后登录时间")
|
||||
private LocalDateTime loginDate;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Schema(description = "用户账号")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
* <p>
|
||||
* 枚举类 {@link SexEnum}
|
||||
*/
|
||||
@Schema(description = "用户性别")
|
||||
private Integer sex;
|
||||
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Schema(description = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Schema(description = "生日")
|
||||
private LocalDate userBirthday;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@Schema(description = "身份证号码")
|
||||
private String idCard;
|
||||
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@Schema(description = "省份")
|
||||
private String provinceId;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@Schema(description = "市")
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@Schema(description = "区")
|
||||
private String districtId;
|
||||
|
||||
@Schema(description = "省市区")
|
||||
private Integer[] areaId;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@Schema(description = "地址")
|
||||
private String userAddress;
|
||||
|
||||
|
||||
/**
|
||||
* 出行最关注
|
||||
*/
|
||||
@Schema(description = "出行最关注")
|
||||
private String travelFollow;
|
||||
/**
|
||||
* 出行目的
|
||||
*/
|
||||
@Schema(description = "出行目的")
|
||||
private String travelPurpose;
|
||||
/**
|
||||
* 性格特征
|
||||
*/
|
||||
@Schema(description = "性格特征")
|
||||
private String characterFeatures;
|
||||
/**
|
||||
* 健康状况
|
||||
*/
|
||||
@Schema(description = "健康状况")
|
||||
private String healthyStatus;
|
||||
/**
|
||||
* 出行要求
|
||||
*/
|
||||
@Schema(description = "出行要求")
|
||||
private String travelClaim;
|
||||
/**
|
||||
* 个人服务说明
|
||||
*/
|
||||
@Schema(description = "个人服务说明")
|
||||
private String personalServiceExplain;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
@Schema(description = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.member.convert.user;
|
||||
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AdminUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -14,9 +15,11 @@ public interface UserConvert {
|
|||
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||
|
||||
AppUserInfoRespVO convert(MemberUserDO bean);
|
||||
|
||||
AdminUserInfoRespVO convertAdmin(MemberUserDO bean);
|
||||
MemberUserRespDTO convert2(MemberUserDO bean);
|
||||
|
||||
List<MemberUserRespDTO> convertList2(List<MemberUserDO> list);
|
||||
|
||||
List<AdminUserInfoRespVO> convertList3(List<MemberUserDO> list);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package cn.iocoder.yudao.module.member.dal.mysql.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -23,5 +25,11 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
|
|||
return selectList(new LambdaQueryWrapperX<MemberUserDO>()
|
||||
.likeIfPresent(MemberUserDO::getNickname, nickname));
|
||||
}
|
||||
|
||||
default PageResult<MemberUserDO> selectPage(AdminUserQueryDTO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberUserDO>()
|
||||
.likeIfPresent(MemberUserDO::getMobile, reqVO.getMobile())
|
||||
.likeIfPresent(MemberUserDO::getNickname,reqVO.getNickname())
|
||||
.eqIfPresent(MemberUserDO::getStatus,reqVO.getStatus())
|
||||
.orderByDesc(MemberUserDO::getId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package cn.iocoder.yudao.module.member.service.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
|
||||
|
@ -96,4 +98,15 @@ public interface MemberUserService {
|
|||
*/
|
||||
boolean isPasswordMatch(String rawPassword, String encodedPassword);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryDTO
|
||||
* @return
|
||||
* @author perry
|
||||
* @date 2018/7/13 23:46
|
||||
*/
|
||||
PageResult<MemberUserDO> findPageList(AdminUserQueryDTO queryDTO);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.member.service.user;
|
|||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||
|
@ -144,7 +146,19 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
public boolean isPasswordMatch(String rawPassword, String encodedPassword) {
|
||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryDTO
|
||||
* @return
|
||||
* @author perry
|
||||
* @date 2018/7/13 23:46
|
||||
*/
|
||||
@Override
|
||||
public PageResult<MemberUserDO> findPageList(AdminUserQueryDTO queryDTO) {
|
||||
PageResult<MemberUserDO> commonLableEntityList = memberUserMapper.selectPage(queryDTO);
|
||||
return commonLableEntityList;
|
||||
}
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
|
|
|
@ -44,34 +44,31 @@ spring:
|
|||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
name: ruoyi-vue-pro-v2
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
|
||||
name: cyywl
|
||||
url: jdbc:mysql://117.33.142.185:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 123456
|
||||
password: axzsd110
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
slave: # 模拟从库,可根据自己需要修改
|
||||
name: ruoyi-vue-pro-v2
|
||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
# slave: # 模拟从库,可根据自己需要修改
|
||||
# name: ruoyi-vue-pro-v2
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||
# # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例
|
||||
# username: root
|
||||
# password: 123456
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
# password: dev # 密码,建议生产环境开启
|
||||
host: 117.33.142.185 # 地址
|
||||
port: 6369 # 端口
|
||||
database: 6 # 数据库索引
|
||||
password: 20221122@dev # 密码,建议生产环境开启
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 创建用户
|
||||
export function createUser(data) {
|
||||
return request({
|
||||
url: '/member/user/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/member/user/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function deleteUser(id) {
|
||||
return request({
|
||||
url: '/member/user/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得用户
|
||||
export function getUser(id) {
|
||||
return request({
|
||||
url: '/member/user/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得用户分页
|
||||
export function getUserPage(query) {
|
||||
return request({
|
||||
url: '/member/user/page',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出用户 Excel
|
||||
export function exportUserExcel(query) {
|
||||
return request({
|
||||
url: '/member/user/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="用户昵称" prop="nickname">
|
||||
<el-input v-model="queryParams.nickname" placeholder="请输入用户昵称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['member:user:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['member:user:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="用户昵称" align="center" prop="nickname" />
|
||||
<el-table-column label="头像" align="center" prop="avatar" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="手机号" align="center" prop="mobile" />
|
||||
<el-table-column label="注册 IP" align="center" prop="registerIp" />
|
||||
<el-table-column label="最后登录IP" align="center" prop="loginIp" />
|
||||
<el-table-column label="最后登录时间" align="center" prop="loginDate" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.loginDate) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['member:user:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:user:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="用户昵称" prop="nickname">
|
||||
<el-input v-model="form.nickname" placeholder="请输入用户昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像" prop="avatar">
|
||||
<el-input v-model="form.avatar" placeholder="请输入头像" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="form.mobile" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="注册 IP" prop="registerIp">
|
||||
<el-input v-model="form.registerIp" placeholder="请输入注册 IP" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录IP" prop="loginIp">
|
||||
<el-input v-model="form.loginIp" placeholder="请输入最后登录IP" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录时间" prop="loginDate">
|
||||
<el-date-picker clearable v-model="form.loginDate" type="date" value-format="timestamp" placeholder="选择最后登录时间" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createUser, updateUser, deleteUser, getUser, getUserPage, exportUserExcel } from "@/api/member/user";
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 用户列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
nickname: null,
|
||||
avatar: null,
|
||||
status: null,
|
||||
mobile: null,
|
||||
password: null,
|
||||
registerIp: null,
|
||||
loginIp: null,
|
||||
loginDate: [],
|
||||
createTime: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
nickname: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
||||
avatar: [{ required: true, message: "头像不能为空", trigger: "blur" }],
|
||||
status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||
mobile: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
|
||||
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
|
||||
registerIp: [{ required: true, message: "注册 IP不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getUserPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
nickname: undefined,
|
||||
avatar: undefined,
|
||||
status: undefined,
|
||||
mobile: undefined,
|
||||
password: undefined,
|
||||
registerIp: undefined,
|
||||
loginIp: undefined,
|
||||
loginDate: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加用户";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getUser(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改用户";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除用户编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteUser(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportUserExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '用户.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue