Parcourir la source

增加master缺失文件,3.11

itcast il y a 1 an
Parent
commit
f1e60bc79c

+ 51 - 2
src/main/java/com/om/controller/admin/PcbVersionInfoController.java

@@ -1,9 +1,17 @@
 package com.om.controller.admin;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.om.entity.vo.PcbInfoVO;
+import com.om.service.IPcbVersionDescribeService;
+import com.om.service.IPcbVersionInfoService;
+import com.om.utils.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
 
 /**
  * <p>
@@ -15,6 +23,47 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/pcb-version-info")
+@Api(tags = "系统菜单模块")
+@Slf4j
 public class PcbVersionInfoController {
 
+    @Resource
+    IPcbVersionInfoService infoService;
+    @ApiOperation("增加按钮")
+    @PostMapping("/add")
+    public Result add(@RequestBody PcbInfoVO pcbInfoVO){
+
+        return infoService.add(pcbInfoVO);
+    }
+    @ApiOperation("删除pcb")
+    @GetMapping("/delete")
+    public Result delete(@RequestParam Integer id){
+
+        return infoService.delete(id);
+    }
+    @ApiOperation("下载文件")
+    @GetMapping("/downloadFile")
+    public Result downloadFile(@RequestParam Integer id){
+
+        return infoService.downloadFile(id);
+    }
+    @ApiOperation("修改pcb")
+    @PostMapping("/edit")
+    public Result edit(@RequestBody PcbInfoVO pcbInfoVO){
+
+        return infoService.edit(pcbInfoVO);
+    }
+
+    @ApiOperation("分页查询PCB数据集合")
+    @GetMapping("/getPageList")
+    public Result getPageList(@RequestParam Integer pageIndex,
+                              @RequestParam Integer pageSize,
+                              @RequestParam String username){
+
+        return infoService.getPageList(pageIndex,pageSize,username);
+    }
+
+
+
+
 }

+ 32 - 0
src/main/java/com/om/entity/vo/PcbInfoVO.java

@@ -0,0 +1,32 @@
+package com.om.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PcbInfoVO {
+    @ApiModelProperty(value = "PcbVersionInfoId")
+    private Integer id;
+    @ApiModelProperty(value = "版本编号")
+    private String versionNum;
+    @ApiModelProperty(value = "客户端编号")
+    private String[] clientNum;
+    @ApiModelProperty(value = "上传人名称")
+    private String adminName;
+    @ApiModelProperty(value = "创建时间")
+    private LocalDateTime createTime;
+    @ApiModelProperty(value = "语言")
+    private String[] language;
+    @ApiModelProperty(value = "描述")
+    private String[] description;
+
+
+}

+ 11 - 0
src/main/java/com/om/service/IPcbVersionInfoService.java

@@ -2,6 +2,8 @@ package com.om.service;
 
 import com.om.entity.po.PcbVersionInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.om.entity.vo.PcbInfoVO;
+import com.om.utils.Result;
 
 /**
  * <p>
@@ -13,4 +15,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IPcbVersionInfoService extends IService<PcbVersionInfo> {
 
+    Result getPageList(Integer pageIndex, Integer pageSize, String username);
+
+    Result edit(PcbInfoVO pcbInfoVO);
+
+    Result downloadFile(Integer id);
+
+    Result delete(Integer id);
+
+    Result add(PcbInfoVO pcbInfoVO);
 }

+ 71 - 0
src/main/java/com/om/service/impl/PcbVersionInfoServiceImpl.java

@@ -1,11 +1,20 @@
 package com.om.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.om.entity.po.PcbVersionDescribe;
 import com.om.entity.po.PcbVersionInfo;
+import com.om.entity.vo.PcbInfoVO;
 import com.om.mapper.PcbVersionInfoMapper;
+import com.om.service.IPcbVersionDescribeService;
 import com.om.service.IPcbVersionInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.om.utils.Result;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -17,4 +26,66 @@ import org.springframework.stereotype.Service;
 @Service
 public class PcbVersionInfoServiceImpl extends ServiceImpl<PcbVersionInfoMapper, PcbVersionInfo> implements IPcbVersionInfoService {
 
+    @Resource
+    private IPcbVersionDescribeService describeService;
+
+    @Override
+    public Result getPageList(Integer pageIndex, Integer pageSize, String username) {
+        return null;
+    }
+
+    @Override
+    public Result edit(PcbInfoVO pcbInfoVO) {
+        PcbVersionInfo info = getById(pcbInfoVO.getId());
+        LambdaQueryWrapper<PcbVersionInfo> infoQueryWapper = new LambdaQueryWrapper<>();
+        infoQueryWapper.eq(PcbVersionInfo::getId,info.getId());
+        BeanUtil.copyProperties(pcbInfoVO,info);
+        this.update(info,infoQueryWapper);
+
+        LambdaQueryWrapper<PcbVersionDescribe> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(PcbVersionDescribe::getPcbId,pcbInfoVO.getId());
+        List<PcbVersionDescribe> describes = describeService.list(queryWrapper);
+
+
+
+        return null;
+    }
+
+    @Override
+    public Result downloadFile(Integer id) {
+        return null;
+    }
+
+    @Override
+    public Result delete(Integer id) {
+        boolean pcb = removeById(id);
+        LambdaQueryWrapper<PcbVersionDescribe> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(PcbVersionDescribe::getPcbId,id);
+        boolean info = describeService.remove(queryWrapper);
+        //还有关联表删除
+
+        return Result.ok();
+    }
+
+    @Override
+    public Result add(PcbInfoVO pcbInfoVO) {
+        PcbVersionInfo pcbVersionInfo = new PcbVersionInfo();
+        BeanUtil.copyProperties(pcbInfoVO,pcbVersionInfo);
+        this.save(pcbVersionInfo);
+        Integer pcbInfoId = pcbVersionInfo.getId();
+
+        //PcbClient表关联num没写
+
+
+        for (int i = 0; i < pcbInfoVO.getLanguage().length; i++) {
+
+            PcbVersionDescribe describe = new PcbVersionDescribe();
+            describe.setPcbId(pcbInfoId);
+            describe.setLanguage(pcbInfoVO.getLanguage()[i]);
+            describe.setDescription(pcbInfoVO.getDescription()[i]);
+            describeService.save(describe);
+        }
+
+        return  Result.ok();
+    }
 }