Java Code Examples for org.jeecg.modules.system.entity.SysCategory#setPid()

The following examples show how to use org.jeecg.modules.system.entity.SysCategory#setPid() . 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: SysCategoryController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
  * 分页列表查询
 * @param sysCategory
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/rootList")
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid("0");
	}
	Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
	
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
	//QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
	QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
	queryWrapper.eq("pid", sysCategory.getPid());
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
	
	Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
	IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 2
Source File: SysCategoryController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
  * 分页列表查询
 * @param sysCategory
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/rootList")
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid("0");
	}
	Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
	
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
	//QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
	QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
	queryWrapper.eq("pid", sysCategory.getPid());
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
	
	Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
	IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 3
Source File: SysCategoryController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 分页列表查询
 * @param sysCategory
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/rootList")
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid("0");
	}
	Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
	
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
	//QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
	QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
	queryWrapper.eq("pid", sysCategory.getPid());
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
	
	Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
	IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 4
Source File: SysCategoryController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
  * 分页列表查询
 * @param sysCategory
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/rootList")
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid("0");
	}
	Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
	
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start
	//QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
	QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
	queryWrapper.eq("pid", sysCategory.getPid());
	//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
	
	Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
	IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 5
Source File: SysCategoryServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public void addSysCategory(SysCategory sysCategory) {
	String categoryCode = "";
	String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
	String parentCode = null;
	if(oConvertUtils.isNotEmpty(sysCategory.getPid())){
		categoryPid = sysCategory.getPid();

		//PID 不是根节点 说明需要设置父节点 hasChild 为1
		if(!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
			SysCategory parent = baseMapper.selectById(categoryPid);
			parentCode = parent.getCode();
			if(parent!=null && !"1".equals(parent.getHasChild())){
				parent.setHasChild("1");
				baseMapper.updateById(parent);
			}
		}
	}
	//update-begin--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	JSONObject formData = new JSONObject();
	formData.put("pid",categoryPid);
	categoryCode = (String) FillRuleUtil.executeRule(FillRuleConstant.CATEGORY,formData);
	//update-end--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	sysCategory.setCode(categoryCode);
	sysCategory.setPid(categoryPid);
	baseMapper.insert(sysCategory);
}
 
Example 6
Source File: SysCategoryServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public void updateSysCategory(SysCategory sysCategory) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
	}else{
		//如果当前节点父ID不为空 则设置父节点的hasChild 为1
		SysCategory parent = baseMapper.selectById(sysCategory.getPid());
		if(parent!=null && !"1".equals(parent.getHasChild())){
			parent.setHasChild("1");
			baseMapper.updateById(parent);
		}
	}
	baseMapper.updateById(sysCategory);
}
 
Example 7
Source File: SysCategoryServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
public void updateSysCategory(SysCategory sysCategory) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
	}else{
		//如果当前节点父ID不为空 则设置父节点的hasChild 为1
		SysCategory parent = baseMapper.selectById(sysCategory.getPid());
		if(parent!=null && !"1".equals(parent.getHasChild())){
			parent.setHasChild("1");
			baseMapper.updateById(parent);
		}
	}
	baseMapper.updateById(sysCategory);
}
 
Example 8
Source File: SysCategoryServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public void addSysCategory(SysCategory sysCategory) {
	String categoryCode = "";
	String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
	String parentCode = null;
	if(oConvertUtils.isNotEmpty(sysCategory.getPid())){
		categoryPid = sysCategory.getPid();

		//PID 不是根节点 说明需要设置父节点 hasChild 为1
		if(!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
			SysCategory parent = baseMapper.selectById(categoryPid);
			parentCode = parent.getCode();
			if(parent!=null && !"1".equals(parent.getHasChild())){
				parent.setHasChild("1");
				baseMapper.updateById(parent);
			}
		}
	}
	//update-begin--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	JSONObject formData = new JSONObject();
	formData.put("pid",categoryPid);
	categoryCode = (String) FillRuleUtil.executeRule("category_code_rule",formData);
	//update-end--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	sysCategory.setCode(categoryCode);
	sysCategory.setPid(categoryPid);
	baseMapper.insert(sysCategory);
}
 
Example 9
Source File: SysCategoryServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public void updateSysCategory(SysCategory sysCategory) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
	}else{
		//如果当前节点父ID不为空 则设置父节点的hasChild 为1
		SysCategory parent = baseMapper.selectById(sysCategory.getPid());
		if(parent!=null && !"1".equals(parent.getHasChild())){
			parent.setHasChild("1");
			baseMapper.updateById(parent);
		}
	}
	baseMapper.updateById(sysCategory);
}
 
Example 10
Source File: SysCategoryServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void addSysCategory(SysCategory sysCategory) {
	String categoryCode = "";
	String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
	String parentCode = null;
	if(oConvertUtils.isNotEmpty(sysCategory.getPid())){
		categoryPid = sysCategory.getPid();

		//PID 不是根节点 说明需要设置父节点 hasChild 为1
		if(!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
			SysCategory parent = baseMapper.selectById(categoryPid);
			parentCode = parent.getCode();
			if(parent!=null && !"1".equals(parent.getHasChild())){
				parent.setHasChild("1");
				baseMapper.updateById(parent);
			}
		}
	}
	//update-begin--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	JSONObject formData = new JSONObject();
	formData.put("pid",categoryPid);
	categoryCode = (String) FillRuleUtil.executeRule(FillRuleConstant.CATEGORY,formData);
	//update-end--Author:baihailong  Date:20191209 for:分类字典编码规则生成器做成公用配置
	sysCategory.setCode(categoryCode);
	sysCategory.setPid(categoryPid);
	baseMapper.insert(sysCategory);
}
 
Example 11
Source File: SysCategoryServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void updateSysCategory(SysCategory sysCategory) {
	if(oConvertUtils.isEmpty(sysCategory.getPid())){
		sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
	}else{
		//如果当前节点父ID不为空 则设置父节点的hasChild 为1
		SysCategory parent = baseMapper.selectById(sysCategory.getPid());
		if(parent!=null && !"1".equals(parent.getHasChild())){
			parent.setHasChild("1");
			baseMapper.updateById(parent);
		}
	}
	baseMapper.updateById(sysCategory);
}
 
Example 12
Source File: SysCategoryServiceImpl.java    From jeecg-boot-with-activiti with MIT License 4 votes vote down vote up
@Override
public void addSysCategory(SysCategory sysCategory) {
	String categoryCode = "";
	String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
	String parentCode = null;
	if(oConvertUtils.isNotEmpty(sysCategory.getPid())){
		categoryPid = sysCategory.getPid();

		//PID 不是根节点 说明需要设置父节点 hasChild 为1
		if(!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
			SysCategory parent = baseMapper.selectById(categoryPid);
			parentCode = parent.getCode();
			if(parent!=null && !"1".equals(parent.getHasChild())){
				parent.setHasChild("1");
				baseMapper.updateById(parent);
			}
		}
	}
	/*
	* 分成三种情况
	* 1.数据库无数据 调用YouBianCodeUtil.getNextYouBianCode(null);
	* 2.添加子节点,无兄弟元素 YouBianCodeUtil.getSubYouBianCode(parentCode,null);
	* 3.添加子节点有兄弟元素 YouBianCodeUtil.getNextYouBianCode(lastCode);
	* */
	//找同类 确定上一个最大的code值
	LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>()
			.eq(SysCategory::getPid,categoryPid)
			.orderByDesc(SysCategory::getCode);
	List<SysCategory> list = baseMapper.selectList(query);
	if(list==null || list.size()==0){
		if(ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
			//情况1
			categoryCode = YouBianCodeUtil.getNextYouBianCode(null);
		}else{
			//情况2
			categoryCode = YouBianCodeUtil.getSubYouBianCode(parentCode,null);
		}
	}else{
		//情况3
		categoryCode = YouBianCodeUtil.getNextYouBianCode(list.get(0).getCode());
	}
	sysCategory.setCode(categoryCode);
	sysCategory.setPid(categoryPid);
	baseMapper.insert(sysCategory);
}