diff --git a/src/main/java/cn/com/tenlion/controller/app/apis/usercolumndata/UserColumnDataAppController.java b/src/main/java/cn/com/tenlion/controller/app/apis/usercolumndata/UserColumnDataAppController.java index 791d388..2986c07 100644 --- a/src/main/java/cn/com/tenlion/controller/app/apis/usercolumndata/UserColumnDataAppController.java +++ b/src/main/java/cn/com/tenlion/controller/app/apis/usercolumndata/UserColumnDataAppController.java @@ -6,6 +6,7 @@ import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.component.SecurityComponent; import ink.wgink.exceptions.ParamsException; +import ink.wgink.exceptions.SearchException; import ink.wgink.interfaces.consts.ISystemConstant; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.ErrorResult; @@ -54,6 +55,24 @@ public class UserColumnDataAppController extends DefaultBaseController { return new SuccessResult(); } + @ApiOperation(value = "修改用户栏目数据表", notes = "修改用户栏目数据 表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "userColumnDataId", value = "用户栏目数据ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("update/{userColumnDataId}") + @CheckRequestBodyAnnotation + public SuccessResult update(@RequestHeader("token") String token, @PathVariable("userColumnDataId") String userColumnDataId, @RequestBody UserColumnDataVO vo) { + userColumnDataService.update(token, userColumnDataId, vo); + return new SuccessResult(); + } + + + + + + @ApiOperation(value = "用户栏目数据详情(通过ID)", notes = "用户栏目数据详情(通过ID)接口") @ApiImplicitParams({ @@ -107,6 +126,11 @@ public class UserColumnDataAppController extends DefaultBaseController { if(StringUtils.isBlank(columnId)){ throw new ParamsException("参数异常-1"); } + try { + params.put("creator",securityComponent.getAppTokenUser(token).getId()); + } catch (ReflectUtil.ReflectException e) { + throw new SearchException("请重新登录"); + } page.setParams(params); return userColumnDataService.listPage(page); } diff --git a/src/main/java/cn/com/tenlion/pojo/bos/usercolumndata/UserColumnDataBO.java b/src/main/java/cn/com/tenlion/pojo/bos/usercolumndata/UserColumnDataBO.java index f69cd0d..bf53915 100644 --- a/src/main/java/cn/com/tenlion/pojo/bos/usercolumndata/UserColumnDataBO.java +++ b/src/main/java/cn/com/tenlion/pojo/bos/usercolumndata/UserColumnDataBO.java @@ -12,6 +12,7 @@ public class UserColumnDataBO { private String userColumnDataId; private String columnId; + private String columnEnement; private String creator; private String gmtCreate; private String modifier; @@ -34,6 +35,14 @@ public class UserColumnDataBO { this.columnId = columnId; } + public String getColumnEnement() { + return columnEnement; + } + + public void setColumnEnement(String columnEnement) { + this.columnEnement = columnEnement; + } + public String getCreator() { return creator == null ? "" : creator.trim(); } diff --git a/src/main/java/cn/com/tenlion/pojo/pos/usercolumndata/UserColumnDataPO.java b/src/main/java/cn/com/tenlion/pojo/pos/usercolumndata/UserColumnDataPO.java index 70342e4..2e56d94 100644 --- a/src/main/java/cn/com/tenlion/pojo/pos/usercolumndata/UserColumnDataPO.java +++ b/src/main/java/cn/com/tenlion/pojo/pos/usercolumndata/UserColumnDataPO.java @@ -12,6 +12,8 @@ public class UserColumnDataPO { private String userColumnDataId; private String columnId; + private String columnEnement; + private String creator; private String gmtCreate; private String modifier; @@ -34,6 +36,14 @@ public class UserColumnDataPO { this.columnId = columnId; } + public String getColumnEnement() { + return columnEnement; + } + + public void setColumnEnement(String columnEnement) { + this.columnEnement = columnEnement; + } + public String getCreator() { return creator == null ? "" : creator.trim(); } diff --git a/src/main/java/cn/com/tenlion/pojo/vos/usercolumndata/UserColumnDataVO.java b/src/main/java/cn/com/tenlion/pojo/vos/usercolumndata/UserColumnDataVO.java index 4521d6c..ae65454 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/usercolumndata/UserColumnDataVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/usercolumndata/UserColumnDataVO.java @@ -17,6 +17,8 @@ public class UserColumnDataVO extends MaterialDataVO { @ApiModelProperty(name = "columnId", value = "栏目ID") private String columnId; + @ApiModelProperty(name = "columnEnement", value = "栏目数据元素") + private String columnEnement; public String getColumnId() { return columnId == null ? "" : columnId.trim(); @@ -26,5 +28,11 @@ public class UserColumnDataVO extends MaterialDataVO { this.columnId = columnId; } + public String getColumnEnement() { + return columnEnement; + } + public void setColumnEnement(String columnEnement) { + this.columnEnement = columnEnement; + } } diff --git a/src/main/java/cn/com/tenlion/service/usercolumndata/impl/UserColumnDataServiceImpl.java b/src/main/java/cn/com/tenlion/service/usercolumndata/impl/UserColumnDataServiceImpl.java index ceadd40..efd5994 100644 --- a/src/main/java/cn/com/tenlion/service/usercolumndata/impl/UserColumnDataServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/usercolumndata/impl/UserColumnDataServiceImpl.java @@ -51,11 +51,12 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs List list = new ArrayList(); List userColumnDTOS = userColumnService.listByCreatorTitle(creator); ListPage page = new ListPage(); - page.setRows(3); + page.setRows(1); page.setPage(1); for (UserColumnDTO userColumnDTO : userColumnDTOS) { Map params = new HashMap<>(); params.put("columnId",userColumnDTO.getColumnId()); + params.put("creator",creator); page.setParams(params); SuccessResultList> listSuccessResultList = this.listPage(page); UserColumnDataListDTO dto = new UserColumnDataListDTO(); @@ -63,6 +64,7 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs dto.setColumnName(userColumnDTO.getColumnName()); dto.setColumnId(userColumnDTO.getColumnId()); dto.setColumnEnement(userColumnDTO.getColumnEnement()); + list.add(dto); } return list; } @@ -102,7 +104,7 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs materialDataVO.setPhoto(userColumnDataVO.getPhoto()); materialDataVO.setVideo(userColumnDataVO.getVideo()); materialDataVO.setText(userColumnDataVO.getText()); - materialDataService.save(materialDataVO); + materialDataService.save(token, materialDataVO); return userColumnDataId; } @@ -144,7 +146,17 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs } else { setAppUpdateInfo(token, params); } - userColumnDataDao.update(params); + //userColumnDataDao.update(params); + //保存数据 + MaterialDataVO materialDataVO = new MaterialDataVO(); + materialDataVO.setMaterialId(userColumnDataId); + materialDataVO.setAudio(userColumnDataVO.getAudio()); + materialDataVO.setLink(userColumnDataVO.getLink()); + materialDataVO.setMap(userColumnDataVO.getMap()); + materialDataVO.setPhoto(userColumnDataVO.getPhoto()); + materialDataVO.setVideo(userColumnDataVO.getVideo()); + materialDataVO.setText(userColumnDataVO.getText()); + materialDataService.save(token, materialDataVO); } @Override @@ -152,7 +164,7 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs UserColumnDataDTO userColumnDataDTO = userColumnDataDao.get(params); if(userColumnDataDTO != null){ MaterialDataDTO materialDataDTO = materialDataService.getByMaterialId(userColumnDataDTO.getUserColumnDataId()); - BeanUtils.copyProperties(userColumnDataDTO,materialDataDTO); + setColumnData(userColumnDataDTO,materialDataDTO); } return userColumnDataDTO; } @@ -193,7 +205,7 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs List list = userColumnDataDao.list(params); for (UserColumnDataDTO userColumnDataDTO : list) { MaterialDataDTO materialDataDTO = materialDataService.getByMaterialId(userColumnDataDTO.getUserColumnDataId()); - BeanUtils.copyProperties(userColumnDataDTO,materialDataDTO); + setColumnData(userColumnDataDTO,materialDataDTO); } return list; } @@ -222,4 +234,14 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs return count == null ? 0 : count; } + + public void setColumnData(UserColumnDataDTO userColumnDataDTO,MaterialDataDTO materialDataDTO){ + userColumnDataDTO.setAudio(materialDataDTO.getAudio()); + userColumnDataDTO.setLink(materialDataDTO.getLink()); + userColumnDataDTO.setMap(materialDataDTO.getMap()); + userColumnDataDTO.setText(materialDataDTO.getText()); + userColumnDataDTO.setPhoto(materialDataDTO.getPhoto()); + userColumnDataDTO.setVideo(materialDataDTO.getVideo()); + } + } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/usercolumndata/user-column-data-mapper.xml b/src/main/resources/mybatis/mapper/usercolumndata/user-column-data-mapper.xml index ff22866..7af70db 100644 --- a/src/main/resources/mybatis/mapper/usercolumndata/user-column-data-mapper.xml +++ b/src/main/resources/mybatis/mapper/usercolumndata/user-column-data-mapper.xml @@ -14,6 +14,7 @@ + @@ -24,6 +25,7 @@ + @@ -36,6 +38,7 @@ INSERT INTO card_user_column_data( user_column_data_id, column_id, + column_enement, creator, gmt_create, modifier, @@ -44,6 +47,7 @@ ) VALUES( #{userColumnDataId}, #{columnId}, + #{columnEnement}, #{creator}, #{gmtCreate}, #{modifier}, @@ -99,11 +103,9 @@ t1.column_id, t1.user_column_data_id, u.user_name AS creator_name, - t2.resource_type AS column_enement + t1.column_enement FROM card_user_column_data t1 - LEFT JOIN card_column_mng t2 - ON t1.column_id = t2.column_id LEFT JOIN sys_user u ON t1.creator = u.user_id WHERE @@ -162,7 +164,7 @@ t1.gmt_create, t2.column_name, u.user_name AS creator_name, - t2.resource_type AS column_enement + t1.column_enement FROM card_user_column_data t1 LEFT JOIN card_column_mng t2 @@ -188,6 +190,9 @@ AND t1.column_id = #{columnId} + + AND t1.creator = #{creator} + ORDER BY t1.gmt_create DESC