package com.keao.edu.user.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.keao.edu.common.controller.BaseController; import com.keao.edu.common.page.QueryInfo; import com.keao.edu.user.entity.AppVersionInfo; import com.keao.edu.user.service.AppVersionInfoService; @RequestMapping("appVersionInfo") @Api(tags = "APP版本信息服务") @RestController public class AppVersionInfoController extends BaseController { @Autowired private AppVersionInfoService appVersionInfoService; @ApiOperation("分页查询") @GetMapping(value = "/list") @PreAuthorize("@pcs.hasPermissions('appVersionInfo/list')") public Object getList(QueryInfo queryInfo) { return succeed(appVersionInfoService.queryPage(queryInfo)); } @ApiOperation("根据app客户端查询对象") @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path") @GetMapping(value = "/queryByPlatform") public Object queryByPlatform(String platform) { List list = appVersionInfoService.queryNewestByPlatform(platform); if (list.size() > 0) { return succeed(list.get(0)); } return failed(); } @ApiOperation("单查询") @ApiImplicitParam(name = "id", value = "ID编号", required = true, dataType = "Integer", paramType = "path") @GetMapping(value = "/query") @PreAuthorize("@pcs.hasPermissions('appVersionInfo/query')") public Object query(Integer id) { return succeed(appVersionInfoService.get(id)); } @ApiOperation("新增") @PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @PreAuthorize("@pcs.hasPermissions('appVersionInfo/add')") public Object add(AppVersionInfo appVersionInfo) { appVersionInfoService.add(appVersionInfo); return succeed(); } @ApiOperation("更新") @PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @PreAuthorize("@pcs.hasPermissions('appVersionInfo/update')") public Object update(AppVersionInfo appVersionInfo) { appVersionInfoService.updateVersion(appVersionInfo); return succeed(); } }