用户栏目新增app接口

This commit is contained in:
ly19960718 2021-05-31 17:35:02 +08:00
parent 6c9372c33a
commit 8b83f8a6b9
10 changed files with 138 additions and 27 deletions

View File

@ -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();
}

View File

@ -1,8 +1,11 @@
package cn.com.tenlion.controller.app.apis.usercolumndata; package cn.com.tenlion.controller.app.apis.usercolumndata;
import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataListDTO;
import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController; 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.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult; 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.dtos.usercolumndata.UserColumnDataDTO;
import cn.com.tenlion.pojo.vos.usercolumndata.UserColumnDataVO; import cn.com.tenlion.pojo.vos.usercolumndata.UserColumnDataVO;
import cn.com.tenlion.service.usercolumndata.IUserColumnDataService; import cn.com.tenlion.service.usercolumndata.IUserColumnDataService;
import ink.wgink.util.ReflectUtil;
import io.swagger.annotations.*; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -34,6 +41,8 @@ public class UserColumnDataAppController extends DefaultBaseController {
@Autowired @Autowired
private IUserColumnDataService userColumnDataService; private IUserColumnDataService userColumnDataService;
@Autowired
protected SecurityComponent securityComponent;
@ApiOperation(value = "新增用户栏目数据", notes = "新增用户栏目数据接口") @ApiOperation(value = "新增用户栏目数据", notes = "新增用户栏目数据接口")
@ -85,42 +94,40 @@ public class UserColumnDataAppController extends DefaultBaseController {
return new SuccessResult(); return new SuccessResult();
} }
@ApiOperation(value = "用户栏目数据列表", notes = "用户栏目数据列表接口") @ApiOperation(value = "用户栏目数据列表", notes = "用户栏目数据列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header") @ApiImplicitParam(name = "token", value = "token", paramType = "header")
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list") @GetMapping("list-my-creator")
public List<UserColumnDataDTO> list(@RequestHeader("token") String token) { public List<UserColumnDataListDTO> listMyCreator(@RequestHeader("token") String token) throws ReflectUtil.ReflectException {
Map<String, Object> params = requestParams(); return userColumnDataService.listMyCreator(securityComponent.getAppToken(token).getUserId());
return userColumnDataService.list(params);
} }
@ApiOperation(value = "用户栏目数据分页列表", notes = "用户栏目数据分页列表接口")
@ApiOperation(value = "栏目数据分页列表", notes = "栏目数据分页列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"), @ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", 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)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpageusercolumndata") @GetMapping("listpageusercolumndata")
public SuccessResultList<List<UserColumnDataDTO>> listPage(@RequestHeader("token") String token, ListPage page) { public SuccessResultList<List<UserColumnDataDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
String columnId = params.get("columnId").toString();
if(StringUtils.isBlank(columnId)){
throw new ParamsException("参数异常-1");
}
page.setParams(params); page.setParams(params);
return userColumnDataService.listPage(page); return userColumnDataService.listPage(page);
} }
@ApiOperation(value = "用户栏目数据统计", notes = "用户栏目数据统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count")
SuccessResultData<Integer> count() {
Map<String, Object> params = requestParams();
return new SuccessResultData<>(userColumnDataService.count(params));
}
} }

View File

@ -1,5 +1,7 @@
package cn.com.tenlion.pojo.dtos.usercolumndata; 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 cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -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<UserColumnDataDTO> 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<UserColumnDataDTO> getData() {
return data;
}
public void setData(List<UserColumnDataDTO> data) {
this.data = data;
}
}

View File

@ -1,6 +1,10 @@
package cn.com.tenlion.pojo.vos.usercolumndata; 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 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -18,6 +18,12 @@ import java.util.Map;
* @Version: 3.0 * @Version: 3.0
**/ **/
public interface IUserColumnService { public interface IUserColumnService {
/**
* 新增多条栏目
* @param token
* @param userColumnVO
*/
void saveMore(String token,UserColumnVO userColumnVO);
/** /**

View File

@ -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<UserColumnDTO> listByCreatorTitle(String creator){ public List<UserColumnDTO> listByCreatorTitle(String creator){
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("creator",creator); params.put("creator",creator);

View File

@ -1,5 +1,6 @@
package cn.com.tenlion.service.usercolumndata; package cn.com.tenlion.service.usercolumndata;
import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataListDTO;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO; import cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO;
@ -19,6 +20,13 @@ import java.util.Map;
**/ **/
public interface IUserColumnDataService { public interface IUserColumnDataService {
/**
* 用户栏目数据
* @param creator
* @return
*/
List<UserColumnDataListDTO> listMyCreator(String creator);
/** /**
* 新增用户栏目数据 * 新增用户栏目数据

View File

@ -1,5 +1,18 @@
package cn.com.tenlion.service.usercolumndata.impl; 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.dao.usercolumndata.IUserColumnDataDao;
import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO; import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO;
import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.*;
import java.util.Map;
/** /**
* @ClassName: UserColumnDataServiceImpl * @ClassName: UserColumnDataServiceImpl

View File

@ -152,8 +152,7 @@
t1.user_column_data_id, t1.user_column_data_id,
t1.column_id, t1.column_id,
t1.creator, t1.creator,
t1.gmt_create, t1.gmt_create
1
FROM FROM
card_user_column_data t1 card_user_column_data t1
WHERE WHERE
@ -172,12 +171,8 @@
AND AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime} LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="userColumnDataIds != null and userColumnDataIds.size > 0"> <if test="columnId != null and columnId != ''">
AND AND t1.column_id = #{columnId}
t1.user_column_data_id IN
<foreach collection="userColumnDataIds" index="index" open="(" separator="," close=")">
#{userColumnDataIds[${index}]}
</foreach>
</if> </if>
</select> </select>