管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-18 2cdae0f5f7d7d2db4ff07be0c3e97a10eb3722d3
1
已添加1个文件
已修改3个文件
140 ■■■■■ 文件已修改
data/db_cx.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/PublishController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/ctrl/PubEntity.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/PublishService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_cx.sql
@@ -26,7 +26,7 @@
where id = 7
insert into lf.sys_meta_pub (id,metaid,pubid) values (1,1,1);
insert into lf.sys_publish (id,name,type,dirid,depid) values (1,'Test','0102','000305');
insert into lf.sys_publish (id,name,type,dirid,depid) values (1,'Test','3dml','0102','000305');
select a.* from lf.sys_publish a
select * from lf.sys_meta order by id desc limit 20;
src/main/java/com/lf/server/controller/data/PublishController.java
@@ -3,10 +3,12 @@
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.ctrl.PubEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.PublishEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.helper.WebHelper;
import com.lf.server.service.data.PublishService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -51,7 +53,7 @@
                return fail("每页页数或分页数小于1", null);
            }
            if (StringHelper.isEmpty(type)) {
                return fail("请输入数据类别");
                return fail("数据类别为空", null);
            }
            String types = getType(type);
@@ -130,19 +132,27 @@
    }
    @SysLog()
    @ApiOperation(value = "插入一条")
    @ApiOperation(value = "插入发布数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PublishEntity", paramType = "body")
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PubEntity", paramType = "body")
    })
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insert(@RequestBody PublishEntity entity, HttpServletRequest req) {
    public ResponseMsg<Integer> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setCreateUser(ue.getId());
            if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) {
                return fail("实体类为空或找不到元数据ID", 0);
            }
            if (StringHelper.isEmpty(entity.getType())) {
                return fail("数据类别为空", null);
            }
            int count = publishService.insert(entity);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUserId(ue.getId());
                entity.setToken(WebHelper.getToken(req));
            }
            int count = publishService.insertForPub(entity);
            return success(count);
        } catch (Exception ex) {
src/main/java/com/lf/server/entity/ctrl/PubEntity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,102 @@
package com.lf.server.entity.ctrl;
import java.util.List;
/**
 * å‘布实体类
 * @author WWW
 */
public class PubEntity {
    public PubEntity() {
    }
    private String type;
    private String token;
    private String name;
    private Integer userId;
    private Integer min;
    private Integer max;
    private String dircode;
    private String depcode;
    private List<String> ids;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getUserId() {
        return userId;
    }
    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public Integer getMin() {
        return min;
    }
    public void setMin(Integer min) {
        this.min = min;
    }
    public Integer getMax() {
        return max;
    }
    public void setMax(Integer max) {
        this.max = max;
    }
    public String getDircode() {
        return dircode;
    }
    public void setDircode(String dircode) {
        this.dircode = dircode;
    }
    public String getDepcode() {
        return depcode;
    }
    public void setDepcode(String depcode) {
        this.depcode = depcode;
    }
    public List<String> getIds() {
        return ids;
    }
    public void setIds(List<String> ids) {
        this.ids = ids;
    }
}
src/main/java/com/lf/server/service/data/PublishService.java
@@ -1,5 +1,6 @@
package com.lf.server.service.data;
import com.lf.server.entity.ctrl.PubEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.PublishEntity;
import com.lf.server.helper.StringHelper;
@@ -89,4 +90,13 @@
        return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset);
    }
    /**
     * æ’入发布数据
     */
    public int insertForPub(PubEntity entity) {
        return 0;
    }
}