| | |
| | | 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; |
| | |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | if (StringHelper.isEmpty(type)) { |
| | | return fail("请输入数据类别"); |
| | | return fail("数据类别为空", null); |
| | | } |
| | | |
| | | String types = getType(type); |
| | |
| | | } |
| | | |
| | | @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) { |