use of org.jeecg.modules.system.entity.SysPosition in project jeecg-boot by jeecgboot.
the class SysPositionController method queryById.
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "职务表-通过id查询")
@ApiOperation(value = "职务表-通过id查询", notes = "职务表-通过id查询")
@GetMapping(value = "/queryById")
public Result<SysPosition> queryById(@RequestParam(name = "id", required = true) String id) {
Result<SysPosition> result = new Result<SysPosition>();
SysPosition sysPosition = sysPositionService.getById(id);
if (sysPosition == null) {
result.error500("未找到对应实体");
} else {
result.setResult(sysPosition);
result.setSuccess(true);
}
return result;
}
use of org.jeecg.modules.system.entity.SysPosition in project jeecg-boot by jeecgboot.
the class SysPositionController method exportXls.
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SysPosition> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysPosition> pageList = sysPositionService.list(queryWrapper);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:" + user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
use of org.jeecg.modules.system.entity.SysPosition in project kms by mahonelau.
the class SysPositionController method exportXls.
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SysPosition> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysPosition> pageList = sysPositionService.list(queryWrapper);
// 导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
use of org.jeecg.modules.system.entity.SysPosition in project kms by mahonelau.
the class SysPositionController method queryById.
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "职务表-通过id查询")
@ApiOperation(value = "职务表-通过id查询", notes = "职务表-通过id查询")
@GetMapping(value = "/queryById")
public Result<SysPosition> queryById(@RequestParam(name = "id", required = true) String id) {
Result<SysPosition> result = new Result<SysPosition>();
SysPosition sysPosition = sysPositionService.getById(id);
if (sysPosition == null) {
result.error500("未找到对应实体");
} else {
result.setResult(sysPosition);
result.setSuccess(true);
}
return result;
}
use of org.jeecg.modules.system.entity.SysPosition in project kykms by mahonelau.
the class SysPositionController method edit.
/**
* 编辑
*
* @param sysPosition
* @return
*/
@AutoLog(value = "职务表-编辑")
@ApiOperation(value = "职务表-编辑", notes = "职务表-编辑")
@PutMapping(value = "/edit")
public Result<SysPosition> edit(@RequestBody SysPosition sysPosition) {
Result<SysPosition> result = new Result<SysPosition>();
SysPosition sysPositionEntity = sysPositionService.getById(sysPosition.getId());
if (sysPositionEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = sysPositionService.updateById(sysPosition);
// TODO 返回false说明什么?
if (ok) {
result.success("修改成功!");
}
}
return result;
}
Aggregations