Search in sources :

Example 1 with SysPosition

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;
}
Also used : SysPosition(org.jeecg.modules.system.entity.SysPosition) Result(org.jeecg.common.api.vo.Result) AutoLog(org.jeecg.common.aspect.annotation.AutoLog) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with SysPosition

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;
}
Also used : SysPosition(org.jeecg.modules.system.entity.SysPosition) ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LoginUser(org.jeecg.common.system.vo.LoginUser)

Example 3 with SysPosition

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;
}
Also used : SysPosition(org.jeecg.modules.system.entity.SysPosition) ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 4 with SysPosition

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;
}
Also used : SysPosition(org.jeecg.modules.system.entity.SysPosition) Result(org.jeecg.common.api.vo.Result) AutoLog(org.jeecg.common.aspect.annotation.AutoLog) ApiOperation(io.swagger.annotations.ApiOperation)

Example 5 with SysPosition

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;
}
Also used : SysPosition(org.jeecg.modules.system.entity.SysPosition) Result(org.jeecg.common.api.vo.Result) AutoLog(org.jeecg.common.aspect.annotation.AutoLog) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

SysPosition (org.jeecg.modules.system.entity.SysPosition)12 ApiOperation (io.swagger.annotations.ApiOperation)9 Result (org.jeecg.common.api.vo.Result)9 AutoLog (org.jeecg.common.aspect.annotation.AutoLog)9 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 ExportParams (org.jeecgframework.poi.excel.entity.ExportParams)3 JeecgEntityExcelView (org.jeecgframework.poi.excel.view.JeecgEntityExcelView)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 LoginUser (org.jeecg.common.system.vo.LoginUser)1