用户栏目数据接口 修改

This commit is contained in:
ly19960718 2021-06-02 17:24:08 +08:00
parent 49aaf3c3e6
commit 0250c9149b
6 changed files with 87 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -51,11 +51,12 @@ public class UserColumnDataServiceImpl extends DefaultBaseService implements IUs
List<UserColumnDataListDTO> list = new ArrayList<UserColumnDataListDTO>();
List<UserColumnDTO> userColumnDTOS = userColumnService.listByCreatorTitle(creator);
ListPage page = new ListPage();
page.setRows(3);
page.setRows(1);
page.setPage(1);
for (UserColumnDTO userColumnDTO : userColumnDTOS) {
Map<String, Object> params = new HashMap<>();
params.put("columnId",userColumnDTO.getColumnId());
params.put("creator",creator);
page.setParams(params);
SuccessResultList<List<UserColumnDataDTO>> 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<UserColumnDataDTO> 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());
}
}

View File

@ -14,6 +14,7 @@
<resultMap id="userColumnDataBO" type="cn.com.tenlion.pojo.bos.usercolumndata.UserColumnDataBO">
<result column="user_column_data_id" property="userColumnDataId"/>
<result column="column_id" property="columnId"/>
<result column="column_enement" property="columnEnement"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
@ -24,6 +25,7 @@
<resultMap id="userColumnDataPO" type="cn.com.tenlion.pojo.pos.usercolumndata.UserColumnDataPO">
<result column="user_column_data_id" property="userColumnDataId"/>
<result column="column_id" property="columnId"/>
<result column="column_enement" property="columnEnement"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
@ -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 @@
<if test="columnId != null and columnId != ''">
AND t1.column_id = #{columnId}
</if>
<if test="creator != null and creator != ''">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC
</select>