|
@@ -0,0 +1,85 @@
|
|
|
|
+package com.xy.service;
|
|
|
|
+
|
|
|
|
+import com.xy.entity.SysAgreement;
|
|
|
|
+import com.xy.mapper.SysAgreementMapper;
|
|
|
|
+import com.xy.service.SysAgreementService;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+import com.xy.utils.R;
|
|
|
|
+import com.xy.utils.PageBean;
|
|
|
|
+import com.xy.dto.SysAgreementDto;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.xy.utils.MybatisPlusQuery;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import com.xy.utils.Emptys;
|
|
|
|
+
|
|
|
|
+import static com.xy.utils.Beans.copy;
|
|
|
|
+import static com.xy.utils.PlusBeans.toIPage;
|
|
|
|
+import static com.xy.utils.PlusBeans.toPageBean;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+* <p>
|
|
|
|
+* 服务实现类
|
|
|
|
+* </p>
|
|
|
|
+*
|
|
|
|
+* @author hechunping
|
|
|
|
+* @since 2023-03-28
|
|
|
|
+*/
|
|
|
|
+@Service
|
|
|
|
+@AllArgsConstructor
|
|
|
|
+@Api(tags = "")
|
|
|
|
+public class SysAgreementServiceImpl extends ServiceImpl<SysAgreementMapper, SysAgreement> implements SysAgreementService {
|
|
|
|
+
|
|
|
|
+ @PostMapping("obj")
|
|
|
|
+ @ApiOperation("对象查询")
|
|
|
|
+ public R<SysAgreementDto.Vo> obj(@RequestBody SysAgreementDto.Vo vo) {
|
|
|
|
+ SysAgreementDto.SelectList selectList = copy(SysAgreementDto.SelectList.class, vo);
|
|
|
|
+ List<SysAgreementDto.Vo> list = list(selectList).getData();
|
|
|
|
+ if(Emptys.check(list)) {
|
|
|
|
+ return R.ok(list.get(0));
|
|
|
|
+ }
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("list")
|
|
|
|
+ @ApiOperation("集合查询")
|
|
|
|
+ public R<List<SysAgreementDto.Vo>> list(@RequestBody SysAgreementDto.SelectList selectList) {
|
|
|
|
+ LambdaQueryWrapper<SysAgreement> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(selectList, SysAgreement.class).build();
|
|
|
|
+ List<SysAgreement> list = list(lambdaQueryWrapper);
|
|
|
|
+ return R.ok(copy(SysAgreementDto.Vo.class, list));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("page")
|
|
|
|
+ @ApiOperation("分页查询")
|
|
|
|
+ public R<PageBean<SysAgreementDto.Vo>> page(@RequestBody SysAgreementDto.Page page) {
|
|
|
|
+ PageBean pageBean = page.getPage();
|
|
|
|
+ LambdaQueryWrapper<SysAgreement> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, SysAgreement.class).build();
|
|
|
|
+ IPage<SysAgreement> iPage = page(toIPage(pageBean), lambdaQueryWrapper);
|
|
|
|
+ return R.ok(toPageBean(SysAgreementDto.Vo.class, iPage));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("save")
|
|
|
|
+ @ApiOperation("添加")
|
|
|
|
+ public R save(@RequestBody @Validated SysAgreementDto.Save save) {
|
|
|
|
+ SysAgreement saveInfo = copy(SysAgreement.class, save);
|
|
|
|
+ save(saveInfo);
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("update")
|
|
|
|
+ @ApiOperation("修改")
|
|
|
|
+ public R update(@RequestBody @Validated SysAgreementDto.Update update) {
|
|
|
|
+ SysAgreement updateInfo = copy(SysAgreement.class, update);
|
|
|
|
+ updateById(updateInfo);
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
|
|
+}
|