fetch:新增机构/人员
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.slrs.sarUser.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zxy
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "|人员管理|")
|
||||
@RequestMapping("/sarUser/user")
|
||||
public class TsUserController extends BaseController<TsUser> {
|
||||
@Autowired
|
||||
private ITsUserService tsUserService;
|
||||
|
||||
@ApiOperation("禁用/解禁人员")
|
||||
@PostMapping("/disable")
|
||||
public ResponseMessage<Object> disable(@Validated(TsUser.disable.class) @RequestBody TsUser tsUser){
|
||||
//判断disableFlag是否填入正确
|
||||
if((!tsUser.getDisableFlag().equals("1"))&&(!tsUser.getDisableFlag().equals("0"))){
|
||||
return Result.error("disableFlag只能是0或1");
|
||||
}
|
||||
return tsUserService.disable(tsUser);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.slrs.sarUser.dao;
|
||||
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface TsUserDao extends BaseMapper<TsUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.adc.da.slrs.sarUser.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="TsUser对象", description="")
|
||||
public class TsUser extends BaseEntity {
|
||||
|
||||
public interface disable{
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
@NotNull(message = "userId不能为空",groups = {disable.class})
|
||||
@TableId(value = "USID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "帐户")
|
||||
@TableField("ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
@TableField("PASSWORD")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "用户姓名")
|
||||
@TableField("UNAME")
|
||||
private String uname;
|
||||
|
||||
@ApiModelProperty(value = "用户性别(1为男,2为女)")
|
||||
@TableField("SEX")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty(value = "用户来源")
|
||||
@TableField("USER_SOURCE")
|
||||
private String userSource;
|
||||
|
||||
@ApiModelProperty(value = "用户邮箱")
|
||||
@TableField("EMAIL")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "所属部门名称")
|
||||
@TableField("INSTITUTION_NAME")
|
||||
private String institutionName;
|
||||
|
||||
@ApiModelProperty(value = "所属部门ID")
|
||||
@TableField("INSTITUTION_ID")
|
||||
private String institutionId;
|
||||
|
||||
@ApiModelProperty(value = "岗位名")
|
||||
@TableField("POSITION_NAME")
|
||||
private String positionName;
|
||||
|
||||
@ApiModelProperty(value = "岗位ID")
|
||||
@TableField("POSITION_ID")
|
||||
private String positionId;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
@TableField("WORK_NUM")
|
||||
private String workNum;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@TableField("EXT_INFO")
|
||||
private String extInfo;
|
||||
|
||||
@TableField("OPER_USER")
|
||||
private String operUser;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATION_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp creationTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("MODIFY_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private String validFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否禁用(0为未禁用,1为已禁用)")
|
||||
@NotNull(message = "disableFlag不能为空",groups = {disable.class})
|
||||
@TableField("DISABLE_FLAG")
|
||||
private String disableFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否锁定")
|
||||
@TableField("UNLOCK_FLAG")
|
||||
private String unlockFlag;
|
||||
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
@TableField("USER_TYPE")
|
||||
private String userType;
|
||||
|
||||
@ApiModelProperty(value = "对接单点登录用户ID")
|
||||
@TableField("SSO_ID")
|
||||
private String ssoId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.adc.da.slrs.sarUser.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface ITsUserService extends IService<TsUser> {
|
||||
|
||||
|
||||
/**
|
||||
* 通过机构ID查询人员
|
||||
* @param institutionId:机构ID
|
||||
* @return List<TsUser>
|
||||
*/
|
||||
List<TsUser> getUserByInstitutionId(String institutionId);
|
||||
|
||||
/**
|
||||
* 封禁、解禁用户
|
||||
* @param tsUser:目标用户
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
ResponseMessage<Object> disable(TsUser tsUser);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.adc.da.slrs.sarUser.service.impl;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Service
|
||||
public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements ITsUserService {
|
||||
@Autowired
|
||||
private TsUserDao tsUserDao;
|
||||
|
||||
/**
|
||||
* 通过机构ID查询人员
|
||||
* @param institutionId:机构ID
|
||||
* @return List<TsUser>
|
||||
*/
|
||||
@Override
|
||||
public List<TsUser> getUserByInstitutionId(String institutionId) {
|
||||
QueryWrapper<TsUser> userQueryWrapper=new QueryWrapper<>();
|
||||
userQueryWrapper.eq("institution_id",institutionId);
|
||||
return tsUserDao.selectList(userQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封禁、解禁用户
|
||||
* @param tsUser:目标用户
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> disable(TsUser tsUser) {
|
||||
TsUser user=tsUserDao.selectById(tsUser.getUserId());
|
||||
if(user==null){
|
||||
return Result.error("该用户不存在");
|
||||
}
|
||||
//解禁
|
||||
if(tsUser.getDisableFlag().equals("0")){
|
||||
if(user.getDisableFlag().equals("0")){
|
||||
return Result.error("该用户已被解禁,请勿重复操作");
|
||||
}
|
||||
user.setDisableFlag("0");
|
||||
//封禁
|
||||
}else {
|
||||
if(user.getDisableFlag().equals("1")){
|
||||
return Result.error("该用户已被封禁,请勿重复操作");
|
||||
}
|
||||
user.setDisableFlag("1");
|
||||
}
|
||||
tsUserDao.updateById(user);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user