初始化user

main
zhangyue 2025-11-04 15:13:56 +08:00
parent 50dc7e9a91
commit 6d1c587141
19 changed files with 1117 additions and 0 deletions

View File

@ -0,0 +1,81 @@
package com.zcloud.basic.info.web;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.basic.info.api.UserServiceI;
import com.zcloud.basic.info.dto.UserAddCmd;
import com.zcloud.basic.info.dto.UserPageQry;
import com.zcloud.basic.info.dto.UserUpdateCmd;
import com.zcloud.basic.info.dto.clientobject.UserCO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
/**
* web-adapter
* @Author zhangyue
* @Date 2025-11-04 14:07:33
*/
@Api(tags = "用户信息表")
@RequestMapping("/${application.gateway}/user")
@RestController
@AllArgsConstructor
public class UserController {
private final UserServiceI userService;
@ApiOperation("新增")
@PostMapping("/save")
public SingleResponse<UserCO> add(@Validated @RequestBody UserAddCmd cmd) {
SSOUser ssoUser = AuthContext.getCurrentUser();
return userService.add(cmd);
}
@ApiOperation("分页")
@PostMapping("/list")
public PageResponse<UserCO> page(@RequestBody UserPageQry qry) {
return userService.listPage(qry);
}
@ApiOperation("所有数据")
@GetMapping("/listAll")
public MultiResponse<UserCO> listAll() {
return MultiResponse.of(new ArrayList<UserCO>());
}
@ApiOperation("详情")
@GetMapping("/{id}")
public SingleResponse<UserCO> getInfoById(@PathVariable("id") Long id) {
return SingleResponse.of(new UserCO());
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
public Response remove(@PathVariable("id") Long id) {
userService.remove(id);
return SingleResponse.buildSuccess();
}
@ApiOperation("删除多个")
@DeleteMapping("/ids")
public Response removeBatch(@RequestParam Long[] ids) {
userService.removeBatch(ids);
return SingleResponse.buildSuccess();
}
@ApiOperation("修改")
@PutMapping("/edit")
public SingleResponse edit(@Validated @RequestBody UserUpdateCmd userUpdateCmd) {
userService.edit(userUpdateCmd);
return SingleResponse.buildSuccess();
}
}

View File

@ -0,0 +1,41 @@
package com.zcloud.basic.info.command;
import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.UserGateway;
import com.zcloud.basic.info.domain.model.UserE;
import com.zcloud.basic.info.dto.UserAddCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:21
*/
@Component
@AllArgsConstructor
public class UserAddExe {
private final UserGateway userGateway;
@Transactional(rollbackFor = Exception.class)
public boolean execute(UserAddCmd cmd) {
UserE userE = new UserE();
BeanUtils.copyProperties(cmd, userE);
boolean res = false;
try {
res = userGateway.add(userE);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (!res) {
throw new BizException("保存失败");
}
return true;
}
}

View File

@ -0,0 +1,40 @@
package com.zcloud.basic.info.command;
import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.UserGateway;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:36
*/
@Component
@AllArgsConstructor
public class UserRemoveExe {
private final UserGateway userGateway;
@Transactional(rollbackFor = Exception.class)
public boolean execute(Long id) {
boolean res = userGateway.deletedUserById(id);
if(!res){
throw new BizException("删除失败");
}
return true;
}
@Transactional(rollbackFor = Exception.class)
public boolean execute(Long[] ids) {
boolean res = userGateway.deletedUserByIds(ids);
if(!res){
throw new BizException("删除失败");
}
return true;
}
}

View File

@ -0,0 +1,35 @@
package com.zcloud.basic.info.command;
import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.UserGateway;
import com.zcloud.basic.info.domain.model.UserE;
import com.zcloud.basic.info.dto.UserUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:38
*/
@Component
@AllArgsConstructor
public class UserUpdateExe {
private final UserGateway userGateway;
@Transactional(rollbackFor = Exception.class)
public void execute(UserUpdateCmd userUpdateCmd) {
UserE userE = new UserE();
BeanUtils.copyProperties(userUpdateCmd, userE);
boolean res = userGateway.update(userE);
if (!res) {
throw new BizException("修改失败");
}
}
}

View File

@ -0,0 +1,24 @@
package com.zcloud.basic.info.command.convertor;
import com.zcloud.basic.info.dto.clientobject.UserCO;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import org.mapstruct.Mapper;
import java.util.List;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:34
*/
@Mapper(componentModel = "spring")
public interface UserCoConvertor {
/**
* @param userDOs
* @return
*/
List<UserCO> converDOsToCOs(List<UserDO> userDOs);
}

View File

@ -0,0 +1,42 @@
package com.zcloud.basic.info.command.query;
import com.alibaba.cola.dto.PageResponse;
import com.zcloud.basic.info.command.convertor.UserCoConvertor;
import com.zcloud.basic.info.dto.UserPageQry;
import com.zcloud.basic.info.dto.clientobject.UserCO;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import com.zcloud.basic.info.persistence.repository.UserRepository;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:36
*/
@Component
@AllArgsConstructor
public class UserQueryExe {
private final UserRepository userRepository;
private final UserCoConvertor userCoConvertor;
/**
*
*
* @param userPageQry
* @return
*/
public PageResponse<UserCO> execute(UserPageQry userPageQry) {
Map<String,Object> params = PageQueryHelper.toHashMap(userPageQry);
PageResponse<UserDO> pageResponse = userRepository.listPage(params);
List<UserCO> examCenterCOS = userCoConvertor.converDOsToCOs(pageResponse.getData());
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
}

View File

@ -0,0 +1,58 @@
package com.zcloud.basic.info.service;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.basic.info.api.UserServiceI;
import com.zcloud.basic.info.command.UserAddExe;
import com.zcloud.basic.info.command.UserRemoveExe;
import com.zcloud.basic.info.command.UserUpdateExe;
import com.zcloud.basic.info.command.query.UserQueryExe;
import com.zcloud.basic.info.dto.UserAddCmd;
import com.zcloud.basic.info.dto.UserPageQry;
import com.zcloud.basic.info.dto.UserUpdateCmd;
import com.zcloud.basic.info.dto.clientobject.UserCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
/**
* web-app
* @Author zhangyue
* @Date 2025-11-04 14:07:37
*/
@Service
@AllArgsConstructor
public class UserServiceImpl implements UserServiceI {
private final UserAddExe userAddExe;
private final UserUpdateExe userUpdateExe;
private final UserRemoveExe userRemoveExe;
private final UserQueryExe userQueryExe;
@Override
public PageResponse<UserCO> listPage(UserPageQry qry){
return userQueryExe.execute(qry);
}
@Override
public SingleResponse add(UserAddCmd cmd) {
userAddExe.execute(cmd);
return SingleResponse.buildSuccess();
}
@Override
public void edit(UserUpdateCmd userUpdateCmd) {
userUpdateExe.execute(userUpdateCmd);
}
@Override
public void remove(Long id) {
userRemoveExe.execute(id);
}
@Override
public void removeBatch(Long[] ids) {
userRemoveExe.execute(ids);
}
}

View File

@ -0,0 +1,27 @@
package com.zcloud.basic.info.api;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.basic.info.dto.UserAddCmd;
import com.zcloud.basic.info.dto.UserPageQry;
import com.zcloud.basic.info.dto.UserUpdateCmd;
import com.zcloud.basic.info.dto.clientobject.UserCO;
/**
* web-client
* @Author zhangyue
* @Date 2025-11-04 14:07:37
*/
public interface UserServiceI {
PageResponse<UserCO> listPage(UserPageQry qry);
SingleResponse<UserCO> add(UserAddCmd cmd);
void edit(UserUpdateCmd cmd);
void remove(Long id);
void removeBatch(Long[] ids);
}

View File

@ -0,0 +1,133 @@
package com.zcloud.basic.info.dto;
import com.alibaba.cola.dto.Command;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* web-client
*
* @Author zhangyue
* @Date 2025-11-04 14:07:12
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserAddCmd extends Command {
@ApiModelProperty(value = "业务主键id老系统id", name = "userId", required = true)
@NotEmpty(message = "业务主键id老系统id不能为空")
private String userId;
@ApiModelProperty(value = "登录账号", name = "username", required = true)
@NotEmpty(message = "登录账号不能为空")
private String username;
@ApiModelProperty(value = "姓名", name = "name", required = true)
@NotEmpty(message = "姓名不能为空")
private String name;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空")
private Long corpinfoId;
@ApiModelProperty(value = "是否主账号1是0否", name = "mainCorpFlag", required = true)
@NotNull(message = "是否主账号1是0否不能为空")
private Integer mainCorpFlag;
@ApiModelProperty(value = "用户类型,1监管2企业3相关方", name = "userType", required = true)
@NotNull(message = "用户类型,1监管2企业3相关方不能为空")
private Integer userType;
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
@NotNull(message = "部门id不能为空")
private Long departmentId;
@ApiModelProperty(value = "岗位id", name = "postId", required = true)
@NotNull(message = "岗位id不能为空")
private Long postId;
@ApiModelProperty(value = "角色id", name = "roleId", required = true)
@NotNull(message = "角色id不能为空")
private Long roleId;
@ApiModelProperty(value = "邮箱", name = "email", required = true)
@NotEmpty(message = "邮箱不能为空")
private String email;
@ApiModelProperty(value = "人员类型编码(主要负责人等)", name = "personnelType", required = true)
@NotEmpty(message = "人员类型编码(主要负责人等)不能为空")
private String personnelType;
@ApiModelProperty(value = "人员类型翻译", name = "personnelTypeName", required = true)
@NotEmpty(message = "人员类型翻译不能为空")
private String personnelTypeName;
@ApiModelProperty(value = "民族编码问一下有没有组件", name = "nation", required = true)
@NotEmpty(message = "民族编码问一下有没有组件不能为空")
private String nation;
@ApiModelProperty(value = "民族名称", name = "nationName", required = true)
@NotEmpty(message = "民族名称不能为空")
private String nationName;
@ApiModelProperty(value = "身份证号", name = "userIdCard", required = true)
@NotEmpty(message = "身份证号不能为空")
private String userIdCard;
@ApiModelProperty(value = "人脸头像url", name = "userAvatarUrl", required = true)
@NotEmpty(message = "人脸头像url不能为空")
private String userAvatarUrl;
@ApiModelProperty(value = "现住址", name = "currentAddress", required = true)
@NotEmpty(message = "现住址不能为空")
private String currentAddress;
@ApiModelProperty(value = "户口所在地", name = "locationAddress", required = true)
@NotEmpty(message = "户口所在地不能为空")
private String locationAddress;
@ApiModelProperty(value = "人员在部门中的排序", name = "sort", required = true)
@NotNull(message = "人员在部门中的排序不能为空")
private Integer sort;
@ApiModelProperty(value = "是否部门领导0否1是", name = "departmentLeaderFlag", required = true)
@NotNull(message = "是否部门领导0否1是不能为空")
private Integer departmentLeaderFlag;
@ApiModelProperty(value = "是否分管领导0否1是", name = "deputyLeaderFlag", required = true)
@NotNull(message = "是否分管领导0否1是不能为空")
private Integer deputyLeaderFlag;
@ApiModelProperty(value = "文化程度 数据字典", name = "culturalLevel", required = true)
@NotEmpty(message = "文化程度 数据字典不能为空")
private String culturalLevel;
@ApiModelProperty(value = "文化程度名称", name = "culturalLevelName", required = true)
@NotEmpty(message = "文化程度名称不能为空")
private String culturalLevelName;
@ApiModelProperty(value = "婚姻状态", name = "maritalStatus", required = true)
@NotEmpty(message = "婚姻状态不能为空")
private String maritalStatus;
@ApiModelProperty(value = "婚姻状态名称", name = "maritalStatusName", required = true)
@NotEmpty(message = "婚姻状态名称不能为空")
private String maritalStatusName;
@ApiModelProperty(value = "政治面貌", name = "politicalAffiliation", required = true)
@NotEmpty(message = "政治面貌不能为空")
private String politicalAffiliation;
@ApiModelProperty(value = "政治面貌名称", name = "politicalAffiliationName", required = true)
@NotEmpty(message = "政治面貌名称不能为空")
private String politicalAffiliationName;
}

View File

@ -0,0 +1,28 @@
package com.zcloud.basic.info.dto;
import com.alibaba.cola.dto.PageQuery;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2025-11-04 14:07:36
*/
@Data
public class UserPageQry extends PageQuery {
/**
* ,
* - `like`: SQLLIKE
* - `eq`: SQL=
* - `gt`:
* - `lt`:
* - `ge`:
* - `le`:
* - `ne`: SQL!=
*/
private String likeUserId;
}

View File

@ -0,0 +1,108 @@
package com.zcloud.basic.info.dto;
import com.alibaba.cola.dto.Command;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* web-client
* @Author zhangyue
* @Date 2025-11-04 14:07:38
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserUpdateCmd extends Command {
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
@NotNull(message = "GBS用户id不能为空")
private Long id;
@ApiModelProperty(value = "业务主键id老系统id", name = "userId", required = true)
@NotEmpty(message = "业务主键id老系统id不能为空")
private String userId;
@ApiModelProperty(value = "登录账号", name = "username", required = true)
@NotEmpty(message = "登录账号不能为空")
private String username;
@ApiModelProperty(value = "姓名", name = "name", required = true)
@NotEmpty(message = "姓名不能为空")
private String name;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
@NotNull(message = "企业id不能为空")
private Long corpinfoId;
@ApiModelProperty(value = "是否主账号1是0否", name = "mainCorpFlag", required = true)
@NotNull(message = "是否主账号1是0否不能为空")
private Integer mainCorpFlag;
@ApiModelProperty(value = "用户类型,1监管2企业3相关方", name = "userType", required = true)
@NotNull(message = "用户类型,1监管2企业3相关方不能为空")
private Integer userType;
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
@NotNull(message = "部门id不能为空")
private Long departmentId;
@ApiModelProperty(value = "岗位id", name = "postId", required = true)
@NotNull(message = "岗位id不能为空")
private Long postId;
@ApiModelProperty(value = "角色id", name = "roleId", required = true)
@NotNull(message = "角色id不能为空")
private Long roleId;
@ApiModelProperty(value = "邮箱", name = "email", required = true)
@NotEmpty(message = "邮箱不能为空")
private String email;
@ApiModelProperty(value = "人员类型编码(主要负责人等)", name = "personnelType", required = true)
@NotEmpty(message = "人员类型编码(主要负责人等)不能为空")
private String personnelType;
@ApiModelProperty(value = "人员类型翻译", name = "personnelTypeName", required = true)
@NotEmpty(message = "人员类型翻译不能为空")
private String personnelTypeName;
@ApiModelProperty(value = "民族编码问一下有没有组件", name = "nation", required = true)
@NotEmpty(message = "民族编码问一下有没有组件不能为空")
private String nation;
@ApiModelProperty(value = "民族名称", name = "nationName", required = true)
@NotEmpty(message = "民族名称不能为空")
private String nationName;
@ApiModelProperty(value = "身份证号", name = "userIdCard", required = true)
@NotEmpty(message = "身份证号不能为空")
private String userIdCard;
@ApiModelProperty(value = "人脸头像url", name = "userAvatarUrl", required = true)
@NotEmpty(message = "人脸头像url不能为空")
private String userAvatarUrl;
@ApiModelProperty(value = "现住址", name = "currentAddress", required = true)
@NotEmpty(message = "现住址不能为空")
private String currentAddress;
@ApiModelProperty(value = "户口所在地", name = "locationAddress", required = true)
@NotEmpty(message = "户口所在地不能为空")
private String locationAddress;
@ApiModelProperty(value = "人员在部门中的排序", name = "sort", required = true)
@NotNull(message = "人员在部门中的排序不能为空")
private Integer sort;
@ApiModelProperty(value = "是否部门领导0否1是", name = "departmentLeaderFlag", required = true)
@NotNull(message = "是否部门领导0否1是不能为空")
private Integer departmentLeaderFlag;
@ApiModelProperty(value = "是否分管领导0否1是", name = "deputyLeaderFlag", required = true)
@NotNull(message = "是否分管领导0否1是不能为空")
private Integer deputyLeaderFlag;
@ApiModelProperty(value = "文化程度 数据字典", name = "culturalLevel", required = true)
@NotEmpty(message = "文化程度 数据字典不能为空")
private String culturalLevel;
@ApiModelProperty(value = "文化程度名称", name = "culturalLevelName", required = true)
@NotEmpty(message = "文化程度名称不能为空")
private String culturalLevelName;
@ApiModelProperty(value = "婚姻状态", name = "maritalStatus", required = true)
@NotEmpty(message = "婚姻状态不能为空")
private String maritalStatus;
@ApiModelProperty(value = "婚姻状态名称", name = "maritalStatusName", required = true)
@NotEmpty(message = "婚姻状态名称不能为空")
private String maritalStatusName;
@ApiModelProperty(value = "政治面貌", name = "politicalAffiliation", required = true)
@NotEmpty(message = "政治面貌不能为空")
private String politicalAffiliation;
@ApiModelProperty(value = "政治面貌名称", name = "politicalAffiliationName", required = true)
@NotEmpty(message = "政治面貌名称不能为空")
private String politicalAffiliationName;
}

View File

@ -0,0 +1,142 @@
package com.zcloud.basic.info.dto.clientobject;
import com.alibaba.cola.dto.ClientObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* web-client
*
* @Author zhangyue
* @Date 2025-11-04 14:07:33
*/
@Data
public class UserCO extends ClientObject {
//GBS用户id
@ApiModelProperty(value = "GBS用户id")
private Long id;
//业务主键id老系统id
@ApiModelProperty(value = "业务主键id老系统id")
private String userId;
//登录账号
@ApiModelProperty(value = "登录账号")
private String username;
//姓名
@ApiModelProperty(value = "姓名")
private String name;
//企业id
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
//是否主账号1是0否
@ApiModelProperty(value = "是否主账号1是0否")
private Integer mainCorpFlag;
//用户类型,1监管2企业3相关方
@ApiModelProperty(value = "用户类型,1监管2企业3相关方")
private Integer userType;
//部门id
@ApiModelProperty(value = "部门id")
private Long departmentId;
//岗位id
@ApiModelProperty(value = "岗位id")
private Long postId;
//角色id
@ApiModelProperty(value = "角色id")
private Long roleId;
//邮箱
@ApiModelProperty(value = "邮箱")
private String email;
//人员类型编码(主要负责人等)
@ApiModelProperty(value = "人员类型编码(主要负责人等)")
private String personnelType;
//人员类型翻译
@ApiModelProperty(value = "人员类型翻译")
private String personnelTypeName;
//民族编码问一下有没有组件
@ApiModelProperty(value = "民族编码问一下有没有组件")
private String nation;
//民族名称
@ApiModelProperty(value = "民族名称")
private String nationName;
//身份证号
@ApiModelProperty(value = "身份证号")
private String userIdCard;
//人脸头像url
@ApiModelProperty(value = "人脸头像url")
private String userAvatarUrl;
//现住址
@ApiModelProperty(value = "现住址")
private String currentAddress;
//户口所在地
@ApiModelProperty(value = "户口所在地")
private String locationAddress;
//人员在部门中的排序
@ApiModelProperty(value = "人员在部门中的排序")
private Integer sort;
//乐观锁
@ApiModelProperty(value = "乐观锁")
private Integer version;
//创建人
@ApiModelProperty(value = "创建人")
private Long createId;
//创建人姓名
@ApiModelProperty(value = "创建人姓名")
private String createName;
//创建时间
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
//更新人
@ApiModelProperty(value = "更新人")
private Long updateId;
//修改人名称
@ApiModelProperty(value = "修改人名称")
private String updateName;
//更新时间
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date updateTime;
//描述
@ApiModelProperty(value = "描述")
private String remarks;
//是否删除
@ApiModelProperty(value = "是否删除")
private String deleteEnum;
//租户ID
@ApiModelProperty(value = "租户ID")
private Long tenantId;
//机构ID
@ApiModelProperty(value = "机构ID")
private Long orgId;
//环境
@ApiModelProperty(value = "环境")
private String env;
//是否部门领导0否1是
@ApiModelProperty(value = "是否部门领导0否1是")
private Integer departmentLeaderFlag;
//是否分管领导0否1是
@ApiModelProperty(value = "是否分管领导0否1是")
private Integer deputyLeaderFlag;
//文化程度 数据字典
@ApiModelProperty(value = "文化程度 数据字典")
private String culturalLevel;
//文化程度名称
@ApiModelProperty(value = "文化程度名称")
private String culturalLevelName;
//婚姻状态
@ApiModelProperty(value = "婚姻状态")
private String maritalStatus;
//婚姻状态名称
@ApiModelProperty(value = "婚姻状态名称")
private String maritalStatusName;
//政治面貌
@ApiModelProperty(value = "政治面貌")
private String politicalAffiliation;
//政治面貌名称
@ApiModelProperty(value = "政治面貌名称")
private String politicalAffiliationName;
}

View File

@ -0,0 +1,31 @@
package com.zcloud.basic.info.domain.gateway;
import com.zcloud.basic.info.domain.model.UserE;
/**
* web-domain
*
* @Author zhangyue
* @Date 2025-11-04 14:07:35
*/
public interface UserGateway {
/**
*
*/
Boolean add(UserE userE);
/**
*
*/
Boolean update(UserE userE);
/**
*
*/
Boolean deletedUserById(Long id);
Boolean deletedUserByIds(Long[] id);
}

View File

@ -0,0 +1,98 @@
package com.zcloud.basic.info.domain.model;
import com.jjb.saas.framework.domain.model.BaseE;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* web-domain
*
* @Author zhangyue
* @Date 2025-11-04 14:07:34
*/
@Data
public class UserE extends BaseE {
//GBS用户id
private Long id;
//业务主键id老系统id
private String userId;
//登录账号
private String username;
//姓名
private String name;
//企业id
private Long corpinfoId;
//是否主账号1是0否
private Integer mainCorpFlag;
//用户类型,1监管2企业3相关方
private Integer userType;
//部门id
private Long departmentId;
//岗位id
private Long postId;
//角色id
private Long roleId;
//邮箱
private String email;
//人员类型编码(主要负责人等)
private String personnelType;
//人员类型翻译
private String personnelTypeName;
//民族编码问一下有没有组件
private String nation;
//民族名称
private String nationName;
//身份证号
private String userIdCard;
//人脸头像url
private String userAvatarUrl;
//现住址
private String currentAddress;
//户口所在地
private String locationAddress;
//人员在部门中的排序
private Integer sort;
//乐观锁
private Integer version;
//创建人
private Long createId;
//创建人姓名
private String createName;
//创建时间
private LocalDateTime createTime;
//更新人
private Long updateId;
//修改人名称
private String updateName;
//更新时间
private LocalDateTime updateTime;
//描述
private String remarks;
//是否删除
private String deleteEnum;
//租户ID
private Long tenantId;
//机构ID
private Long orgId;
//环境
private String env;
//是否部门领导0否1是
private Integer departmentLeaderFlag;
//是否分管领导0否1是
private Integer deputyLeaderFlag;
//文化程度 数据字典
private String culturalLevel;
//文化程度名称
private String culturalLevelName;
//婚姻状态
private String maritalStatus;
//婚姻状态名称
private String maritalStatusName;
//政治面貌
private String politicalAffiliation;
//政治面貌名称
private String politicalAffiliationName;
}

View File

@ -0,0 +1,49 @@
package com.zcloud.basic.info.gatewayimpl;
import com.zcloud.basic.info.domain.gateway.UserGateway;
import com.zcloud.basic.info.domain.model.UserE;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import com.zcloud.basic.info.persistence.repository.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Arrays;
/**
* web-infrastructure
* @Author zhangyue
* @Date 2025-11-04 14:07:35
*/
@Service
@AllArgsConstructor
public class UserGatewayImpl implements UserGateway {
private final UserRepository userRepository;
@Override
public Boolean add(UserE userE) {
UserDO d = new UserDO();
BeanUtils.copyProperties(userE, d);
userRepository.save(d);
return true;
}
@Override
public Boolean update(UserE userE) {
UserDO d = new UserDO();
BeanUtils.copyProperties(userE, d);
userRepository.updateById(d);
return true;
}
@Override
public Boolean deletedUserById(Long id) {
return userRepository.removeById(id);
}
@Override
public Boolean deletedUserByIds(Long[] ids) {
return userRepository.removeByIds(Arrays.asList(ids));
}
}

View File

@ -0,0 +1,108 @@
package com.zcloud.basic.info.persistence.dataobject;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jjb.saas.framework.repository.basedo.BaseDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* web-infrastructure
*
* @Author zhangyue
* @Date 2025-11-04 14:07:35
*/
@Data
@TableName("user")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class UserDO extends BaseDO {
//业务主键id老系统id
@ApiModelProperty(value = "业务主键id老系统id")
private String userId;
//登录账号
@ApiModelProperty(value = "登录账号")
private String username;
//姓名
@ApiModelProperty(value = "姓名")
private String name;
//企业id
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
//是否主账号1是0否
@ApiModelProperty(value = "是否主账号1是0否")
private Integer mainCorpFlag;
//用户类型,1监管2企业3相关方
@ApiModelProperty(value = "用户类型,1监管2企业3相关方")
private Integer userType;
//部门id
@ApiModelProperty(value = "部门id")
private Long departmentId;
//岗位id
@ApiModelProperty(value = "岗位id")
private Long postId;
//角色id
@ApiModelProperty(value = "角色id")
private Long roleId;
//邮箱
@ApiModelProperty(value = "邮箱")
private String email;
//人员类型编码(主要负责人等)
@ApiModelProperty(value = "人员类型编码(主要负责人等)")
private String personnelType;
//人员类型翻译
@ApiModelProperty(value = "人员类型翻译")
private String personnelTypeName;
//民族编码问一下有没有组件
@ApiModelProperty(value = "民族编码问一下有没有组件")
private String nation;
//民族名称
@ApiModelProperty(value = "民族名称")
private String nationName;
//身份证号
@ApiModelProperty(value = "身份证号")
private String userIdCard;
//人脸头像url
@ApiModelProperty(value = "人脸头像url")
private String userAvatarUrl;
//现住址
@ApiModelProperty(value = "现住址")
private String currentAddress;
//户口所在地
@ApiModelProperty(value = "户口所在地")
private String locationAddress;
//人员在部门中的排序
@ApiModelProperty(value = "人员在部门中的排序")
private Integer sort;
//是否部门领导0否1是
@ApiModelProperty(value = "是否部门领导0否1是")
private Integer departmentLeaderFlag;
//是否分管领导0否1是
@ApiModelProperty(value = "是否分管领导0否1是")
private Integer deputyLeaderFlag;
//文化程度 数据字典
@ApiModelProperty(value = "文化程度 数据字典")
private String culturalLevel;
//文化程度名称
@ApiModelProperty(value = "文化程度名称")
private String culturalLevelName;
//婚姻状态
@ApiModelProperty(value = "婚姻状态")
private String maritalStatus;
//婚姻状态名称
@ApiModelProperty(value = "婚姻状态名称")
private String maritalStatusName;
//政治面貌
@ApiModelProperty(value = "政治面貌")
private String politicalAffiliation;
//政治面貌名称
@ApiModelProperty(value = "政治面貌名称")
private String politicalAffiliationName;
public UserDO(String userId) {
this.userId = userId;
}
}

View File

@ -0,0 +1,17 @@
package com.zcloud.basic.info.persistence.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import org.apache.ibatis.annotations.Mapper;
/**
* web-infrastructure
*
* @Author zhangyue
* @Date 2025-11-04 14:07:36
*/
@Mapper
public interface UserMapper extends BaseMapper<UserDO> {
}

View File

@ -0,0 +1,17 @@
package com.zcloud.basic.info.persistence.repository;
import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import java.util.Map;
/**
* web-infrastructure
* @Author zhangyue
* @Date 2025-11-04 14:07:36
*/
public interface UserRepository extends BaseRepository<UserDO> {
PageResponse<UserDO> listPage(Map<String,Object> params);
}

View File

@ -0,0 +1,38 @@
package com.zcloud.basic.info.persistence.repository.impl;
import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.basic.info.persistence.dataobject.UserDO;
import com.zcloud.basic.info.persistence.mapper.UserMapper;
import com.zcloud.basic.info.persistence.repository.UserRepository;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* web-infrastructure
* @Author zhangyue
* @Date 2025-11-04 14:07:37
*/
@Service
@RequiredArgsConstructor
public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> implements UserRepository {
private final UserMapper userMapper;
@Override
public PageResponse<UserDO> listPage(Map<String,Object> params) {
IPage<UserDO> iPage = new Query<UserDO>().getPage(params);
QueryWrapper<UserDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
queryWrapper.orderByDesc("create_time");
IPage<UserDO> result = userMapper.selectPage(iPage, queryWrapper);
return PageHelper.pageToResponse(result, result.getRecords());
}
}