开发OTA备案工具-车辆升级

This commit is contained in:
高嵩
2023-03-28 17:50:58 +08:00
parent 800b75a582
commit 76a5f985ae
3 changed files with 140 additions and 126 deletions
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -53,11 +54,16 @@ public class OtaBaCxLsjlController extends JeroController<OtaBaCxLsjl, IOtaBaCxL
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<OtaBaCxLsjl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxLsjl, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<OtaBaCxLsjl> page = new Page<OtaBaCxLsjl>(pageNo, pageSize);
IPage<OtaBaCxLsjl> pageList = otaBaCxLsjlService.page(page, queryWrapper);
return Result.OK(pageList);
Object obj = req.getParameterMap().get("otaId");
if(ObjectUtils.isNotEmpty(obj)){
QueryWrapper<OtaBaCxLsjl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxLsjl, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<OtaBaCxLsjl> page = new Page<OtaBaCxLsjl>(pageNo, pageSize);
IPage<OtaBaCxLsjl> pageList = otaBaCxLsjlService.page(page, queryWrapper);
return Result.OK(pageList);
}else{
return Result.OK();
}
}
/**
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaSjLsjl;
@@ -13,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -22,147 +24,152 @@ import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog;
/**
/**
* @Description: 升级备案-历史记录
* @Author: jero-boot
* @Date: 2023-03-17
* @Date: 2023-03-17
* @Version: V1.0
*/
@Api(tags="升级备案-历史记录")
@Api(tags = "升级备案-历史记录")
@RestController
@RequestMapping("/ota/otaBaSjLsjl")
@Slf4j
public class OtaBaSjLsjlController extends JeroController<OtaBaSjLsjl, IOtaBaSjLsjlService> {
@Autowired
private IOtaBaSjLsjlService otaBaSjLsjlService;
/**
* 分页列表查询
*
* @param otaBaSjLsjl
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "升级备案-历史记录-分页列表查询")
@ApiOperation(value="升级备案-历史记录-分页列表查询", notes="升级备案-历史记录-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(OtaBaSjLsjl otaBaSjLsjl,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<OtaBaSjLsjl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjLsjl, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<OtaBaSjLsjl> page = new Page<OtaBaSjLsjl>(pageNo, pageSize);
IPage<OtaBaSjLsjl> pageList = otaBaSjLsjlService.page(page, queryWrapper);
return Result.OK(pageList);
}
@Autowired
private IOtaBaSjLsjlService otaBaSjLsjlService;
/**
* 列表查询
*
* @return
*/
@AutoLog(value = "升级备案-历史记录-列表查询")
@ApiOperation(value="升级备案-历史记录-列表查询", notes="升级备案-历史记录-列表查询")
@GetMapping(value = "/list")
public Result<List<OtaBaSjLsjl>> queryList() {
* 分页列表查询
*
* @param otaBaSjLsjl
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "升级备案-历史记录-分页列表查询")
@ApiOperation(value = "升级备案-历史记录-分页列表查询", notes = "升级备案-历史记录-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(OtaBaSjLsjl otaBaSjLsjl,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Object obj = req.getParameterMap().get("otaId");
if (ObjectUtils.isNotEmpty(obj)) {
QueryWrapper<OtaBaSjLsjl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjLsjl, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<OtaBaSjLsjl> page = new Page<OtaBaSjLsjl>(pageNo, pageSize);
IPage<OtaBaSjLsjl> pageList = otaBaSjLsjlService.page(page, queryWrapper);
return Result.OK(pageList);
} else {
return Result.OK();
}
}
/**
* 列表查询
*
* @return
*/
@AutoLog(value = "升级备案-历史记录-列表查询")
@ApiOperation(value = "升级备案-历史记录-列表查询", notes = "升级备案-历史记录-列表查询")
@GetMapping(value = "/list")
public Result<List<OtaBaSjLsjl>> queryList(@RequestBody OtaBaSjLsjl OtaBaSjLsjl) {
List<OtaBaSjLsjl> list = otaBaSjLsjlService.queryList();
return Result.OK(list);
}
/**
* 添加
*
* @param otaBaSjLsjl
* @return
*/
@AutoLog(value = "升级备案-历史记录-添加")
@ApiOperation(value="升级备案-历史记录-添加", notes="升级备案-历史记录-添加")
@PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaSjLsjl otaBaSjLsjl) {
otaBaSjLsjlService.add(otaBaSjLsjl);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param otaBaSjLsjl
* @return
*/
@AutoLog(value = "升级备案-历史记录-编辑")
@ApiOperation(value="升级备案-历史记录-编辑", notes="升级备案-历史记录-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OtaBaSjLsjl otaBaSjLsjl) {
otaBaSjLsjlService.editById(otaBaSjLsjl);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "升级备案-历史记录-通过id删除")
@ApiOperation(value="升级备案-历史记录-通过id删除", notes="升级备案-历史记录-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
otaBaSjLsjlService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "升级备案-历史记录-批量删除")
@ApiOperation(value="升级备案-历史记录-批量删除", notes="升级备案-历史记录-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.otaBaSjLsjlService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "升级备案-历史记录-通过id查询")
@ApiOperation(value="升级备案-历史记录-通过id查询", notes="升级备案-历史记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
OtaBaSjLsjl otaBaSjLsjl = otaBaSjLsjlService.queryById(id);
if(otaBaSjLsjl==null) {
return Result.error("未找到对应数据");
}
return Result.OK(otaBaSjLsjl);
}
}
/**
* 导出excel
*
* @param request
* @param otaBaSjLsjl
*/
* 添加
*
* @param otaBaSjLsjl
* @return
*/
@AutoLog(value = "升级备案-历史记录-添加")
@ApiOperation(value = "升级备案-历史记录-添加", notes = "升级备案-历史记录-添加")
@PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaSjLsjl otaBaSjLsjl) {
otaBaSjLsjlService.add(otaBaSjLsjl);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param otaBaSjLsjl
* @return
*/
@AutoLog(value = "升级备案-历史记录-编辑")
@ApiOperation(value = "升级备案-历史记录-编辑", notes = "升级备案-历史记录-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OtaBaSjLsjl otaBaSjLsjl) {
otaBaSjLsjlService.editById(otaBaSjLsjl);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "升级备案-历史记录-通过id删除")
@ApiOperation(value = "升级备案-历史记录-通过id删除", notes = "升级备案-历史记录-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
otaBaSjLsjlService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "升级备案-历史记录-批量删除")
@ApiOperation(value = "升级备案-历史记录-批量删除", notes = "升级备案-历史记录-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.otaBaSjLsjlService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "升级备案-历史记录-通过id查询")
@ApiOperation(value = "升级备案-历史记录-通过id查询", notes = "升级备案-历史记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
OtaBaSjLsjl otaBaSjLsjl = otaBaSjLsjlService.queryById(id);
if (otaBaSjLsjl == null) {
return Result.error("未找到对应数据");
}
return Result.OK(otaBaSjLsjl);
}
/**
* 导出excel
*
* @param request
* @param otaBaSjLsjl
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, OtaBaSjLsjl otaBaSjLsjl) {
return super.exportXls(request, otaBaSjLsjl, OtaBaSjLsjl.class, "升级备案-历史记录");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, OtaBaSjLsjl.class);
@@ -69,6 +69,7 @@ public class OtaBaSjLsjl implements Serializable {
/**数据状态*/
@Excel(name = "数据状态", width = 15)
@ApiModelProperty(value = "数据状态")
@Dict(dicCode = "recordstatus")
private java.lang.String sjzt;
}