62 lines
2.2 KiB
Java
62 lines
2.2 KiB
Java
package com.ruoyi.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.ruoyi.common.core.domain.BaseEntity;
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
import com.ruoyi.frequency.agreement.entity.Agreement;
|
|
import com.ruoyi.frequency.agreement.service.AgreementService;
|
|
import com.ruoyi.response.ResponseData;
|
|
import com.ruoyi.vo.RyController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 协议
|
|
*
|
|
* @author a
|
|
* @date 2023/8/18 15:28
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/agreement")
|
|
@Api(tags = "协议")
|
|
public class ApiAgreementController extends RyController {
|
|
|
|
@Autowired
|
|
private AgreementService agreementService;
|
|
|
|
@PostMapping("/getAgreement/{code}")
|
|
@ApiOperation(value = "获取协议", notes = "获取协议")
|
|
public ResponseData<Agreement> getAgreement(@PathVariable String code) {
|
|
Agreement agreement = agreementService.getOne(new QueryWrapper<Agreement>().lambda()
|
|
.eq(Agreement::getCode, code)
|
|
.orderByDesc(BaseEntity::getCreateTime).last("limit 1"));
|
|
return ResponseData.success(agreement);
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = "/getAgreementList/{codes}", method = RequestMethod.POST)
|
|
@ApiOperation(value = "获取协议多个")
|
|
public ResponseData<List<SysDictData>> getAgreementList(@PathVariable String[] codes) {
|
|
List<Agreement> list = agreementService.list(new QueryWrapper<Agreement>().lambda()
|
|
.in(Agreement::getCode, codes)
|
|
.orderByDesc(BaseEntity::getCreateTime));
|
|
return ResponseData.success(list);
|
|
}
|
|
|
|
|
|
@GetMapping("/agreementRichText/{code}")
|
|
@ApiOperation(value = "获取协议富文本", notes = "获取协议富文本")
|
|
public String agreementRichText(@PathVariable String code) {
|
|
Agreement agreement = agreementService.getOne(new QueryWrapper<Agreement>().lambda()
|
|
.eq(Agreement::getCode, code)
|
|
.orderByDesc(BaseEntity::getCreateTime).last("limit 1"));
|
|
return agreement == null? null : agreement.getContent();
|
|
}
|
|
|
|
}
|