Merge remote-tracking branch 'origin/master'
This commit is contained in:
1
pom.xml
1
pom.xml
@ -37,7 +37,6 @@
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.ruoyi.web.controller.wgz.controller;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserLongInReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppUserLongInRes;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* APP务工者Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Api(value = "APP务工者接口", tags = {"APP务工者接口管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/wgz/app")
|
||||
public class WgzAppController {
|
||||
|
||||
private final IWgzUserService iWgzUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询PC务工者列表
|
||||
*/
|
||||
@ApiOperation("APP务工者注册")
|
||||
@PreAuthorize("@ss.hasPermi('wgzApp:user:register')")
|
||||
@PostMapping("/wgzRegister")
|
||||
public AjaxResult userRegister(@Validated WgzAppUserRegisterReq bo) {
|
||||
return AjaxResult.success(iWgzUserService.userRegister(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询PC务工者列表
|
||||
*/
|
||||
@ApiOperation("APP务工者登录")
|
||||
@PreAuthorize("@ss.hasPermi('wgzApp:user:userLongIn')")
|
||||
@PostMapping("/wgzLongIn")
|
||||
public AjaxResult<WgzAppUserLongInRes> userLongIn(@Validated WgzAppUserLongInReq bo) {
|
||||
return AjaxResult.success(iWgzUserService.userLongIn(bo));
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.web.controller.wgz.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* PC务工者Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Api(value = "PC务工者控制器", tags = {"PC务工者管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/wgz/user")
|
||||
public class WgzUserController extends BaseController {
|
||||
|
||||
private final IWgzUserService iWgzUserService;
|
||||
|
||||
/**
|
||||
* 查询PC务工者列表
|
||||
*/
|
||||
@ApiOperation("查询PC务工者列表")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WgzUser> list(@Validated WgzUserQueryBo bo) {
|
||||
return iWgzUserService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出PC务工者列表
|
||||
*/
|
||||
@ApiOperation("导出PC务工者列表")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:export')")
|
||||
@Log(title = "PC务工者", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<WgzUser> export(@Validated WgzUserQueryBo bo) {
|
||||
List<WgzUser> list = iWgzUserService.queryList(bo);
|
||||
ExcelUtil<WgzUser> util = new ExcelUtil<WgzUser>(WgzUser.class);
|
||||
return util.exportExcel(list, "PC务工者");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取PC务工者详细信息
|
||||
*/
|
||||
@ApiOperation("获取PC务工者详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<WgzUser> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iWgzUserService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增PC务工者
|
||||
*/
|
||||
@ApiOperation("新增PC务工者")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:add')")
|
||||
@Log(title = "PC务工者", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody WgzUser bo) {
|
||||
return toAjax(iWgzUserService.insert(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改PC务工者
|
||||
*/
|
||||
@ApiOperation("修改PC务工者")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:edit')")
|
||||
@Log(title = "PC务工者", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody WgzUser bo) {
|
||||
return toAjax(iWgzUserService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除PC务工者
|
||||
*/
|
||||
@ApiOperation("删除PC务工者")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:user:remove')")
|
||||
@Log(title = "PC务工者" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String[] ids) {
|
||||
return toAjax(iWgzUserService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
@ -17,6 +17,11 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring框架基本的核心工具 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -88,7 +93,10 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.ruoyi.wgz.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDate;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* APP务工者分页查询对象 wgz_user
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("APP务工者分页查询对象")
|
||||
public class WgzUserQueryBo extends BaseEntity {
|
||||
|
||||
/** 分页大小 */
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/** 当前页数 */
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/** 排序列 */
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/** 排序的方向desc或者asc */
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/** 唯一标识 */
|
||||
@ApiModelProperty("唯一标识")
|
||||
private Long userId;
|
||||
/** 姓名 */
|
||||
@ApiModelProperty("姓名")
|
||||
private String username;
|
||||
/** 出生日期 */
|
||||
@ApiModelProperty("出生日期")
|
||||
private String birthdate;
|
||||
/** 身份证号码 */
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String identityCard;
|
||||
/** 联系电话 */
|
||||
@ApiModelProperty("联系电话")
|
||||
private String phone;
|
||||
/** 银行卡号 */
|
||||
@ApiModelProperty("银行卡号")
|
||||
private String cardNo;
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@ApiModelProperty("帐号状态(0正常 1停用)")
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("务工者APP注册账号对象")
|
||||
public class WgzAppUserLongInReq extends BaseEntity {
|
||||
@ApiModelProperty("联系电话")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("验证码")
|
||||
private String verificationCode;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("务工者APP注册账号对象")
|
||||
public class WgzAppUserRegisterReq extends BaseEntity {
|
||||
@ApiModelProperty("联系电话")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
private String phone;
|
||||
|
||||
/** 密码 */
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.ruoyi.wgz.bo.res;
|
||||
|
||||
public class WgzAppUserLongInRes {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.wgz.common;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
/**
|
||||
* 雪花 ID 生成工具类
|
||||
*/
|
||||
public class SnowflakeIdUtil {
|
||||
// 定义静态的 Snowflake 实例
|
||||
private static final Snowflake snowflake;
|
||||
|
||||
// 静态代码块,在类加载时初始化 Snowflake 实例
|
||||
static {
|
||||
// 这里的数据中心 ID 和机器 ID 可以根据实际情况进行配置
|
||||
// 此处假设数据中心 ID 为 1,机器 ID 为 1
|
||||
snowflake = IdUtil.createSnowflake(1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成雪花 ID 的静态方法
|
||||
* @return 生成的雪花 ID
|
||||
*/
|
||||
public static long generateId() {
|
||||
return snowflake.nextId();
|
||||
}
|
||||
}
|
159
ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzUser.java
Normal file
159
ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzUser.java
Normal file
@ -0,0 +1,159 @@
|
||||
package com.ruoyi.wgz.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* APP务工者对象 wgz_user
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("wgz_user")
|
||||
@ApiModel("APP务工者视图对象")
|
||||
public class WgzUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/** 唯一标识 */
|
||||
@Excel(name = "唯一标识")
|
||||
@ApiModelProperty("唯一标识")
|
||||
private Long userId;
|
||||
|
||||
/** 姓名 */
|
||||
@Excel(name = "姓名")
|
||||
@ApiModelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
/** 性别 */
|
||||
@Excel(name = "性别")
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
|
||||
/** 民族 */
|
||||
@Excel(name = "民族")
|
||||
@ApiModelProperty("民族")
|
||||
private String nation;
|
||||
|
||||
/** 出生日期 */
|
||||
@Excel(name = "出生日期")
|
||||
@ApiModelProperty("出生日期")
|
||||
private String birthdate;
|
||||
|
||||
/** 身份证号码 */
|
||||
@Excel(name = "身份证号码")
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String identityCard;
|
||||
|
||||
/** 所在区域 */
|
||||
@Excel(name = "所在区域")
|
||||
@ApiModelProperty("所在区域")
|
||||
private String area;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
@ApiModelProperty("地址")
|
||||
private String site;
|
||||
|
||||
/** 联系电话 */
|
||||
@Excel(name = "联系电话")
|
||||
@ApiModelProperty("联系电话")
|
||||
private String phone;
|
||||
|
||||
/** 银行 */
|
||||
@Excel(name = "银行")
|
||||
@ApiModelProperty("银行")
|
||||
private String bank;
|
||||
|
||||
/** 银行卡号 */
|
||||
@Excel(name = "银行卡号")
|
||||
@ApiModelProperty("银行卡号")
|
||||
private String cardNo;
|
||||
|
||||
/** 头像地址 */
|
||||
@Excel(name = "头像地址")
|
||||
@ApiModelProperty("头像地址")
|
||||
private String avatarName;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
/** 身份证正面图路径 */
|
||||
@Excel(name = "身份证正面图路径")
|
||||
@ApiModelProperty("身份证正面图路径")
|
||||
private String frontPath;
|
||||
|
||||
/** 身份证反面图路径 */
|
||||
@Excel(name = "身份证反面图路径")
|
||||
@ApiModelProperty("身份证反面图路径")
|
||||
private String reverseSidePath;
|
||||
|
||||
/** 银行卡图路径 */
|
||||
@Excel(name = "银行卡图路径")
|
||||
@ApiModelProperty("银行卡图路径")
|
||||
private String bankCardPath;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态" , readConverterExp = "0=正常,1=停用")
|
||||
@ApiModelProperty("帐号状态(0正常 1停用)")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除")
|
||||
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/** 创建者 */
|
||||
@Excel(name = "创建者")
|
||||
@ApiModelProperty("创建者")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@Excel(name = "更新者")
|
||||
@ApiModelProperty("更新者")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("更新时间")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wgz.mapper;
|
||||
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* APP务工者Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface WgzUserMapper extends BaseMapperPlus<WgzUser> {
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.ruoyi.wgz.service;
|
||||
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserLongInReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppUserLongInRes;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP务工者Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
public interface IWgzUserService extends IServicePlus<WgzUser> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
WgzUser queryById(String id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<WgzUser> queryPageList(WgzUserQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<WgzUser> queryList(WgzUserQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入APP务工者
|
||||
* @param bo APP务工者新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insert(WgzUser bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改APP务工者
|
||||
* @param bo APP务工者编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean update(WgzUser bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* 务工者APP注册账号
|
||||
* @param bo APP务工者注册业务对象
|
||||
* @return bool
|
||||
*/
|
||||
Boolean userRegister(WgzAppUserRegisterReq bo);
|
||||
|
||||
WgzAppUserLongInRes userLongIn(WgzAppUserLongInReq req);
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserLongInReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppUserLongInRes;
|
||||
import com.ruoyi.wgz.common.SnowflakeIdUtil;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.mapper.WgzUserMapper;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP务工者Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Service
|
||||
public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser> implements IWgzUserService {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
public WgzUser queryById(String id){
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WgzUser> queryPageList(WgzUserQueryBo bo) {
|
||||
Page<WgzUser> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WgzUser> queryList(WgzUserQueryBo bo) {
|
||||
return list(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WgzUser> buildQueryWrapper(WgzUserQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WgzUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, WgzUser::getUserId, bo.getUserId());
|
||||
lqw.like(StrUtil.isNotBlank(bo.getUsername()), WgzUser::getUsername, bo.getUsername());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getBirthdate()), WgzUser::getBirthdate, bo.getBirthdate());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getIdentityCard()), WgzUser::getIdentityCard, bo.getIdentityCard());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getPhone()), WgzUser::getPhone, bo.getPhone());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getCardNo()), WgzUser::getCardNo, bo.getCardNo());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getStatus()), WgzUser::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insert(WgzUser bo) {
|
||||
WgzUser add = BeanUtil.toBean(bo, WgzUser.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(WgzUser bo) {
|
||||
WgzUser update = BeanUtil.toBean(bo, WgzUser.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(WgzUser entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean userRegister(WgzAppUserRegisterReq bo) {
|
||||
WgzUser wgzUser = new WgzUser();
|
||||
//1、查询手机号是否存在
|
||||
Integer count = baseMapper.selectCount(
|
||||
new LambdaQueryWrapper<WgzUser>().
|
||||
eq(WgzUser::getPhone, wgzUser.getPhone())
|
||||
);
|
||||
if (count>0){
|
||||
throw new RuntimeException("当前手机号已存在!");
|
||||
}
|
||||
//2、组装数据 BeanUtils.copyProperties(bo,wgzUser);
|
||||
wgzUser.setPhone(bo.getPhone());
|
||||
wgzUser.setUserId(SnowflakeIdUtil.generateId());
|
||||
wgzUser.setPassword(SecurityUtils.encryptPassword(wgzUser.getPassword()));
|
||||
//3、保存数据
|
||||
return baseMapper.insert(wgzUser) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WgzAppUserLongInRes userLongIn(WgzAppUserLongInReq req) {
|
||||
//1、验证验证码是否正确(展示忽略)
|
||||
//2、验证账号是否存在
|
||||
WgzUser wgzUser = baseMapper.selectOne(new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getPhone, req.getPhone()));
|
||||
if (wgzUser == null){
|
||||
throw new RuntimeException("账号不存在!");
|
||||
}
|
||||
//3、验证密码是否正确
|
||||
if (!SecurityUtils.matchesPassword(req.getPassword(),wgzUser.getPassword())){
|
||||
throw new RuntimeException("密码错误!");
|
||||
}
|
||||
//4、创建token返回wgzUser
|
||||
String token = tokenService.createToken(wgzUser);
|
||||
WgzAppUserLongInRes res = new WgzAppUserLongInRes();
|
||||
res.setToken(token);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String createToken(WgzUser wu) {
|
||||
String token = IdUtil.fastUUID();
|
||||
loginUser.setToken(token);
|
||||
setUserAgent(loginUser);
|
||||
refreshToken(loginUser);
|
||||
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put(Constants.LOGIN_USER_KEY, token);
|
||||
return createToken(claims);
|
||||
}
|
||||
}
|
35
ruoyi-system/src/main/resources/mapper/wgz/WgzUserMapper.xml
Normal file
35
ruoyi-system/src/main/resources/mapper/wgz/WgzUserMapper.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?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.ruoyi.wgz.mapper.WgzUserMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wgz.domain.WgzUser" id="WgzUserResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="nation" column="nation"/>
|
||||
<result property="birthdate" column="birthdate"/>
|
||||
<result property="identityCard" column="identity_card"/>
|
||||
<result property="area" column="area"/>
|
||||
<result property="site" column="site"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="bank" column="bank"/>
|
||||
<result property="cardNo" column="card_no"/>
|
||||
<result property="avatarName" column="avatar_name"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="frontPath" column="front_path"/>
|
||||
<result property="reverseSidePath" column="reverse_side_path"/>
|
||||
<result property="bankCardPath" column="bank_card_path"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
53
ruoyi-ui/src/api/wgz/user.js
Normal file
53
ruoyi-ui/src/api/wgz/user.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询包工头用户列表
|
||||
export function listUser(query) {
|
||||
return request({
|
||||
url: '/wgz/user/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询包工头用户详细
|
||||
export function getUser(userId) {
|
||||
return request({
|
||||
url: '/wgz/user/' + userId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增包工头用户
|
||||
export function addUser(data) {
|
||||
return request({
|
||||
url: '/wgz/user',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改包工头用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/wgz/user',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除包工头用户
|
||||
export function delUser(userId) {
|
||||
return request({
|
||||
url: '/wgz/user/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出包工头用户
|
||||
export function exportUser(query) {
|
||||
return request({
|
||||
url: '/wgz/user/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
500
ruoyi-ui/src/views/wgz/user/index.vue
Normal file
500
ruoyi-ui/src/views/wgz/user/index.vue
Normal file
@ -0,0 +1,500 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="唯一标识" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入唯一标识"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="username">
|
||||
<el-input
|
||||
v-model="queryParams.username"
|
||||
placeholder="请输入姓名"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生日期" prop="birthdate">
|
||||
<el-input
|
||||
v-model="queryParams.birthdate"
|
||||
placeholder="请输入出生日期"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号码" prop="identityCard">
|
||||
<el-input
|
||||
v-model="queryParams.identityCard"
|
||||
placeholder="请输入身份证号码"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入联系电话"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="银行卡号" prop="cardNo">
|
||||
<el-input
|
||||
v-model="queryParams.cardNo"
|
||||
placeholder="请输入银行卡号"
|
||||
clearable
|
||||
size="small"
|
||||
@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>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @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="['wgz:user:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['wgz:user:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['wgz:user:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['wgz:user:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="姓名" align="center" prop="username" />
|
||||
<el-table-column label="性别" align="center" prop="gender" :formatter="genderFormat" />
|
||||
<el-table-column label="民族" align="center" prop="nation" />
|
||||
<el-table-column label="出生日期" align="center" prop="birthdate" />
|
||||
<el-table-column label="身份证号码" align="center" prop="identityCard" />
|
||||
<el-table-column label="所在区域" align="center" prop="area" />
|
||||
<el-table-column label="地址" align="center" prop="site" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" />
|
||||
<el-table-column label="银行" align="center" prop="bank" />
|
||||
<el-table-column label="银行卡号" align="center" prop="cardNo" />
|
||||
<el-table-column label="头像地址" align="center" prop="avatarName" />
|
||||
<el-table-column label="身份证正面图路径" align="center" prop="frontPath" />
|
||||
<el-table-column label="身份证反面图路径" align="center" prop="reverseSidePath" />
|
||||
<el-table-column label="银行卡图路径" align="center" prop="bankCardPath" />
|
||||
<el-table-column label="帐号状态" align="center" prop="status" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['wgz:user:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['wgz:user:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改APP务工者对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="唯一标识" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入唯一标识" />
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-select v-model="form.gender" placeholder="请选择性别">
|
||||
<el-option
|
||||
v-for="dict in genderOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="民族" prop="nation">
|
||||
<el-input v-model="form.nation" placeholder="请输入民族" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出生日期" prop="birthdate">
|
||||
<el-input v-model="form.birthdate" placeholder="请输入出生日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号码" prop="identityCard">
|
||||
<el-input v-model="form.identityCard" placeholder="请输入身份证号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所在区域" prop="area">
|
||||
<el-input v-model="form.area" placeholder="请输入所在区域" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="site">
|
||||
<el-input v-model="form.site" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="银行" prop="bank">
|
||||
<el-input v-model="form.bank" placeholder="请输入银行" />
|
||||
</el-form-item>
|
||||
<el-form-item label="银行卡号" prop="cardNo">
|
||||
<el-input v-model="form.cardNo" placeholder="请输入银行卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像地址">
|
||||
<imageUpload v-model="form.avatarName"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证正面图路径">
|
||||
<imageUpload v-model="form.frontPath"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证反面图路径">
|
||||
<imageUpload v-model="form.reverseSidePath"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="银行卡图路径">
|
||||
<imageUpload v-model="form.bankCardPath"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="帐号状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标志" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建者" prop="createBy">
|
||||
<el-input v-model="form.createBy" placeholder="请输入创建者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker clearable size="small"
|
||||
v-model="form.createTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新者" prop="updateBy">
|
||||
<el-input v-model="form.updateBy" placeholder="请输入更新者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-date-picker clearable size="small"
|
||||
v-model="form.updateTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUser, getUser, delUser, addUser, updateUser, exportUser } from "@/api/wgz/user";
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// APP务工者表格数据
|
||||
userList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 性别字典
|
||||
genderOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userId: undefined,
|
||||
username: undefined,
|
||||
birthdate: undefined,
|
||||
identityCard: undefined,
|
||||
phone: undefined,
|
||||
cardNo: undefined,
|
||||
status: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
userId: [
|
||||
{ required: true, message: "唯一标识不能为空", trigger: "blur" }
|
||||
],
|
||||
username: [
|
||||
{ required: true, message: "姓名不能为空", trigger: "blur" }
|
||||
],
|
||||
gender: [
|
||||
{ required: true, message: "性别不能为空", trigger: "change" }
|
||||
],
|
||||
nation: [
|
||||
{ required: true, message: "民族不能为空", trigger: "blur" }
|
||||
],
|
||||
birthdate: [
|
||||
{ required: true, message: "出生日期不能为空", trigger: "blur" }
|
||||
],
|
||||
identityCard: [
|
||||
{ required: true, message: "身份证号码不能为空", trigger: "blur" }
|
||||
],
|
||||
area: [
|
||||
{ required: true, message: "所在区域不能为空", trigger: "blur" }
|
||||
],
|
||||
site: [
|
||||
{ required: true, message: "地址不能为空", trigger: "blur" }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: "联系电话不能为空", trigger: "blur" }
|
||||
],
|
||||
bank: [
|
||||
{ required: true, message: "银行不能为空", trigger: "blur" }
|
||||
],
|
||||
cardNo: [
|
||||
{ required: true, message: "银行卡号不能为空", trigger: "blur" }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "密码不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "帐号状态不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDicts("sys_user_sex").then(response => {
|
||||
this.genderOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询APP务工者列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listUser(this.queryParams).then(response => {
|
||||
this.userList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 性别字典翻译
|
||||
genderFormat(row, column) {
|
||||
return this.selectDictLabel(this.genderOptions, row.gender);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
username: undefined,
|
||||
gender: undefined,
|
||||
nation: undefined,
|
||||
birthdate: undefined,
|
||||
identityCard: undefined,
|
||||
area: undefined,
|
||||
site: undefined,
|
||||
phone: undefined,
|
||||
bank: undefined,
|
||||
cardNo: undefined,
|
||||
avatarName: undefined,
|
||||
password: undefined,
|
||||
frontPath: undefined,
|
||||
reverseSidePath: undefined,
|
||||
bankCardPath: undefined,
|
||||
status: "0",
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加APP务工者";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getUser(id).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改APP务工者";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.id != null) {
|
||||
updateUser(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addUser(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除APP务工者编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delUser(ids);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有APP务工者数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportUser(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user