| | |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: 额定寿命 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-28 |
| | | * @Date: 2025-07-28 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="额定寿命") |
| | | @Api(tags = "额定寿命") |
| | | @RestController |
| | | @RequestMapping("/cms/ratedLife") |
| | | @Slf4j |
| | | public class RatedLifeController extends JeecgController<RatedLife, IRatedLifeService> { |
| | | @Autowired |
| | | private IRatedLifeService ratedLifeService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param ratedLife |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "额定寿命-分页列表查询") |
| | | @ApiOperation(value="额定寿命-分页列表查询", notes="额定寿命-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<RatedLife>> queryPageList(RatedLife ratedLife, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<RatedLife> queryWrapper = QueryGenerator.initQueryWrapper(ratedLife, req.getParameterMap()); |
| | | Page<RatedLife> page = new Page<RatedLife>(pageNo, pageSize); |
| | | IPage<RatedLife> pageList = ratedLifeService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param ratedLife |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-添加") |
| | | @ApiOperation(value="额定寿命-添加", notes="额定寿命-添加") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody RatedLife ratedLife) { |
| | | ratedLifeService.save(ratedLife); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param ratedLife |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-编辑") |
| | | @ApiOperation(value="额定寿命-编辑", notes="额定寿命-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody RatedLife ratedLife) { |
| | | ratedLifeService.updateById(ratedLife); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-通过id删除") |
| | | @ApiOperation(value="额定寿命-通过id删除", notes="额定寿命-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | ratedLifeService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-批量删除") |
| | | @ApiOperation(value="额定寿命-批量删除", notes="额定寿命-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.ratedLifeService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "额定寿命-通过id查询") |
| | | @ApiOperation(value="额定寿命-通过id查询", notes="额定寿命-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<RatedLife> queryById(@RequestParam(name="id",required=true) String id) { |
| | | RatedLife ratedLife = ratedLifeService.getById(id); |
| | | if(ratedLife==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(ratedLife); |
| | | } |
| | | @Autowired |
| | | private IRatedLifeService ratedLifeService; |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param ratedLife |
| | | */ |
| | | * 分页列表查询 |
| | | * |
| | | * @param ratedLife |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "额定寿命-分页列表查询") |
| | | @ApiOperation(value = "额定寿命-分页列表查询", notes = "额定寿命-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<RatedLife>> queryPageList(RatedLife ratedLife, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<RatedLife> queryWrapper = QueryGenerator.initQueryWrapper(ratedLife, req.getParameterMap()); |
| | | Page<RatedLife> page = new Page<RatedLife>(pageNo, pageSize); |
| | | IPage<RatedLife> pageList = ratedLifeService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param ratedLife |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-添加") |
| | | @ApiOperation(value = "额定寿命-添加", notes = "额定寿命-添加") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody RatedLife ratedLife) { |
| | | ratedLifeService.save(ratedLife); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param ratedLife |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-编辑") |
| | | @ApiOperation(value = "额定寿命-编辑", notes = "额定寿命-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody RatedLife ratedLife) { |
| | | ratedLifeService.updateById(ratedLife); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-通过id删除") |
| | | @ApiOperation(value = "额定寿命-通过id删除", notes = "额定寿命-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
| | | ratedLifeService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "额定寿命-批量删除") |
| | | @ApiOperation(value = "额定寿命-批量删除", notes = "额定寿命-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.ratedLifeService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "额定寿命-通过id查询") |
| | | @ApiOperation(value = "额定寿命-通过id查询", notes = "额定寿命-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<RatedLife> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | RatedLife ratedLife = ratedLifeService.getById(id); |
| | | if (ratedLife == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(ratedLife); |
| | | } |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param ratedLife |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:cms_rated_life:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, RatedLife ratedLife) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("cms_rated_life:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |