[新增] 组织管理模块
This commit is contained in:
@@ -1,35 +1,26 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import com.adc.da.base.page.Pager;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.constant.IsBelongEnum;
|
||||
import com.adc.da.sys.dao.mysql.OrgEODao;
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.adc.da.sys.entity.UserOrgEO;
|
||||
import com.adc.da.sys.page.OrgEOPage;
|
||||
import com.adc.da.sys.service.OrgEOService;
|
||||
import com.adc.da.sys.vo.RoleVO;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
/**
|
||||
* 组织机构管理模块相关接口
|
||||
*/
|
||||
@@ -58,20 +49,12 @@ public class OrgEOController extends BaseController<OrgEO> {
|
||||
|
||||
/**
|
||||
* 分页查询组织机构列表,可以根据组织机构名称进行查询
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 分页大小
|
||||
* @return 查询结果分页,异常会返回异常信息
|
||||
*/
|
||||
@ApiOperation(value = "|OrgEO|分页查询")
|
||||
@GetMapping("/page")
|
||||
public ResponseMessage<IPage<OrgEO>> page(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
OrgEO orgEO) {
|
||||
Page<OrgEO> page = new Page<OrgEO>(pageNo, pageSize);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
|
||||
IPage<OrgEO> pageList = this.orgEOService.page(page, queryWrapper);
|
||||
@PostMapping("/page")
|
||||
public ResponseMessage<IPage<OrgEO>> page(@RequestBody OrgEOPage orgEOPage) {
|
||||
IPage<OrgEO> pageList = orgEOService.selectPage(orgEOPage);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
@@ -106,15 +89,39 @@ public class OrgEOController extends BaseController<OrgEO> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增|编辑
|
||||
*/
|
||||
@ApiOperation(value = "新增|编辑")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public ResponseMessage saveOrUpdate(@RequestBody OrgEO orgEO) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime dateTime = LocalDateTime.now();
|
||||
String currentDateTimeString = dateTime.format(formatter);
|
||||
orgEO.setUpdateTime(currentDateTimeString);
|
||||
orgEO.setStatus(1);
|
||||
return Result.success(orgEOService.saveOrUpdate(orgEO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新删除部门
|
||||
*/
|
||||
@ApiOperation(value = "删除部门")
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String ids) {
|
||||
orgEOService.delete(ids);
|
||||
return Result.success();
|
||||
}
|
||||
/**
|
||||
* 显示组织机构列表,同时对该用户已有组织机构进行belong字段标注
|
||||
*
|
||||
* @return 组织机构列表
|
||||
*/
|
||||
@ApiOperation(value = "|OrgEO|列表")
|
||||
@GetMapping("")
|
||||
public ResponseMessage<List<OrgEO>> list() {
|
||||
return Result.success(this.orgEOService.list());
|
||||
@PostMapping("")
|
||||
public ResponseMessage<List<OrgEO>> list(@RequestBody OrgEO orgEO) {
|
||||
List<OrgEO> orgEOList = orgEOService.selectList(orgEO);
|
||||
return Result.success(orgEOList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.adc.da.sys.page.OrgEOPage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrgEODao extends BaseMapper<OrgEO> {
|
||||
|
||||
|
||||
List<OrgEO> selectListByVO(@Param("pageVO")OrgEO orgEO);
|
||||
|
||||
IPage<OrgEO> selectPageByVO(Page<OrgEO> page,@Param("pageVO")OrgEOPage orgEOPage);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class OrgEO extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2386892031753294731L;
|
||||
|
||||
@TableId(value = "FILE_ID",type = IdType.UUID)
|
||||
@TableId(value = "ID",type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,207 +1,60 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class OrgEOPage extends BasePage {
|
||||
|
||||
private static final long serialVersionUID = -2386892031753294731L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private String name;
|
||||
|
||||
private String nameOperator = "=";
|
||||
|
||||
private String orgDesc;
|
||||
|
||||
private String orgDescOperator = "=";
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
private String orgCode;
|
||||
|
||||
private String orgCodeOperator = "=";
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
private String orgType;
|
||||
/**
|
||||
* 部门级别
|
||||
*/
|
||||
private Integer orgLevel;
|
||||
|
||||
private String orgTypeOperator = "=";
|
||||
/**
|
||||
* 父部门编码
|
||||
*/
|
||||
private String supOrgCode;
|
||||
|
||||
private String isShow;
|
||||
/**
|
||||
* 部门简称
|
||||
*/
|
||||
private String orgShortName;
|
||||
|
||||
private String isShowOperator = "=";
|
||||
/**
|
||||
* 归属地
|
||||
*/
|
||||
private String attribution;
|
||||
|
||||
private String parentId;
|
||||
/**
|
||||
* 部门14位码
|
||||
*/
|
||||
private String bmdm14;
|
||||
|
||||
private String parentIdOperator = "=";
|
||||
/**
|
||||
* 状态,1正常,0停用,-1删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String parentIds;
|
||||
|
||||
private String parentIdsOperator = "=";
|
||||
|
||||
private String remarks;
|
||||
|
||||
private String remarksOperator = "=";
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNameOperator() {
|
||||
return nameOperator;
|
||||
}
|
||||
|
||||
public void setNameOperator(String nameOperator) {
|
||||
this.nameOperator = nameOperator;
|
||||
}
|
||||
|
||||
public String getOrgDesc() {
|
||||
return orgDesc;
|
||||
}
|
||||
|
||||
public void setOrgDesc(String orgDesc) {
|
||||
this.orgDesc = orgDesc;
|
||||
}
|
||||
|
||||
public String getOrgDescOperator() {
|
||||
return orgDescOperator;
|
||||
}
|
||||
|
||||
public void setOrgDescOperator(String orgDescOperator) {
|
||||
this.orgDescOperator = orgDescOperator;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getOrgCodeOperator() {
|
||||
return orgCodeOperator;
|
||||
}
|
||||
|
||||
public void setOrgCodeOperator(String orgCodeOperator) {
|
||||
this.orgCodeOperator = orgCodeOperator;
|
||||
}
|
||||
|
||||
public String getOrgType() {
|
||||
return orgType;
|
||||
}
|
||||
|
||||
public void setOrgType(String orgType) {
|
||||
this.orgType = orgType;
|
||||
}
|
||||
|
||||
public String getOrgTypeOperator() {
|
||||
return orgTypeOperator;
|
||||
}
|
||||
|
||||
public void setOrgTypeOperator(String orgTypeOperator) {
|
||||
this.orgTypeOperator = orgTypeOperator;
|
||||
}
|
||||
|
||||
public String getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(String isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
public String getIsShowOperator() {
|
||||
return isShowOperator;
|
||||
}
|
||||
|
||||
public void setIsShowOperator(String isShowOperator) {
|
||||
this.isShowOperator = isShowOperator;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentIdOperator() {
|
||||
return parentIdOperator;
|
||||
}
|
||||
|
||||
public void setParentIdOperator(String parentIdOperator) {
|
||||
this.parentIdOperator = parentIdOperator;
|
||||
}
|
||||
|
||||
public String getParentIds() {
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
public void setParentIds(String parentIds) {
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
public String getParentIdsOperator() {
|
||||
return parentIdsOperator;
|
||||
}
|
||||
|
||||
public void setParentIdsOperator(String parentIdsOperator) {
|
||||
this.parentIdsOperator = parentIdsOperator;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarksOperator() {
|
||||
return remarksOperator;
|
||||
}
|
||||
|
||||
public void setRemarksOperator(String remarksOperator) {
|
||||
this.remarksOperator = remarksOperator;
|
||||
}
|
||||
/**
|
||||
* 更新时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import com.adc.da.base.service.BaseService;
|
||||
import com.adc.da.sys.dao.mysql.*;
|
||||
import com.adc.da.sys.dao.mysql.OrgEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserOrgEODao;
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
import com.adc.da.sys.page.OrgEOPage;
|
||||
import com.adc.da.sys.service.iservice.IOrgEoService;
|
||||
import com.adc.da.util.constant.DeleteFlagEnum;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.aspectj.weaver.ast.Or;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service("orgEOService")
|
||||
@@ -33,4 +28,25 @@ public class OrgEOService extends ServiceImpl<OrgEODao, OrgEO> implements IOrgEo
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
public void delete(String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
OrgEO orgEO = new OrgEO();
|
||||
orgEO.setStatus(-1);
|
||||
QueryWrapper<OrgEO> orgEOQueryWrapper = new QueryWrapper<>();
|
||||
orgEOQueryWrapper.in("ID",idArray);
|
||||
baseMapper.update(orgEO,orgEOQueryWrapper);
|
||||
}
|
||||
|
||||
public List<OrgEO> selectList(OrgEO orgEO) {
|
||||
orgEO.setStatus(1);
|
||||
List<OrgEO> orgEOList = baseMapper.selectListByVO(orgEO);
|
||||
return orgEOList;
|
||||
}
|
||||
|
||||
public IPage<OrgEO> selectPage(OrgEOPage orgEOPage) {
|
||||
orgEOPage.setStatus(1);
|
||||
Page<OrgEO> page = new Page<>(orgEOPage.getPage(), orgEOPage.getPageSize());
|
||||
IPage<OrgEO> orgEOIPage = baseMapper.selectPageByVO(page,orgEOPage);
|
||||
return orgEOIPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IOrgEoService extends IService<OrgEO> {
|
||||
|
||||
|
||||
void delete(String ids);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,47 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.sys.dao.mysql.OrgEODao">
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<if test="pageVO.id != null and pageVO.id !=''">
|
||||
and id = #{pageVO.id}
|
||||
</if>
|
||||
<if test="pageVO.orgCode != null and pageVO.orgCode != ''">
|
||||
and ORG_CODE = #{pageVO.orgCode}
|
||||
</if>
|
||||
<if test="pageVO.orgName != null and pageVO.orgName != ''">
|
||||
and ORG_NAME LIKE CONCAT(CONCAT('%',#{pageVO.orgName}) ,'%')
|
||||
</if>
|
||||
<if test="pageVO.orgLevel != null">
|
||||
and ORG_LEVEL = #{pageVO.orgLevel}
|
||||
</if>
|
||||
<if test="pageVO.supOrgCode != null and pageVO.supOrgCode !=''">
|
||||
and SUP_ORG_CODE = #{pageVO.supOrgCode}
|
||||
</if>
|
||||
<if test="pageVO.orgShortName != null and pageVO.orgShortName != ''">
|
||||
and ORG_SHORT_NAME = #{pageVO.orgShortName}
|
||||
</if>
|
||||
<if test="pageVO.attribution != null and pageVO.attribution != ''">
|
||||
and ATTRIBUTION = #{pageVO.attribution}
|
||||
</if>
|
||||
<if test="pageVO.bmdm14 != null and pageVO.bmdm14 != ''">
|
||||
and BMDM_14 = #{pageVO.bmdm14}
|
||||
</if>
|
||||
<if test="pageVO.status != null">
|
||||
and STATUS = #{pageVO.status}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectListByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
||||
select * from TS_ORG
|
||||
<where>
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectPageByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
||||
select * from TS_ORG
|
||||
<where>
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user