Search in sources :

Example 1 with SysUserAgent

use of org.jeecg.modules.system.entity.SysUserAgent in project jeecg-boot by jeecgboot.

the class SysUserAgentController method queryById.

/**
 * 通过id查询
 * @param id
 * @return
 */
@GetMapping(value = "/queryById")
public Result<SysUserAgent> queryById(@RequestParam(name = "id", required = true) String id) {
    Result<SysUserAgent> result = new Result<SysUserAgent>();
    SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
    if (sysUserAgent == null) {
        result.error500("未找到对应实体");
    } else {
        result.setResult(sysUserAgent);
        result.setSuccess(true);
    }
    return result;
}
Also used : SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) Result(org.jeecg.common.api.vo.Result) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with SysUserAgent

use of org.jeecg.modules.system.entity.SysUserAgent in project jeecg-boot by jeecgboot.

the class SysUserAgentController method queryByUserName.

/**
 * 通过userName查询
 * @param userName
 * @return
 */
@GetMapping(value = "/queryByUserName")
public Result<SysUserAgent> queryByUserName(@RequestParam(name = "userName", required = true) String userName) {
    Result<SysUserAgent> result = new Result<SysUserAgent>();
    LambdaQueryWrapper<SysUserAgent> queryWrapper = new LambdaQueryWrapper<SysUserAgent>();
    queryWrapper.eq(SysUserAgent::getUserName, userName);
    SysUserAgent sysUserAgent = sysUserAgentService.getOne(queryWrapper);
    if (sysUserAgent == null) {
        result.error500("未找到对应实体");
    } else {
        result.setResult(sysUserAgent);
        result.setSuccess(true);
    }
    return result;
}
Also used : SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) Result(org.jeecg.common.api.vo.Result) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with SysUserAgent

use of org.jeecg.modules.system.entity.SysUserAgent in project jeecg-boot by jeecgboot.

the class SysUserAgentController method delete.

/**
 *   通过id删除
 * @param id
 * @return
 */
@DeleteMapping(value = "/delete")
public Result<SysUserAgent> delete(@RequestParam(name = "id", required = true) String id) {
    Result<SysUserAgent> result = new Result<SysUserAgent>();
    SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
    if (sysUserAgent == null) {
        result.error500("未找到对应实体");
    } else {
        boolean ok = sysUserAgentService.removeById(id);
        if (ok) {
            result.success("删除成功!");
        }
    }
    return result;
}
Also used : SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) Result(org.jeecg.common.api.vo.Result) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Example 4 with SysUserAgent

use of org.jeecg.modules.system.entity.SysUserAgent in project jeecg-boot by jeecgboot.

the class SysUserAgentController method exportXls.

/**
 * 导出excel
 *
 * @param sysUserAgent
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent, HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    // 导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:" + user.getRealname(), "导出信息");
    exportParams.setImageBasePath(upLoadPath);
    mv.addObject(NormalExcelConstants.PARAMS, exportParams);
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) LoginUser(org.jeecg.common.system.vo.LoginUser) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with SysUserAgent

use of org.jeecg.modules.system.entity.SysUserAgent in project kms by mahonelau.

the class SysUserAgentController method queryById.

/**
 * 通过id查询
 * @param id
 * @return
 */
@GetMapping(value = "/queryById")
public Result<SysUserAgent> queryById(@RequestParam(name = "id", required = true) String id) {
    Result<SysUserAgent> result = new Result<SysUserAgent>();
    SysUserAgent sysUserAgent = sysUserAgentService.getById(id);
    if (sysUserAgent == null) {
        result.error500("未找到对应实体");
    } else {
        result.setResult(sysUserAgent);
        result.setSuccess(true);
    }
    return result;
}
Also used : SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) Result(org.jeecg.common.api.vo.Result) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

SysUserAgent (org.jeecg.modules.system.entity.SysUserAgent)18 Result (org.jeecg.common.api.vo.Result)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 GetMapping (org.springframework.web.bind.annotation.GetMapping)6 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)3 IOException (java.io.IOException)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Map (java.util.Map)3 LoginUser (org.jeecg.common.system.vo.LoginUser)3 ExportParams (org.jeecgframework.poi.excel.entity.ExportParams)3 ImportParams (org.jeecgframework.poi.excel.entity.ImportParams)3 JeecgEntityExcelView (org.jeecgframework.poi.excel.view.JeecgEntityExcelView)3 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)3 MultipartFile (org.springframework.web.multipart.MultipartFile)3 MultipartHttpServletRequest (org.springframework.web.multipart.MultipartHttpServletRequest)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 PutMapping (org.springframework.web.bind.annotation.PutMapping)2