新增备注列表
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package lingtao.net.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品知识点;
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class Information {
|
||||
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String content;
|
||||
|
||||
private String type;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateDate;
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String attachment;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package lingtao.net.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import lingtao.net.bean.Information;
|
||||
import lingtao.net.bean.Msg;
|
||||
import lingtao.net.service.InformationService;
|
||||
|
||||
@RestController
|
||||
public class InformationController {
|
||||
|
||||
@Autowired
|
||||
private InformationService informationService;
|
||||
|
||||
/**
|
||||
* 产品知识列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getInformations")
|
||||
public Msg getInformations(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Information information) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<Information> informationList = informationService.getInformations(information);
|
||||
PageInfo<Information> pageInfo = new PageInfo<Information>(informationList);
|
||||
return Msg.success().add("list", pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加产品知识
|
||||
*/
|
||||
@RequestMapping("/addInformation")
|
||||
public Msg addInformation(Information information, HttpSession session) {
|
||||
informationService.addInformation(information, session);
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品知识
|
||||
*/
|
||||
@RequestMapping("/updateInformation")
|
||||
public Msg updateInformation(Information information, HttpSession session) {
|
||||
informationService.updateInformationById(information, session);
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/deleteInformation")
|
||||
public Msg deleteInformation(@RequestParam("id") Integer id) {
|
||||
informationService.deleteInformationById(id);
|
||||
return Msg.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package lingtao.net.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Information;
|
||||
|
||||
public interface InformationMapper {
|
||||
|
||||
List<Information> getInformations(Information information);
|
||||
|
||||
void addInformation(Information information);
|
||||
|
||||
void updateInformationById(Information information);
|
||||
|
||||
void deleteInformationById(Integer id);
|
||||
|
||||
List<Information> getShortAnswers();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package lingtao.net.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lingtao.net.bean.Information;
|
||||
import lingtao.net.bean.Msg;
|
||||
import lingtao.net.bean.SysUser;
|
||||
import lingtao.net.dao.InformationMapper;
|
||||
|
||||
@Service
|
||||
public class InformationService {
|
||||
|
||||
@Autowired
|
||||
private InformationMapper informationMapper;
|
||||
|
||||
public List<Information> getInformations(Information information) {
|
||||
return informationMapper.getInformations(information);
|
||||
}
|
||||
|
||||
public Msg addInformation(Information information, HttpSession session) {
|
||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||
information.setCreateBy(user.getRealname());
|
||||
try {
|
||||
informationMapper.addInformation(information);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
public Msg updateInformationById(Information information, HttpSession session) {
|
||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||
information.setUpdateBy(user.getRealname());
|
||||
try {
|
||||
informationMapper.updateInformationById(information);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Msg deleteInformationById(Integer id) {
|
||||
try {
|
||||
informationMapper.deleteInformationById(id);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Information> getShortAnswers() {
|
||||
return informationMapper.getShortAnswers();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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="lingtao.net.dao.InformationMapper">
|
||||
|
||||
<select id="getInformations" parameterType="Information"
|
||||
resultType="Information">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
tbl_information
|
||||
<where>
|
||||
<if test="content != null and content != ''">
|
||||
content like '%${content}%'
|
||||
</if>
|
||||
</where>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<!-- 获取简答题 -->
|
||||
<select id="getShortAnswers" resultType="Information">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
tbl_information
|
||||
WHERE TYPE = 0
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<insert id="addInformation" parameterType="Information">
|
||||
insert into
|
||||
tbl_information
|
||||
(content,type,createBy,createDate,attachment)
|
||||
values
|
||||
(#{content},#{type},#{createBy},now(),#{attachment})
|
||||
</insert>
|
||||
|
||||
<update id="updateInformationById" parameterType="Information">
|
||||
update tbl_information
|
||||
<set>
|
||||
<if test="content != null">
|
||||
content = #{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
updateBy = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateDate != null">
|
||||
updateDate = now(),
|
||||
</if>
|
||||
<if test="attachment != null">
|
||||
attachment = #{attachment,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<delete id="deleteInformationById">
|
||||
delete from tbl_information where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,129 +1,162 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
pageEncoding="UTF-8" %>
|
||||
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<%@include file="/views/common.jsp"%>
|
||||
<meta charset="UTF-8">
|
||||
<title>产品知识列表</title>
|
||||
<%@include file="/views/common.jsp" %>
|
||||
<style type="text/css">
|
||||
.layui-table-cell {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.layui-table td, .layui-table th, .layui-table-header, .layui-table-page, .layui-table-tool, .layui-table-total, .layui-table-view {
|
||||
border-color: #6666;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.ztree * {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.edge .layui-edge {
|
||||
right: 35px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<style>
|
||||
.price-layout-page{
|
||||
background:#eeeeee;
|
||||
padding:18px;
|
||||
}
|
||||
.edge .layui-edge{
|
||||
right:30px;
|
||||
}
|
||||
.layui-form-radio, .layui-form-radio *{
|
||||
vertical-align:baseline;
|
||||
}
|
||||
</style>
|
||||
<script id="trainContent" type="text/html">
|
||||
{{# layui.each(d.list, function(index, item){ }}
|
||||
<ul class="layui-timeline">
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<p>
|
||||
{{item.content}}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{{# }); }}
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container demoTable">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-circle-fine" style="font-size:20px;font-weight:bold"></i> 新增内容
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
<body class="price-layout-page">
|
||||
<form class="layui-form" action="" id="form">
|
||||
<input type="hidden" id="type" name="type" value="售前客服必备技能">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-form-item" id="myRadio"></div>
|
||||
</form>
|
||||
<div class="layui-col-md12" style="padding: 7px;">
|
||||
<div style="background: white; padding: 7px;">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
|
||||
<legend style="color:red;"><h1>售前客服必备技能:</h1></legend>
|
||||
</fieldset>
|
||||
<!-- 渲染到这 -->
|
||||
<div id="view"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="barDemo">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="view">
|
||||
<i class="layui-icon layui-icon-view" style="color:white;font-size:20px"></i>复制
|
||||
</a>
|
||||
|
||||
</script>
|
||||
<body>
|
||||
<br>
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">内容</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="content" name="content" placeholder="请输入内容" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn" id="searchBtn" lay-submit lay-filter="formDemo" style="margin-left: 15px">
|
||||
<i class="layui-icon layui-icon-search"></i> 查询
|
||||
</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="layui-hide" id="informationTable" lay-filter="informationTable"></table>
|
||||
<script type="text/javascript">
|
||||
|
||||
layui.use(['element', 'table', 'laydate', 'form'], function () {
|
||||
var $ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var laydate = layui.laydate;
|
||||
var element = layui.element;
|
||||
var form = layui.form;
|
||||
|
||||
// 生成表格
|
||||
table.render({
|
||||
elem: '#informationTable',
|
||||
url: '../../../../getStandard',
|
||||
toolbar: '#toolbarDemo',
|
||||
title: '用户表',// 导出文件名
|
||||
id: 'informationTableAll',
|
||||
// 开启分页
|
||||
// page : true,
|
||||
page: {
|
||||
layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
|
||||
},
|
||||
limits: [10, 30, 50, 80, 100, 999],
|
||||
/*request : {
|
||||
'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
|
||||
},*/
|
||||
where: {
|
||||
content: ''
|
||||
},
|
||||
cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
||||
cols: [[{
|
||||
type: 'numbers',
|
||||
title: '序号',
|
||||
width: 50,
|
||||
fixed: "left"
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
}, {
|
||||
field: 'content',
|
||||
title: '内容',
|
||||
}, {
|
||||
field: 'createBy',
|
||||
align: 'center',
|
||||
width: 150,
|
||||
title: '创建人'
|
||||
}, {
|
||||
field: 'createDate',
|
||||
title: '创建时间',
|
||||
width: 220,
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
return d.createDate != null ? layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
|
||||
}
|
||||
}, {
|
||||
fixed: 'right',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: 150,
|
||||
toolbar: '#barDemo'
|
||||
}]],
|
||||
parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
|
||||
return {
|
||||
"code": 0, //解析接口状态
|
||||
"msg": "", //解析提示文本
|
||||
"count": res.data.list.total,//解析数据长度
|
||||
"data": res.data.list.list//解析数据列表
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//点击查询按钮,重载表格
|
||||
$('#searchBtn').on('click', function () {
|
||||
table.reload('informationTableAll', {
|
||||
method: 'get',
|
||||
where: {
|
||||
content: $("#content").val()
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
table.on('tool(informationTable)', function (obj) {
|
||||
let data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
// 在此处输入 layer 的任意代码
|
||||
navigator.clipboard.writeText(data.content);
|
||||
layer.msg('复制成功!', {icon: 6, offset: 'auto', time: 1000});
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
layui.use(['form', 'laytpl', 'layer'], function(){ //独立版的layer无需执行这一句
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
layer = layui.layer,
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
|
||||
//一访问页面就调用
|
||||
$.ajax({
|
||||
url:"/quote_price/getCustomerTrainProTypes",
|
||||
type : "GET",
|
||||
async: false, // 同步
|
||||
data:{
|
||||
type:$("#type").val()
|
||||
},
|
||||
dataType : "json",
|
||||
success : function(proTypeResult) {
|
||||
var proTypeData = proTypeResult.list
|
||||
|
||||
for(var proTypeItem in proTypeData){
|
||||
var str="<label class='layui-form-label'>"+ proTypeData[proTypeItem].proType +":</label>"
|
||||
$("#myRadio").append(str);
|
||||
$.ajax({
|
||||
url:"/quote_price/getCustomerTrainKindLabelsByProType",
|
||||
type : "GET",
|
||||
dataType : "json",
|
||||
async: false, // 同步
|
||||
data:{
|
||||
proType :proTypeData[proTypeItem].proType,
|
||||
type :$("#type").val(),
|
||||
needPage:"0"
|
||||
},
|
||||
success : function(kindResult) {
|
||||
var kindData = kindResult.list
|
||||
for(var kindItem in kindData){
|
||||
var kindStr="<input type='radio' name='kind' lay-filter='kind' value="+ JSON.stringify(proTypeData[proTypeItem].proType+ '+' +kindData[kindItem].kindLabel)+ " title="+ JSON.stringify(kindData[kindItem].kindLabel)+">"
|
||||
$("#myRadio").append(kindStr)
|
||||
}
|
||||
$("#myRadio").append("</br>")
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#form")[0].reset();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('radio(kind)', function(kindData) {
|
||||
// 传过来的数据是proType+kind拼接的
|
||||
var data = kindData.value.split("+");
|
||||
//获取后台数据后渲染
|
||||
$.ajax({
|
||||
url: "/quote_price/getCustomerTrainContents",
|
||||
datatype: "json",
|
||||
// data:$("form").serialize(),
|
||||
data:{
|
||||
proType :data[0],
|
||||
kind :data[1],
|
||||
type :$("#type").val()
|
||||
},
|
||||
type: "GET",
|
||||
async: false,//关闭异步,否则popover组件无法渲染出值
|
||||
context: document.body,
|
||||
success: function (data) {
|
||||
var getTpl = document.getElementById('trainContent').innerHTML,
|
||||
view = document.getElementById('view');
|
||||
laytpl(getTpl).render(data, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
}
|
||||
})
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user