From aedf1a2e260c87a6293443e538ca8651258ee73e Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 26 Jan 2021 15:48:05 +0800 Subject: [PATCH] 20210126 --- src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java | 35 ++++ src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderLabelEntity.java | 26 +++ src/main/resources/templates/febs/views/modules/documentary/followLabelSet.html | 127 +++++++++++++++ src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderLabelMapper.java | 15 + src/main/resources/templates/febs/views/modules/documentary/followLabelSetAdd.html | 67 ++++++++ src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 42 +++++ src/main/resources/mapper/modules/FollowTraderLabelMapper.xml | 9 + src/main/resources/templates/febs/views/modules/documentary/followLabelSetDetail.html | 77 +++++++++ src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 9 + src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 29 +++ 10 files changed, 436 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java index 0a2028b..6941e80 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java @@ -18,7 +18,9 @@ import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; import com.xcong.excoin.modules.documentary.service.DocumentaryService; +import com.xcong.excoin.modules.systemSetting.entity.PlatformBannerEntity; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -33,6 +35,46 @@ private final DocumentaryService documentaryService; /** + * 标签---列表 + * @return + */ + @GetMapping("traderLabelList") + public FebsResponse traderLabelList(FollowTraderLabelEntity followTraderLabelEntity, QueryRequest request) { + Map<String, Object> data = getDataTable(documentaryService.traderLabelList(followTraderLabelEntity, request)); + return new FebsResponse().success().data(data); + } + + /** + * 标签---删除 + * @return + */ + @GetMapping("traderLabelDelete/{id}") + @ControllerEndpoint(operation = "标签---删除", exceptionMessage = "删除失败") + public FebsResponse traderLabelDelete(@NotNull(message = "{required}") @PathVariable Long id) { + return documentaryService.traderLabelDelete(id); + } + + /** + * 标签---新增 + */ + @PostMapping("followLabelSetAdd") + @ControllerEndpoint(operation = "标签---新增", exceptionMessage = "新增失败") + public FebsResponse followLabelSetAdd(@Valid FollowTraderLabelEntity followTraderLabelEntity) { + documentaryService.followLabelSetAdd(followTraderLabelEntity); + return new FebsResponse().success(); + } + + /** + * 标签---修改 + */ + @PostMapping("followLabelSetUpdate") + @ControllerEndpoint(operation = "标签---修改", exceptionMessage = "修改失败") + public FebsResponse followLabelSetUpdate(@Valid FollowTraderLabelEntity followTraderLabelEntity) { + documentaryService.followLabelSetUpdate(followTraderLabelEntity); + return new FebsResponse().success(); + } + + /** * 交易员申请---列表 * @return */ diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java index df03ba8..abbf2dc 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java @@ -11,8 +11,11 @@ import com.xcong.excoin.common.entity.FebsConstant; import com.xcong.excoin.common.utils.FebsUtil; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; +import com.xcong.excoin.modules.documentary.mapper.FollowTraderLabelMapper; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.member.entity.MemberEntity; +import com.xcong.excoin.modules.systemSetting.entity.PlatformTradeSettingEntity; import lombok.RequiredArgsConstructor; @Controller("documentaryView") @@ -22,6 +25,38 @@ private final DocumentaryService documentaryService; + private final FollowTraderLabelMapper followTraderLabelMapper; + + /** + * 标签设置 + * @return + */ + @GetMapping("followLabelSet") + @RequiresPermissions("followLabelSet:view") + public String followLabelSet() { + return FebsUtil.view("modules/documentary/followLabelSet"); + } + + /** + * 标签设置---修改 + */ + @GetMapping("followLabelSetUpdate/{id}") + @RequiresPermissions("followLabelSetUpdate:update") + public String followLabelSetUpdate(@PathVariable long id, Model model) { + FollowTraderLabelEntity data = followTraderLabelMapper.selectById(id); + model.addAttribute("member", data); + return FebsUtil.view("modules/documentary/followLabelSetDetail"); + } + + /** + * 标签设置---新增 + */ + @GetMapping("followLabelSetAdd") + @RequiresPermissions("followLabelSetAdd:add") + public String noticeManageAdd() { + return FebsUtil.view("modules/documentary/followLabelSetAdd"); + } + /** * 交易员申请 * @return diff --git a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderLabelEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderLabelEntity.java new file mode 100644 index 0000000..8321bf0 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderLabelEntity.java @@ -0,0 +1,26 @@ +package com.xcong.excoin.modules.documentary.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.xcong.excoin.common.entity.BaseEntity; + +import lombok.Data; +@Data +@TableName("follow_trader_label") +public class FollowTraderLabelEntity{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 标签 + */ + private String labels; + +} + diff --git a/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderLabelMapper.java b/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderLabelMapper.java new file mode 100644 index 0000000..e30c37a --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderLabelMapper.java @@ -0,0 +1,15 @@ +package com.xcong.excoin.modules.documentary.mapper; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; + +public interface FollowTraderLabelMapper extends BaseMapper<FollowTraderLabelEntity> { + + IPage<FollowTraderLabelEntity> findFollowTraderLabelEntitysInPage(Page<FollowTraderLabelEntity> page, + @Param("record")FollowTraderLabelEntity followTraderLabelEntity); + +} diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java index b7bb220..68d40a2 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java @@ -9,6 +9,7 @@ import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; public interface DocumentaryService extends IService<FollowTraderInfoEntity> { @@ -22,4 +23,12 @@ FebsResponse traderGetFull(@NotNull(message = "{required}") Long id); + IPage<FollowTraderLabelEntity> traderLabelList(FollowTraderLabelEntity followTraderLabelEntity, QueryRequest request); + + FebsResponse traderLabelDelete(@NotNull(message = "{required}") Long id); + + void followLabelSetAdd(@Valid FollowTraderLabelEntity followTraderLabelEntity); + + void followLabelSetUpdate(@Valid FollowTraderLabelEntity followTraderLabelEntity); + } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java index f11773c..2995662 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java @@ -21,8 +21,10 @@ import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; import com.xcong.excoin.modules.documentary.mapper.FollowTraderInfoMapper; +import com.xcong.excoin.modules.documentary.mapper.FollowTraderLabelMapper; import com.xcong.excoin.modules.documentary.mapper.FollowTraderProfitInfoMapper; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity; @@ -41,6 +43,8 @@ public class DocumentaryServiceImpl extends ServiceImpl<FollowTraderInfoMapper, FollowTraderInfoEntity> implements DocumentaryService { private final FollowTraderInfoMapper followTraderInfoMapper; + + private final FollowTraderLabelMapper followTraderLabelMapper; private final MemberAuthenticationMapper memberAuthenticationMapper; @@ -183,4 +187,29 @@ return new FebsResponse().success(); } + @Override + public IPage<FollowTraderLabelEntity> traderLabelList(FollowTraderLabelEntity followTraderLabelEntity, + QueryRequest request) { + Page<FollowTraderLabelEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<FollowTraderLabelEntity> followTraderLabelEntitys = followTraderLabelMapper.findFollowTraderLabelEntitysInPage(page, followTraderLabelEntity); + return followTraderLabelEntitys; + } + + @Override + public FebsResponse traderLabelDelete(@NotNull(message = "{required}") Long id) { + followTraderLabelMapper.deleteById(id); + return new FebsResponse().success(); + } + + @Override + public void followLabelSetAdd(@Valid FollowTraderLabelEntity followTraderLabelEntity) { + + followTraderLabelMapper.insert(followTraderLabelEntity); + } + + @Override + public void followLabelSetUpdate(@Valid FollowTraderLabelEntity followTraderLabelEntity) { + followTraderLabelMapper.updateById(followTraderLabelEntity); + } + } diff --git a/src/main/resources/mapper/modules/FollowTraderLabelMapper.xml b/src/main/resources/mapper/modules/FollowTraderLabelMapper.xml new file mode 100644 index 0000000..c6b76e3 --- /dev/null +++ b/src/main/resources/mapper/modules/FollowTraderLabelMapper.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.xcong.excoin.modules.documentary.mapper.FollowTraderLabelMapper"> + + <select id="findFollowTraderLabelEntitysInPage" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity"> + select * from follow_trader_label s + </select> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/documentary/followLabelSet.html b/src/main/resources/templates/febs/views/modules/documentary/followLabelSet.html new file mode 100644 index 0000000..0a6b83a --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/documentary/followLabelSet.html @@ -0,0 +1,127 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-user" lay-title="交易员标签"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="user-table-form"> + <div class="layui-row"> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add"> + 新增 + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="user:view,user:update,user:delete"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="user:update">编辑 + <i class="layui-icon febs-edit-area febs-blue"></i> + </a> + <a lay-event="delete" shiro:hasPermission="user:update">删除 + <i class="layui-icon febs-edit-area febs-blue"></i> + </a> +</script> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + laydate = layui.laydate, + febs = layui.febs, + form = layui.form, + table = layui.table, + dropdown = layui.dropdown, + $view = $('#febs-user'), + $reset = $view.find('#reset'), + $add = $view.find('#add'), + $searchForm = $view.find('form'), + sortObject = {field: 'title', type: null}, + tableIns + ; + + form.render(); + + // 表格初始化 + initTable(); + + // 初始化表格操作栏各个按钮功能 + table.on('tool(userTable)', function (obj) { + var data = obj.data, + layEvent = obj.event; + + if (layEvent === 'edit') { + febs.modal.open('修改', 'modules/documentary/followLabelSetUpdate/' + data.id, { + btn: ['提交', '取消'], + yes: function (index, layero) { + $('#user-update').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + if (layEvent === 'delete') { + febs.modal.confirm('删除', '您是否确认删除?', function () { + deleteUsers(data.id); + }); + } + }); + + function deleteUsers(id) { + febs.get(ctx + 'documentary/traderLabelDelete/' + id, null, function () { + febs.alert.success('确认删除'); + $reset.click(); + }); + } + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + + $add.on('click', function () { + febs.modal.open('新增', 'modules/documentary/followLabelSetAdd/', { + btn: ['提交', '取消'], + yes: function (index, layero) { + $('#user-add').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + }); + + + // 获取查询参数 + function getQueryParams() { + return {}; + } + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'userTable', + url: ctx + 'documentary/traderLabelList', + cols: [[ + {field: 'id', title: '', minWidth: 10,align:'center'}, + {field: 'labels', title: '更新内容', minWidth: 120,align:'center'}, + {title: '操作', toolbar: '#user-option', minWidth: 140, fixed : 'right'} + ]] + }); + } + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/documentary/followLabelSetAdd.html b/src/main/resources/templates/febs/views/modules/documentary/followLabelSetAdd.html new file mode 100644 index 0000000..c38c40f --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/documentary/followLabelSetAdd.html @@ -0,0 +1,67 @@ +<style> + #user-add { + padding: 20px 25px 25px 0; + } + + #user-add .layui-treeSelect .ztree li a, .ztree li span { + margin: 0 0 2px 3px !important; + } + #user-add #data-permission-tree-block { + border: 1px solid #eee; + border-radius: 2px; + padding: 3px 0; + } + #user-add .layui-treeSelect .ztree li span.button.switch { + top: 1px; + left: 3px; + } + +</style> +<div class="layui-fluid" id="user-add"> + <form class="layui-form" action="" lay-filter="user-add-form"> + <div class="layui-form-item febs-hide"> + <label class="layui-form-label febs-form-item-require">id:</label> + <div class="layui-input-block"> + <input type="text" name="id"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">标签内容:</label> + <div class="layui-input-block"> + <input type="text" name="labels" lay-verify="range|labels" + autocomplete="off" class="layui-input" > + </div> + </div> + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="user-add-form-submit" id="submit"></button> + </div> + </form> +</div> + +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree'], function () { + var $ = layui.$, + febs = layui.febs, + layer = layui.layer, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + eleTree = layui.eleTree, + $view = $('#user-add'), + validate = layui.validate, + _deptTree; + + form.render(); + + formSelects.render(); + + form.on('submit(user-add-form-submit)', function (data) { + febs.post(ctx + 'documentary/followLabelSetAdd', data.field, function () { + layer.closeAll(); + febs.alert.success('新增成功'); + $('#febs-user').find('#reset').click(); + }); + return false; + }); + }); +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/documentary/followLabelSetDetail.html b/src/main/resources/templates/febs/views/modules/documentary/followLabelSetDetail.html new file mode 100644 index 0000000..e5faab7 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/documentary/followLabelSetDetail.html @@ -0,0 +1,77 @@ +<style> + #user-update { + padding: 20px 25px 25px 0; + } + + #user-update .layui-treeSelect .ztree li a, .ztree li span { + margin: 0 0 2px 3px !important; + } + #user-update #data-permission-tree-block { + border: 1px solid #eee; + border-radius: 2px; + padding: 3px 0; + } + #user-add .layui-treeSelect .ztree li span.button.switch { + top: 1px; + left: 3px; + } + +</style> +<div class="layui-fluid" id="user-update"> + <form class="layui-form" action="" lay-filter="user-update-form"> + <div class="layui-form-item febs-hide"> + <label class="layui-form-label febs-form-item-require">id:</label> + <div class="layui-input-block"> + <input type="text" name="id" data-th-value="${member.id}" > + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">标签内容:</label> + <div class="layui-input-block"> + <input type="text" name="labels" data-th-id="${member.labels}" lay-verify="range|labels" + autocomplete="off" class="layui-input" > + </div> + </div> + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="user-update-form-submit" id="submit"></button> + </div> + </form> +</div> + +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree'], function () { + var $ = layui.$, + febs = layui.febs, + layer = layui.layer, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + eleTree = layui.eleTree, + member = [[${member}]], + $view = $('#user-update'), + validate = layui.validate, + _deptTree; + + form.render(); + + initUserValue(); + + formSelects.render(); + + function initUserValue() { + form.val("user-update-form", { + "labels": member.labels, + "id": member.id + }); + } + + form.on('submit(user-update-form-submit)', function (data) { + febs.post(ctx + 'documentary/followLabelSetUpdate', data.field, function () { + layer.closeAll(); + febs.alert.success('设置成功'); + $('#febs-user').find('#reset').click(); + }); + return false; + }); + }); +</script> \ No newline at end of file -- Gitblit v1.9.1