组织机构controller处理完毕
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
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.util.List;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
/**
|
||||
* 组织机构管理模块相关接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/org")
|
||||
@Api(tags = {"Sys-组织机构管理"})
|
||||
public class OrgEOController extends BaseController<OrgEO> {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrgEOController.class);
|
||||
|
||||
/**
|
||||
* 组织机构相关Service
|
||||
*/
|
||||
@Resource
|
||||
private OrgEOService orgEOService;
|
||||
|
||||
|
||||
/**
|
||||
* dozer相关,EO间VO转换
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
/**
|
||||
* 分页查询组织机构列表,可以根据组织机构名称进行查询
|
||||
*
|
||||
* @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);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织机构id查询组织机构信息
|
||||
* 权限字段:sys:role:get
|
||||
*
|
||||
* @param id 组织机构id
|
||||
* @return 组织机构详情
|
||||
*/
|
||||
@ApiOperation(value = "|OrgEO|详情")
|
||||
@GetMapping("/{id}")
|
||||
public ResponseMessage<RoleVO> getById(@NotNull @PathVariable("id") String id){
|
||||
OrgEO OrgEO = orgEOService.getById(id);
|
||||
return Result.success(beanMapper.map(OrgEO, RoleVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织机构编码查询组织机构信息
|
||||
*
|
||||
* @param orgCode 组织编码
|
||||
* @return 组织详情
|
||||
*/
|
||||
@ApiOperation(value = "|OrgEO|详情")
|
||||
@GetMapping("getOrgByCode/{orgCode}")
|
||||
public ResponseMessage<OrgEO> getOrgByCode(@NotNull @PathVariable("orgCode") String orgCode) {
|
||||
List<OrgEO> orgEOList = orgEOService.getOrgByCode(orgCode);
|
||||
if (orgEOList.isEmpty()){
|
||||
return Result.error("未获取到组织机构");
|
||||
} else {
|
||||
return Result.success(orgEOList.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示组织机构列表,同时对该用户已有组织机构进行belong字段标注
|
||||
*
|
||||
* @return 组织机构列表
|
||||
*/
|
||||
@ApiOperation(value = "|OrgEO|列表")
|
||||
@GetMapping("")
|
||||
public ResponseMessage<List<OrgEO>> list() {
|
||||
return Result.success(this.orgEOService.list());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface OrgEODao extends BaseDao<OrgEO> {
|
||||
public interface OrgEODao extends BaseMapper<OrgEO> {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,14 @@ import com.adc.da.sys.dao.mysql.*;
|
||||
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.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.extension.service.impl.ServiceImpl;
|
||||
import org.aspectj.weaver.ast.Or;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -18,16 +22,15 @@ import java.util.List;
|
||||
|
||||
@Service("orgEOService")
|
||||
@Transactional
|
||||
public class OrgEOService extends BaseService<OrgEO, String> {
|
||||
public class OrgEOService extends ServiceImpl<OrgEODao, OrgEO> implements IOrgEoService {
|
||||
|
||||
@Resource
|
||||
private UserOrgEODao userOrgEODao;
|
||||
|
||||
@Resource
|
||||
private OrgEODao dao;
|
||||
|
||||
public OrgEODao getDao() {
|
||||
return dao;
|
||||
public List<OrgEO> getOrgByCode(String orgCode) {
|
||||
QueryWrapper<OrgEO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("org_code", orgCode);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.adc.da.sys.service.iservice;
|
||||
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 组织机构业务类
|
||||
*/
|
||||
public interface IOrgEoService extends IService<OrgEO> {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user