Commit 2475bce1 authored by zhangc's avatar zhangc

修改字段返回类型

parent 537c0aa0
......@@ -89,7 +89,7 @@ CREATE TABLE `t_api_org` (
`org_phone` varchar(20) NULL DEFAULT NULL COMMENT '组织电话',
`linkman` varchar(50) NULL DEFAULT NULL COMMENT '组织联系人'
`org_type` varchar(20) NULL DEFAULT NULL COMMENT '组织类型:OUT 外部组织, IN 内部组织',
`status` varchar(100) NOT NULL COMMENT '状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)',
`status` tinyint(2) DEFAULT '1' COMMENT '状态: 0- 注销 1- 正常',
`org_mail` varchar(100) DEFAULT NULL COMMENT '组织邮箱',
`org_sort` int(10) DEFAULT '999' COMMENT '组织排序',
`parent_id` varchar(100) DEFAULT NULL COMMENT '父类组织编码',
......
......@@ -62,10 +62,10 @@ public class ApiOrg extends BaseObject implements Serializable {
private String orgType;
/**
* 状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)
* 状态(NORMAL-正常(true) FREEZE-冻结 CANCEL-注销(false))
*/
@TableField("status")
private String status;
private Boolean status;
/**
* 组织邮箱
......
......@@ -356,7 +356,8 @@ public class AuthServiceImpl implements AuthService {
QueryWrapper<ApiOrg> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(key)){
query.and(wrapper -> wrapper.like("org_name",key)
.or().like("org_code",key));
.or().like("org_code",key)
.or().like("linkman",key));
}
return Result.of_success(apiOrgMapper.selectList(query));
}
......
......@@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Date;
......@@ -61,17 +60,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
query.eq("is_deleted", 0);
query.ne("status",OrgStatusEnum.CANCEL);
query.orderByDesc("create_date");
IPage<ApiOrg> orgIPage = apiOrgMapper.selectPage(page, query);
if (!CollectionUtils.isEmpty(orgIPage.getRecords())){
orgIPage.getRecords().forEach(x->{
if (OrgStatusEnum.CANCEL.name().equals(x.getStatus())){
x.setStatus("false");
}else {
x.setStatus("true");
}
});
}
return orgIPage;
return apiOrgMapper.selectPage(page, query);
}
/**
......@@ -85,16 +74,8 @@ public class OrganizationManageImpl implements OrganizationManageService {
QueryWrapper<ApiOrg> query = new QueryWrapper<>();
query.eq("is_deleted", 0);
query.eq("id", req.getId());
query.ne("status",OrgStatusEnum.CANCEL);
ApiOrg apiOrg = apiOrgMapper.selectOne(query);
if (null != apiOrg) {
if (OrgStatusEnum.CANCEL.name().equals(apiOrg.getStatus())) {
apiOrg.setStatus("false");
} else {
apiOrg.setStatus("true");
}
}
return Result.of_success(apiOrg);
query.ne("status",0);
return Result.of_success(apiOrgMapper.selectOne(query));
}
/**
......@@ -119,23 +100,16 @@ public class OrganizationManageImpl implements OrganizationManageService {
String coding = "";
ApiOrg apiOrg = new ApiOrg();
BeanUtils.copyProperties(req, apiOrg);
//更新
if (null != req.getId()){
if (null != req.getId()){//更新
ApiOrg org = apiOrgMapper.selectById(req.getId());
if (null == org){
return Result.of_error(ResultMsg.DATA_NOT_EXIST);
}
if (req.getStatus()){
org.setStatus(OrgStatusEnum.NORMAL.name());
}else {
org.setStatus(OrgStatusEnum.CANCEL.name());
}
org.setUpdateDate(new Date());
if ( apiOrgMapper.updateById(apiOrg) > 0){
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
//添加
}else {
}else {//添加
if (StringUtils.isNotBlank(req.getOrgType()) //内部组织
&& Constants.AUTH_INT.equals(req.getOrgType())) {
coding = generateCode(req.getOrgName(), Constants.AUTH_INT);
......@@ -146,7 +120,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
return Result.of_error("生成组织编码异常!");
}
apiOrg.setOrgCode(coding);//组织编码
apiOrg.setStatus(OrgStatusEnum.NORMAL.name());//正常
if (apiOrgMapper.insert(apiOrg) > 0) {
return Result.of_success(ResultMsg.INSERT_SUCCESS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment