Java Code Examples for org.jeecg.common.constant.CacheConstant#SYS_DEPARTS_CACHE

The following examples show how to use org.jeecg.common.constant.CacheConstant#SYS_DEPARTS_CACHE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysDepartController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 编辑数据 编辑部门的部分数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	String username = JwtUtil.getUserNameByToken(request);
	sysDepart.setUpdateBy(username);
	Result<SysDepart> result = new Result<SysDepart>();
	SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
	if (sysDepartEntity == null) {
		result.error500("未找到对应实体");
	} else {
		boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
		// TODO 返回false说明什么?
		if (ok) {
			//清除部门树内存
			//FindsDepartsChildrenUtil.clearSysDepartTreeList();
			//FindsDepartsChildrenUtil.clearDepartIdModel();
			result.success("修改成功!");
		}
	}
	return result;
}
 
Example 2
Source File: SysDepartController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    *   通过id删除
   * @param id
   * @return
   */
//@RequiresRoles({"admin"})
   @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
  public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {

      Result<SysDepart> result = new Result<SysDepart>();
      SysDepart sysDepart = sysDepartService.getById(id);
      if(sysDepart==null) {
          result.error500("未找到对应实体");
      }else {
          boolean ok = sysDepartService.delete(id);
          if(ok) {
            //清除部门树内存
   		   //FindsDepartsChildrenUtil.clearSysDepartTreeList();
   		   // FindsDepartsChildrenUtil.clearDepartIdModel();
              result.success("删除成功!");
          }
      }
      return result;
  }
 
Example 3
Source File: SysDepartController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 编辑数据 编辑部门的部分数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	String username = JwtUtil.getUserNameByToken(request);
	sysDepart.setUpdateBy(username);
	Result<SysDepart> result = new Result<SysDepart>();
	SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
	if (sysDepartEntity == null) {
		result.error500("未找到对应实体");
	} else {
		boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
		// TODO 返回false说明什么?
		if (ok) {
			//清除部门树内存
			//FindsDepartsChildrenUtil.clearSysDepartTreeList();
			//FindsDepartsChildrenUtil.clearDepartIdModel();
			result.success("修改成功!");
		}
	}
	return result;
}
 
Example 4
Source File: SysDepartController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	Result<SysDepart> result = new Result<SysDepart>();
	String username = JwtUtil.getUserNameByToken(request);
	try {
		sysDepart.setCreateBy(username);
		sysDepartService.saveDepartData(sysDepart, username);
		//清除部门树内存
		// FindsDepartsChildrenUtil.clearSysDepartTreeList();
		// FindsDepartsChildrenUtil.clearDepartIdModel();
		result.success("添加成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example 5
Source File: SysDepartController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    *   通过id删除
   * @param id
   * @return
   */
   @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
  public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {

      Result<SysDepart> result = new Result<SysDepart>();
      SysDepart sysDepart = sysDepartService.getById(id);
      if(sysDepart==null) {
          result.error500("未找到对应实体");
      }else {
          boolean ok = sysDepartService.delete(id);
          if(ok) {
            //清除部门树内存
   		   //FindsDepartsChildrenUtil.clearSysDepartTreeList();
   		   // FindsDepartsChildrenUtil.clearDepartIdModel();
              result.success("删除成功!");
          }
      }
      return result;
  }
 
Example 6
Source File: SysDepartController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 编辑数据 编辑部门的部分数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	String username = JwtUtil.getUserNameByToken(request);
	sysDepart.setUpdateBy(username);
	Result<SysDepart> result = new Result<SysDepart>();
	SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
	if (sysDepartEntity == null) {
		result.error500("未找到对应实体");
	} else {
		boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
		// TODO 返回false说明什么?
		if (ok) {
			//清除部门树内存
			//FindsDepartsChildrenUtil.clearSysDepartTreeList();
			//FindsDepartsChildrenUtil.clearDepartIdModel();
			result.success("修改成功!");
		}
	}
	return result;
}
 
Example 7
Source File: SysDepartController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	Result<SysDepart> result = new Result<SysDepart>();
	String username = JwtUtil.getUserNameByToken(request);
	try {
		sysDepart.setCreateBy(username);
		sysDepartService.saveDepartData(sysDepart, username);
		//清除部门树内存
		// FindsDepartsChildrenUtil.clearSysDepartTreeList();
		// FindsDepartsChildrenUtil.clearDepartIdModel();
		result.success("添加成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example 8
Source File: SysDepartController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
    *   通过id删除
   * @param id
   * @return
   */
   @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
  public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {

      Result<SysDepart> result = new Result<SysDepart>();
      SysDepart sysDepart = sysDepartService.getById(id);
      if(sysDepart==null) {
          result.error500("未找到对应实体");
      }else {
          boolean ok = sysDepartService.delete(id);
          if(ok) {
            //清除部门树内存
   		   //FindsDepartsChildrenUtil.clearSysDepartTreeList();
   		   // FindsDepartsChildrenUtil.clearDepartIdModel();
              result.success("删除成功!");
          }
      }
      return result;
  }
 
Example 9
Source File: SysDepartController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 编辑数据 编辑部门的部分数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	String username = JwtUtil.getUserNameByToken(request);
	sysDepart.setUpdateBy(username);
	Result<SysDepart> result = new Result<SysDepart>();
	SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
	if (sysDepartEntity == null) {
		result.error500("未找到对应实体");
	} else {
		boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
		// TODO 返回false说明什么?
		if (ok) {
			//清除部门树内存
			//FindsDepartsChildrenUtil.clearSysDepartTreeList();
			//FindsDepartsChildrenUtil.clearDepartIdModel();
			result.success("修改成功!");
		}
	}
	return result;
}
 
Example 10
Source File: SysDepartController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	Result<SysDepart> result = new Result<SysDepart>();
	String username = JwtUtil.getUserNameByToken(request);
	try {
		sysDepart.setCreateBy(username);
		sysDepartService.saveDepartData(sysDepart, username);
		//清除部门树内存
		// FindsDepartsChildrenUtil.clearSysDepartTreeList();
		// FindsDepartsChildrenUtil.clearDepartIdModel();
		result.success("添加成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example 11
Source File: SysDepartController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
    *   通过id删除
   * @param id
   * @return
   */
//@RequiresRoles({"admin"})
   @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
  public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {

      Result<SysDepart> result = new Result<SysDepart>();
      SysDepart sysDepart = sysDepartService.getById(id);
      if(sysDepart==null) {
          result.error500("未找到对应实体");
      }else {
          boolean ok = sysDepartService.delete(id);
          if(ok) {
            //清除部门树内存
   		   //FindsDepartsChildrenUtil.clearSysDepartTreeList();
   		   // FindsDepartsChildrenUtil.clearDepartIdModel();
              result.success("删除成功!");
          }
      }
      return result;
  }
 
Example 12
Source File: SysDepartController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
 * 
 * @param sysDepart
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
	Result<SysDepart> result = new Result<SysDepart>();
	String username = JwtUtil.getUserNameByToken(request);
	try {
		sysDepart.setCreateBy(username);
		sysDepartService.saveDepartData(sysDepart, username);
		//清除部门树内存
		// FindsDepartsChildrenUtil.clearSysDepartTreeList();
		// FindsDepartsChildrenUtil.clearDepartIdModel();
		result.success("添加成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example 13
Source File: SysDepartController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
 * 
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {

	Result<SysDepart> result = new Result<SysDepart>();
	if (ids == null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	} else {
		this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example 14
Source File: SysDepartServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
 */
@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
@Override
public List<SysDepartTreeModel> queryTreeList() {
	LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
	query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
	query.orderByAsc(SysDepart::getDepartOrder);
	List<SysDepart> list = this.list(query);
	// 调用wrapTreeDataToTreeList方法生成树状数据
	List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
	return listResult;
}
 
Example 15
Source File: SysDepartServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
 */
@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
@Override
public List<SysDepartTreeModel> queryTreeList() {
	LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
	query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
	query.orderByAsc(SysDepart::getDepartOrder);
	List<SysDepart> list = this.list(query);
	// 调用wrapTreeDataToTreeList方法生成树状数据
	List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
	return listResult;
}
 
Example 16
Source File: SysDepartController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
 * 
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {

	Result<SysDepart> result = new Result<SysDepart>();
	if (ids == null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	} else {
		this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example 17
Source File: SysDepartServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
 */
@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
@Override
public List<SysDepartTreeModel> queryTreeList() {
	LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
	query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
	query.orderByAsc(SysDepart::getDepartOrder);
	List<SysDepart> list = this.list(query);
	// 调用wrapTreeDataToTreeList方法生成树状数据
	List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
	return listResult;
}
 
Example 18
Source File: SysDepartController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
 * 
 * @param ids
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {

	Result<SysDepart> result = new Result<SysDepart>();
	if (ids == null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	} else {
		this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example 19
Source File: SysDepartController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
 * 
 * @param ids
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {

	Result<SysDepart> result = new Result<SysDepart>();
	if (ids == null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	} else {
		this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example 20
Source File: SysDepartServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
 */
@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE)
@Override
public List<SysDepartTreeModel> queryTreeList() {
	LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
	query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
	query.orderByAsc(SysDepart::getDepartOrder);
	List<SysDepart> list = this.list(query);
	// 调用wrapTreeDataToTreeList方法生成树状数据
	List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
	return listResult;
}