org.jeecg.modules.system.entity.SysDictItem Java Examples

The following examples show how to use org.jeecg.modules.system.entity.SysDictItem. 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: SysDictServiceImpl.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
@Override
  @Transactional
  public Integer saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList) {
int insert=0;
  	try{
	 insert = sysDictMapper.insert(sysDict);
	if (sysDictItemList != null) {
		for (SysDictItem entity : sysDictItemList) {
			entity.setDictId(sysDict.getId());
			entity.setStatus(1);
			sysDictItemMapper.insert(entity);
		}
	}
}catch(Exception e){
	return insert;
}
return insert;
  }
 
Example #2
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:编辑
 * @param sysDictItem
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
	if(sysdict==null) {
		result.error500("未找到对应实体");
	}else {
		sysDictItem.setUpdateTime(new Date());
		boolean ok = sysDictItemService.updateById(sysDictItem);
		//TODO 返回false说明什么?
		if(ok) {
			result.success("编辑成功!");
		}
	}
	return result;
}
 
Example #3
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:删除字典数据
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem joinSystem = sysDictItemService.getById(id);
	if(joinSystem==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysDictItemService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #4
Source File: SysDictServiceImpl.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, List<DictModel>> queryAllDictItems() {
	Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>();
	List<SysDict> ls = sysDictMapper.selectList(null);
	LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
	queryWrapper.eq(SysDictItem::getStatus, 1);
	queryWrapper.orderByAsc(SysDictItem::getSortOrder);
	List<SysDictItem> sysDictItemList = sysDictItemMapper.selectList(queryWrapper);

	for (SysDict d : ls) {
		List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> {
			DictModel dictModel = new DictModel();
			dictModel.setText(item.getItemText());
			dictModel.setValue(item.getItemValue());
			return dictModel;
		}).collect(Collectors.toList());
		res.put(d.getDictCode(), dictModelList);
	}
	log.debug("-------登录加载系统字典-----" + res.toString());
	return res;
}
 
Example #5
Source File: SysDictServiceImpl.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, List<DictModel>> queryAllDictItems() {
	Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>();
	List<SysDict> ls = sysDictMapper.selectList(null);
	LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
	queryWrapper.eq(SysDictItem::getStatus, 1);
	queryWrapper.orderByAsc(SysDictItem::getSortOrder);
	List<SysDictItem> sysDictItemList = sysDictItemMapper.selectList(queryWrapper);

	for (SysDict d : ls) {
		List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> {
			DictModel dictModel = new DictModel();
			dictModel.setText(item.getItemText());
			dictModel.setValue(item.getItemValue());
			return dictModel;
		}).collect(Collectors.toList());
		res.put(d.getDictCode(), dictModelList);
	}
	log.debug("-------登录加载系统字典-----" + res.toString());
	return res;
}
 
Example #6
Source File: SysDictServiceImpl.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
@Override
  @Transactional
  public Integer saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList) {
int insert=0;
  	try{
	 insert = sysDictMapper.insert(sysDict);
	if (sysDictItemList != null) {
		for (SysDictItem entity : sysDictItemList) {
			entity.setDictId(sysDict.getId());
			entity.setStatus(1);
			sysDictItemMapper.insert(entity);
		}
	}
}catch(Exception e){
	return insert;
}
return insert;
  }
 
Example #7
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:删除字典数据
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem joinSystem = sysDictItemService.getById(id);
	if(joinSystem==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysDictItemService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #8
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:编辑
 * @param sysDictItem
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
	if(sysdict==null) {
		result.error500("未找到对应实体");
	}else {
		sysDictItem.setUpdateTime(new Date());
		boolean ok = sysDictItemService.updateById(sysDictItem);
		//TODO 返回false说明什么?
		if(ok) {
			result.success("编辑成功!");
		}
	}
	return result;
}
 
Example #9
Source File: SysDictItemController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:编辑
 * @param sysDictItem
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
	if(sysdict==null) {
		result.error500("未找到对应实体");
	}else {
		sysDictItem.setUpdateTime(new Date());
		boolean ok = sysDictItemService.updateById(sysDictItem);
		//TODO 返回false说明什么?
		if(ok) {
			result.success("编辑成功!");
		}
	}
	return result;
}
 
Example #10
Source File: SysDictItemController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:删除字典数据
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem joinSystem = sysDictItemService.getById(id);
	if(joinSystem==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysDictItemService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #11
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:删除字典数据
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem joinSystem = sysDictItemService.getById(id);
	if(joinSystem==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysDictItemService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #12
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:编辑
 * @param sysDictItem
 * @return
 */
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
	if(sysdict==null) {
		result.error500("未找到对应实体");
	}else {
		sysDictItem.setUpdateTime(new Date());
		boolean ok = sysDictItemService.updateById(sysDictItem);
		//TODO 返回false说明什么?
		if(ok) {
			result.success("编辑成功!");
		}
	}
	return result;
}
 
Example #13
Source File: SysDictItemController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #14
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:新增
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	try {
		sysDictItem.setCreateTime(new Date());
		sysDictItemService.save(sysDictItem);
		result.success("保存成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example #15
Source File: SysDictItemController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:新增
 * @param sysDict
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	try {
		sysDictItem.setCreateTime(new Date());
		sysDictItemService.save(sysDictItem);
		result.success("保存成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example #16
Source File: SysDictItemController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:批量删除字典数据
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	if(ids==null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	}else {
		this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example #17
Source File: SysDictController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysDictPage> pageList = new ArrayList<SysDictPage>();

	List<SysDict> sysDictList = sysDictService.list(queryWrapper);
	for (SysDict dictMain : sysDictList) {
		SysDictPage vo = new SysDictPage();
		BeanUtils.copyProperties(dictMain, vo);
		// 查询机票
		List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
		vo.setSysDictItemList(sysDictItemList);
		pageList.add(vo);
	}

	// 导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
	// 注解对象Class
	mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
	// 自定义表格参数
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
	// 导出数据列表
	mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
	return mv;
}
 
Example #18
Source File: SysDictServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
@Transactional
public void saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList) {

    sysDictMapper.insert(sysDict);
    if (sysDictItemList != null) {
        for (SysDictItem entity : sysDictItemList) {
            entity.setDictId(sysDict.getId());
            sysDictItemMapper.insert(entity);
        }
    }
}
 
Example #19
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #20
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:新增
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	try {
		sysDictItem.setCreateTime(new Date());
		sysDictItemService.save(sysDictItem);
		result.success("保存成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example #21
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:批量删除字典数据
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	if(ids==null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	}else {
		this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example #22
Source File: SysDictController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysDictPage> pageList = new ArrayList<SysDictPage>();

	List<SysDict> sysDictList = sysDictService.list(queryWrapper);
	for (SysDict dictMain : sysDictList) {
		SysDictPage vo = new SysDictPage();
		BeanUtils.copyProperties(dictMain, vo);
		// 查询机票
		List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
		vo.setSysDictItemList(sysDictItemList);
		pageList.add(vo);
	}

	// 导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
	// 注解对象Class
	mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
	// 自定义表格参数
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
	// 导出数据列表
	mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
	return mv;
}
 
Example #23
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #24
Source File: SysDictServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
@Transactional
public void saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList) {

    sysDictMapper.insert(sysDict);
    if (sysDictItemList != null) {
        for (SysDictItem entity : sysDictItemList) {
            entity.setDictId(sysDict.getId());
            sysDictItemMapper.insert(entity);
        }
    }
}
 
Example #25
Source File: SysDictController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysDictPage> pageList = new ArrayList<SysDictPage>();

	List<SysDict> sysDictList = sysDictService.list(queryWrapper);
	for (SysDict dictMain : sysDictList) {
		SysDictPage vo = new SysDictPage();
		BeanUtils.copyProperties(dictMain, vo);
		// 查询机票
		List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
		vo.setSysDictItemList(sysDictItemList);
		pageList.add(vo);
	}

	// 导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
	// 注解对象Class
	mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
	// 自定义表格参数
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
	// 导出数据列表
	mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
	return mv;
}
 
Example #26
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:批量删除字典数据
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	if(ids==null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	}else {
		this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example #27
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:新增
 * @param sysDict
 * @return
 */
@RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	try {
		sysDictItem.setCreateTime(new Date());
		sysDictItemService.save(sysDictItem);
		result.success("保存成功!");
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		result.error500("操作失败");
	}
	return result;
}
 
Example #28
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #29
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:批量删除字典数据
 * @param ids
 * @return
 */
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
	Result<SysDictItem> result = new Result<SysDictItem>();
	if(ids==null || "".equals(ids.trim())) {
		result.error500("参数不识别!");
	}else {
		this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
		result.success("删除成功!");
	}
	return result;
}
 
Example #30
Source File: SysDictController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysDictPage> pageList = new ArrayList<SysDictPage>();

	List<SysDict> sysDictList = sysDictService.list(queryWrapper);
	for (SysDict dictMain : sysDictList) {
		SysDictPage vo = new SysDictPage();
		BeanUtils.copyProperties(dictMain, vo);
		// 查询机票
		List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
		vo.setSysDictItemList(sysDictItemList);
		pageList.add(vo);
	}

	// 导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
	// 注解对象Class
	mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
	// 自定义表格参数
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
	// 导出数据列表
	mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
	return mv;
}