| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.api.model.operation.XpAgreement; |
| | | import com.xiaopeng.api.model.operation.XpLoginAgreement; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.operation.dto.XpAgreementDTO; |
| | |
| | | xpAgreementService.saveAgreement(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取登录协议列表", tags = {"管理后台-内容中心"}) |
| | | @GetMapping("/api/v1/agreement/getLoginAgreementPageList/{type}") |
| | | @ApiParam(name = "type", value = "类型(1=用户登录协议,2=运维APP登录协议)") |
| | | public R<List<XpLoginAgreement>> getLoginAgreementPageList(@PathVariable Integer type) { |
| | | List<XpLoginAgreement> list = xpLoginAgreementService.list(new QueryWrapper<XpLoginAgreement>().eq("type", type) |
| | | .eq("is_deleted", 0).orderByDesc("sort")); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "保存登录协议", tags = {"管理后台-内容中心"}) |
| | | @PostMapping("/api/v1/agreement/saveLoginAgreement") |
| | | public R<?> saveLoginAgreement(@RequestBody @Valid XpLoginAgreement dto) { |
| | | long count = xpLoginAgreementService.count(new QueryWrapper<XpLoginAgreement>().eq("type", dto.getType())); |
| | | dto.setSort(Long.valueOf(count + 1).intValue()); |
| | | xpLoginAgreementService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "删除登录协议", tags = {"管理后台-内容中心"}) |
| | | @DeleteMapping("/api/v1/agreement/deleteLoginAgreement/{id}") |
| | | public R<?> deleteLoginAgreement(@PathVariable Integer id) { |
| | | xpLoginAgreementService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |