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 7d2d08c..791d388 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 @@ -55,43 +55,29 @@ public class UserColumnDataAppController extends DefaultBaseController { } - - - - - - - - - - - - @ApiOperation(value = "删除用户栏目数据(id列表)", notes = "删除用户栏目数据(id列表)接口") + @ApiOperation(value = "用户栏目数据详情(通过ID)", notes = "用户栏目数据详情(通过ID)接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "token", paramType = "header"), - @ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3") + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "userColumnDataId", value = "用户数据ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @DeleteMapping("remove/{ids}") - public SuccessResult remove(@RequestHeader("token") String token, @PathVariable("ids") String ids) { - userColumnDataService.remove(token, Arrays.asList(ids.split("\\_"))); - return new SuccessResult(); + @GetMapping("get/{userColumnDataId}") + public UserColumnDataDTO get(@RequestHeader("token") String token, @PathVariable("userColumnDataId") String userColumnDataId) { + return userColumnDataService.get(userColumnDataId); } - @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("updateusercolumndata/{userColumnDataId}") - @CheckRequestBodyAnnotation - public SuccessResult updateUserColumnData(@RequestHeader("token") String token, @PathVariable("userColumnDataId") String userColumnDataId, @RequestBody UserColumnDataVO userColumnDataVO) { - userColumnDataService.update(token, userColumnDataId, userColumnDataVO); - return new SuccessResult(); - } - @ApiOperation(value = "用户栏目数据列表", notes = "用户栏目数据列表接口") + + + + + + + + + + + @ApiOperation(value = "用户栏目数据列表", notes = "用户栏目数据列表接口(默认每个栏目返回最新三条数据)") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header") }) diff --git a/src/main/java/cn/com/tenlion/dao/usercolumn/IUserColumnDao.java b/src/main/java/cn/com/tenlion/dao/usercolumn/IUserColumnDao.java index 26d6ab7..0edf9c4 100644 --- a/src/main/java/cn/com/tenlion/dao/usercolumn/IUserColumnDao.java +++ b/src/main/java/cn/com/tenlion/dao/usercolumn/IUserColumnDao.java @@ -46,6 +46,14 @@ public interface IUserColumnDao { */ void delete(Map params) throws RemoveException; + /** + * 删除用户栏目表(物理) + * + * @param params + * @throws RemoveException + */ + void deleteByCreator(Map params) throws RemoveException; + /** * 修改用户栏目表 * diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataDTO.java index 6014258..243ec7c 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataDTO.java @@ -19,6 +19,10 @@ public class UserColumnDataDTO extends MaterialDataDTO { private String userColumnDataId; @ApiModelProperty(name = "columnId", value = "栏目ID") private String columnId; + @ApiModelProperty(name = "columnName", value = "栏目名称") + private String columnName; + @ApiModelProperty(name = "columnEnement", value = "栏目元素") + private String columnEnement; @ApiModelProperty(name = "creatorName", value = "创建人名称") private String creatorName; @ApiModelProperty(name = "gmtCreate", value = "创建时间") @@ -40,6 +44,22 @@ public class UserColumnDataDTO extends MaterialDataDTO { this.columnId = columnId; } + public String getColumnName() { + return columnName; + } + + public String getColumnEnement() { + return columnEnement; + } + + public void setColumnEnement(String columnEnement) { + this.columnEnement = columnEnement; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + public String getCreatorName() { return creatorName; } diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataListDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataListDTO.java index 1a8fad5..1c6ddec 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataListDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataListDTO.java @@ -22,6 +22,8 @@ public class UserColumnDataListDTO{ private String columnId; @ApiModelProperty(name = "columnName", value = "栏目名称") private String columnName; + @ApiModelProperty(name = "columnEnement", value = "栏目元素") + private String columnEnement; @ApiModelProperty(name = "data", value = "栏目数据") private List data; @@ -42,6 +44,14 @@ public class UserColumnDataListDTO{ this.columnName = columnName; } + public String getColumnEnement() { + return columnEnement; + } + + public void setColumnEnement(String columnEnement) { + this.columnEnement = columnEnement; + } + public List getData() { return data; } diff --git a/src/main/java/cn/com/tenlion/service/usercolumn/impl/UserColumnServiceImpl.java b/src/main/java/cn/com/tenlion/service/usercolumn/impl/UserColumnServiceImpl.java index 05a7fad..59f4563 100644 --- a/src/main/java/cn/com/tenlion/service/usercolumn/impl/UserColumnServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/usercolumn/impl/UserColumnServiceImpl.java @@ -1,8 +1,10 @@ package cn.com.tenlion.service.usercolumn.impl; import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.SaveException; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.util.ReflectUtil; import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.UUIDUtil; import cn.com.tenlion.dao.usercolumn.IUserColumnDao; @@ -36,6 +38,12 @@ public class UserColumnServiceImpl extends DefaultBaseService implements IUserCo public void saveMore(String token,UserColumnVO userColumnVO){ + try { + this.deleteByCreator(securityComponent.getAppTokenUser(token).getId()); + } catch (ReflectUtil.ReflectException e) { + throw new SaveException("系统错误"); + } + String[] columnIds = userColumnVO.getColumnId().split(","); for (String columnId : columnIds) { UserColumnVO vo =new UserColumnVO(); @@ -45,7 +53,11 @@ public class UserColumnServiceImpl extends DefaultBaseService implements IUserCo } - + public void deleteByCreator(String creator){ + Map params = new HashMap<>(1); + params.put("creator",creator); + userColumnDao.deleteByCreator(params); + } 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 33321c1..ceadd40 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 @@ -1,5 +1,7 @@ package cn.com.tenlion.service.usercolumndata.impl; + + import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO; import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO; import cn.com.tenlion.materialstore.service.materialdata.MaterialDataService; @@ -12,10 +14,10 @@ import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.UUIDUtil; import cn.com.tenlion.dao.usercolumndata.IUserColumnDataDao; -import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO; -import cn.com.tenlion.pojo.vos.usercolumndata.UserColumnDataVO; import cn.com.tenlion.pojo.bos.usercolumndata.UserColumnDataBO; +import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO; import cn.com.tenlion.pojo.pos.usercolumndata.UserColumnDataPO; +import cn.com.tenlion.pojo.vos.usercolumndata.UserColumnDataVO; import cn.com.tenlion.service.usercolumndata.IUserColumnDataService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -60,7 +62,7 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs dto.setData(listSuccessResultList.getRows()); dto.setColumnName(userColumnDTO.getColumnName()); dto.setColumnId(userColumnDTO.getColumnId()); - + dto.setColumnEnement(userColumnDTO.getColumnEnement()); } return list; } @@ -188,10 +190,6 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs @Override public List list(Map params) { - String columnId = params.get("columnId").toString(); - if(StringUtils.isBlank(columnId)){ - return new ArrayList<>(); - } List list = userColumnDataDao.list(params); for (UserColumnDataDTO userColumnDataDTO : list) { MaterialDataDTO materialDataDTO = materialDataService.getByMaterialId(userColumnDataDTO.getUserColumnDataId()); diff --git a/src/main/resources/mybatis/mapper/usercolumn/user-column-mapper.xml b/src/main/resources/mybatis/mapper/usercolumn/user-column-mapper.xml index 8e0e211..041ce88 100644 --- a/src/main/resources/mybatis/mapper/usercolumn/user-column-mapper.xml +++ b/src/main/resources/mybatis/mapper/usercolumn/user-column-mapper.xml @@ -4,6 +4,8 @@ + + @@ -75,6 +77,18 @@ + + + + DELETE FROM + card_user_column + WHERE + creator = #{creator} + + + + + UPDATE @@ -107,10 +121,15 @@ card_user_column t1 WHERE t1.is_delete = 0 - - AND - t1.user_column_id = #{userColumnId} - + + AND t1.user_column_id = #{userColumnId} + + + AND t1.column_id = #{columnId} + + + AND t1.creator = #{creator} + @@ -158,15 +177,19 @@ SELECT t1.column_id, t1.creator, - t1.gmt_create + t1.gmt_create, + t2.column_name, + t2.resource_type AS column_enement FROM card_user_column t1 + LEFT JOIN card_column_mng t2 + ON t1.column_id = t2.column_id WHERE t1.is_delete = 0 AND ( - t1.id LIKE CONCAT('%', #{keywords}, '%') + t2.column_name LIKE CONCAT('%', #{keywords}, '%') ) 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 2ba172f..ff22866 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 @@ -5,7 +5,9 @@ - + + + @@ -95,9 +97,15 @@ diff --git a/src/main/resources/static/route/usercolumndata/list.html b/src/main/resources/static/route/usercolumndata/list.html index fb3fcd6..482b475 100644 --- a/src/main/resources/static/route/usercolumndata/list.html +++ b/src/main/resources/static/route/usercolumndata/list.html @@ -34,11 +34,11 @@