diff --git a/src/main/java/cn/com/tenlion/controller/app/apis/usercolumn/UserColumnAppController.java b/src/main/java/cn/com/tenlion/controller/app/apis/usercolumn/UserColumnAppController.java index df003a2..38bd055 100644 --- a/src/main/java/cn/com/tenlion/controller/app/apis/usercolumn/UserColumnAppController.java +++ b/src/main/java/cn/com/tenlion/controller/app/apis/usercolumn/UserColumnAppController.java @@ -50,7 +50,17 @@ public class UserColumnAppController extends DefaultBaseController { } - + @ApiOperation(value = "新增用户栏目表(多条,逗号分割)", notes = "新增用户栏目表接口(多条,逗号分割)") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("save-more") + @CheckRequestBodyAnnotation + public SuccessResult saveMore(@RequestHeader("token") String token, @RequestBody UserColumnVO userColumnVO) { + userColumnService.saveMore(token, userColumnVO); + return new SuccessResult(); + } 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 e54f70d..aef3353 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 @@ -1,8 +1,11 @@ package cn.com.tenlion.controller.app.apis.usercolumndata; +import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataListDTO; 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.interfaces.consts.ISystemConstant; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.ErrorResult; @@ -12,10 +15,14 @@ import ink.wgink.pojo.result.SuccessResultList; import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO; import cn.com.tenlion.pojo.vos.usercolumndata.UserColumnDataVO; import cn.com.tenlion.service.usercolumndata.IUserColumnDataService; +import ink.wgink.util.ReflectUtil; import io.swagger.annotations.*; +import jdk.nashorn.internal.runtime.ParserException; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -34,6 +41,8 @@ public class UserColumnDataAppController extends DefaultBaseController { @Autowired private IUserColumnDataService userColumnDataService; + @Autowired + protected SecurityComponent securityComponent; @ApiOperation(value = "新增用户栏目数据", notes = "新增用户栏目数据接口") @@ -85,42 +94,40 @@ public class UserColumnDataAppController extends DefaultBaseController { return new SuccessResult(); } - - @ApiOperation(value = "用户栏目数据列表", notes = "用户栏目数据列表接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "token", paramType = "header") + @ApiImplicitParam(name = "token", value = "token", paramType = "header") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("list") - public List list(@RequestHeader("token") String token) { - Map params = requestParams(); - return userColumnDataService.list(params); + @GetMapping("list-my-creator") + public List listMyCreator(@RequestHeader("token") String token) throws ReflectUtil.ReflectException { + return userColumnDataService.listMyCreator(securityComponent.getAppToken(token).getUserId()); } - @ApiOperation(value = "用户栏目数据分页列表", notes = "用户栏目数据分页列表接口") + + + @ApiOperation(value = "栏目数据分页列表", notes = "栏目数据分页列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header"), @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String") + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "columnId", value = "栏目ID", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpageusercolumndata") public SuccessResultList> listPage(@RequestHeader("token") String token, ListPage page) { Map params = requestParams(); + String columnId = params.get("columnId").toString(); + if(StringUtils.isBlank(columnId)){ + throw new ParamsException("参数异常-1"); + } page.setParams(params); return userColumnDataService.listPage(page); } - @ApiOperation(value = "用户栏目数据统计", notes = "用户栏目数据统计接口") - @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("count") - SuccessResultData count() { - Map params = requestParams(); - return new SuccessResultData<>(userColumnDataService.count(params)); - } + } \ No newline at end of file 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..a244343 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 @@ -1,5 +1,7 @@ package cn.com.tenlion.pojo.dtos.usercolumndata; +import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO; + import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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 new file mode 100644 index 0000000..1a8fad5 --- /dev/null +++ b/src/main/java/cn/com/tenlion/pojo/dtos/usercolumndata/UserColumnDataListDTO.java @@ -0,0 +1,52 @@ +package cn.com.tenlion.pojo.dtos.usercolumndata; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +/** + * + * @ClassName: UserColumnDataDTO + * @Description: 用户栏目数据 + * @Author: CodeFactory + * @Date: 2021-05-28 15:14:58 + * @Version: 3.0 + **/ +@ApiModel +public class UserColumnDataListDTO{ + + + @ApiModelProperty(name = "columnId", value = "栏目ID") + private String columnId; + @ApiModelProperty(name = "columnName", value = "栏目名称") + private String columnName; + @ApiModelProperty(name = "data", value = "栏目数据") + private List data; + + + public String getColumnId() { + return columnId; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} 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..89ab041 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 @@ -1,6 +1,10 @@ package cn.com.tenlion.pojo.vos.usercolumndata; import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO; + +import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO; +import ink.wgink.annotation.CheckEmptyAnnotation; +import ink.wgink.annotation.CheckNumberAnnotation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/src/main/java/cn/com/tenlion/service/usercolumn/IUserColumnService.java b/src/main/java/cn/com/tenlion/service/usercolumn/IUserColumnService.java index afb23c9..36015d6 100644 --- a/src/main/java/cn/com/tenlion/service/usercolumn/IUserColumnService.java +++ b/src/main/java/cn/com/tenlion/service/usercolumn/IUserColumnService.java @@ -18,6 +18,12 @@ import java.util.Map; * @Version: 3.0 **/ public interface IUserColumnService { + /** + * 新增多条栏目 + * @param token + * @param userColumnVO + */ + void saveMore(String token,UserColumnVO userColumnVO); /** 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 78cd91c..e36817b 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 @@ -34,6 +34,21 @@ public class UserColumnServiceImpl extends DefaultBaseService implements IUserCo + + public void saveMore(String token,UserColumnVO userColumnVO){ + String[] columnIds = userColumnVO.getColumnId().split(","); + for (String columnId : columnIds) { + UserColumnVO vo =new UserColumnVO(); + vo.setColumnId(columnId); + this.save(token,vo); + } + } + + + + + + public List listByCreatorTitle(String creator){ Map params = new HashMap<>(); params.put("creator",creator); diff --git a/src/main/java/cn/com/tenlion/service/usercolumndata/IUserColumnDataService.java b/src/main/java/cn/com/tenlion/service/usercolumndata/IUserColumnDataService.java index 5a0ee54..13c3fef 100644 --- a/src/main/java/cn/com/tenlion/service/usercolumndata/IUserColumnDataService.java +++ b/src/main/java/cn/com/tenlion/service/usercolumndata/IUserColumnDataService.java @@ -1,5 +1,6 @@ package cn.com.tenlion.service.usercolumndata; +import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataListDTO; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO; @@ -19,6 +20,13 @@ import java.util.Map; **/ public interface IUserColumnDataService { + /** + * 用户栏目数据 + * @param creator + * @return + */ + List listMyCreator(String creator); + /** * 新增用户栏目数据 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 0596758..e3ebfec 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,18 @@ 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; +import cn.com.tenlion.pojo.dtos.usercolumn.UserColumnDTO; +import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataListDTO; +import cn.com.tenlion.service.usercolumn.IUserColumnService; +import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.pojo.ListPage; +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.materialstore.pojo.dtos.materialdata.MaterialDataDTO; import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO; @@ -21,8 +34,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @ClassName: UserColumnDataServiceImpl 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 f2da4d1..2ba172f 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 @@ -152,8 +152,7 @@ t1.user_column_data_id, t1.column_id, t1.creator, - t1.gmt_create, - 1 + t1.gmt_create FROM card_user_column_data t1 WHERE @@ -172,12 +171,8 @@ AND LEFT(t1.gmt_create, 10) #{endTime} - - AND - t1.user_column_data_id IN - - #{userColumnDataIds[${index}]} - + + AND t1.column_id = #{columnId}