Merge branch 'develop' of http://139.196.179.195:3000/chenxudong/electromagnetic-data-new into develop
This commit is contained in:
commit
5f3af77a5c
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.controller;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.EdFileRelationService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data/ed/relation")
|
||||||
|
public class EdFileRelationController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EdFileRelationService edFileRelationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建文件关系
|
||||||
|
* @param relation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping (value = "/create", method = RequestMethod.POST)
|
||||||
|
public ElectromagneticResult<?> createRelation (@RequestBody EdFileRelation relation) {
|
||||||
|
return ElectromagneticResultUtil.success(edFileRelationService.createRelation(relation));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消文件关系
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping (value = "/cancel/{id}", method = RequestMethod.GET)
|
||||||
|
public ElectromagneticResult<?> cancelRelation (@PathVariable("id") String id) {
|
||||||
|
return ElectromagneticResultUtil.success(edFileRelationService.cancelRelation(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface EdFileRelationMapper extends BaseMapper<EdFileRelation> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("ed_file_relation")
|
||||||
|
public class EdFileRelation {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件1 主键id
|
||||||
|
*/
|
||||||
|
@TableField(value = "fileId1")
|
||||||
|
private String fileId1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件2 主键id
|
||||||
|
*/
|
||||||
|
@TableField(value = "fileId2")
|
||||||
|
private String fileId2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系描述
|
||||||
|
*/
|
||||||
|
private String relationship;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者 用户id
|
||||||
|
*/
|
||||||
|
@TableField(value = "created_by")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者 用户id
|
||||||
|
*/
|
||||||
|
@TableField(value = "updated_by")
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
@TableField(value = "updated_at", fill = FieldFill.UPDATE)
|
||||||
|
private Date updatedAt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||||
|
|
||||||
|
public interface EdFileRelationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建文件关系
|
||||||
|
* @param edFileRelation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean createRelation(EdFileRelation edFileRelation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消文件关系
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean cancelRelation (String id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||||
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
|
import com.electromagnetic.industry.software.manage.mapper.EdFileRelationMapper;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.EdFileRelationService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
public class EdFileRelationServiceImpl implements EdFileRelationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EdFileRelationMapper edFileRelationMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建文件关系
|
||||||
|
* @param edFileRelation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean createRelation (EdFileRelation edFileRelation) {
|
||||||
|
edFileRelation.setId(IdWorker.getSnowFlakeIdString());
|
||||||
|
edFileRelation.setCreatedBy(UserThreadLocal.getUserId());
|
||||||
|
return edFileRelationMapper.insert(edFileRelation)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消文件关系
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean cancelRelation (String id) {
|
||||||
|
return edFileRelationMapper.deleteById(id)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue