用户栏目新增app接口
This commit is contained in:
parent
2b15c42b78
commit
49aaf3c3e6
@ -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")
|
||||
})
|
||||
|
@ -46,6 +46,14 @@ public interface IUserColumnDao {
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除用户栏目表(物理)
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void deleteByCreator(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 修改用户栏目表
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<UserColumnDataDTO> 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<UserColumnDataDTO> getData() {
|
||||
return data;
|
||||
}
|
||||
|
@ -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<String, Object> params = new HashMap<>(1);
|
||||
params.put("creator",creator);
|
||||
userColumnDao.deleteByCreator(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<UserColumnDataDTO> list(Map<String, Object> params) {
|
||||
String columnId = params.get("columnId").toString();
|
||||
if(StringUtils.isBlank(columnId)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<UserColumnDataDTO> list = userColumnDataDao.list(params);
|
||||
for (UserColumnDataDTO userColumnDataDTO : list) {
|
||||
MaterialDataDTO materialDataDTO = materialDataService.getByMaterialId(userColumnDataDTO.getUserColumnDataId());
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
<resultMap id="userColumnDTO" type="cn.com.tenlion.pojo.dtos.usercolumn.UserColumnDTO">
|
||||
<result column="column_id" property="columnId"/>
|
||||
<result column="column_name" property="columnName"/>
|
||||
<result column="column_enement" property="columnEnement"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
</resultMap>
|
||||
@ -75,6 +77,18 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 删除用户栏目表(物理) -->
|
||||
<update id="deleteByCreator" parameterType="map">
|
||||
DELETE FROM
|
||||
card_user_column
|
||||
WHERE
|
||||
creator = #{creator}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 修改用户栏目表 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
@ -107,10 +121,15 @@
|
||||
card_user_column t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="userColumnId != null and userColumnId != ''">
|
||||
AND
|
||||
t1.user_column_id = #{userColumnId}
|
||||
</if>
|
||||
<if test="userColumnId != null and userColumnId != ''">
|
||||
AND t1.user_column_id = #{userColumnId}
|
||||
</if>
|
||||
<if test="column_id != null and column_id != ''">
|
||||
AND t1.column_id = #{columnId}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND t1.creator = #{creator}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 用户栏目表详情 -->
|
||||
@ -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
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
t2.column_name LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
|
@ -5,7 +5,9 @@
|
||||
<resultMap id="userColumnDataDTO" type="cn.com.tenlion.pojo.dtos.usercolumndata.UserColumnDataDTO">
|
||||
<result column="user_column_data_id" property="userColumnDataId"/>
|
||||
<result column="column_id" property="columnId"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="column_name" property="columnName"/>
|
||||
<result column="column_enement" property="columnEnement"/>
|
||||
<result column="creator_name" property="creatorName"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
</resultMap>
|
||||
|
||||
@ -95,9 +97,15 @@
|
||||
<select id="get" parameterType="map" resultMap="userColumnDataDTO">
|
||||
SELECT
|
||||
t1.column_id,
|
||||
t1.user_column_data_id
|
||||
t1.user_column_data_id,
|
||||
u.user_name AS creator_name,
|
||||
t2.resource_type AS 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
|
||||
t1.is_delete = 0
|
||||
<if test="userColumnDataId != null and userColumnDataId != ''">
|
||||
@ -151,10 +159,16 @@
|
||||
SELECT
|
||||
t1.user_column_data_id,
|
||||
t1.column_id,
|
||||
t1.creator,
|
||||
t1.gmt_create
|
||||
t1.gmt_create,
|
||||
t2.column_name,
|
||||
u.user_name AS creator_name,
|
||||
t2.resource_type AS 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
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
@ -174,6 +188,7 @@
|
||||
<if test="columnId != null and columnId != ''">
|
||||
AND t1.column_id = #{columnId}
|
||||
</if>
|
||||
ORDER BY t1.gmt_create DESC
|
||||
</select>
|
||||
|
||||
<!-- 用户栏目数据列表 -->
|
||||
|
@ -34,11 +34,11 @@
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||
<!--<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">-->
|
||||
<!--<i class="fa fa-lg fa-plus"></i> 新增-->
|
||||
<!--</button>-->
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="showEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 查看
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
@ -86,16 +86,7 @@
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'userColumnDataId', width: 180, title: '用户数据ID', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'columnId', width: 180, title: '栏目ID', align:'center',
|
||||
{field: 'columnName', width: 180, title: '栏目名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -247,6 +238,25 @@
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
} else if(layEvent === 'showEvent'){
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 1,
|
||||
area: ['40%', '90%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/materialdata/list?materialId={userColumnDataId}', [checkDatas[0].userColumnDataId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user