新增备注列表
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
package lingtao.net.bean;
|
package lingtao.net.bean;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品知识点;
|
* 产品知识点;
|
||||||
*
|
*
|
||||||
@@ -11,15 +11,12 @@ import lombok.Data;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Information {
|
public class StandardMemo {
|
||||||
|
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
@@ -30,5 +27,5 @@ public class Information {
|
|||||||
/**
|
/**
|
||||||
* 附件
|
* 附件
|
||||||
*/
|
*/
|
||||||
private String attachment;
|
private String title;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +1,64 @@
|
|||||||
package lingtao.net.controller;
|
package lingtao.net.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import javax.servlet.http.HttpSession;
|
import lingtao.net.bean.Information;
|
||||||
|
import lingtao.net.bean.Msg;
|
||||||
|
import lingtao.net.bean.StandardMemo;
|
||||||
|
import lingtao.net.service.InformationService;
|
||||||
|
import lingtao.net.service.StandardMemoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import javax.servlet.http.HttpSession;
|
||||||
import com.github.pagehelper.PageInfo;
|
import java.util.List;
|
||||||
|
|
||||||
import lingtao.net.bean.Information;
|
|
||||||
import lingtao.net.bean.Msg;
|
|
||||||
import lingtao.net.service.InformationService;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class InformationController {
|
public class StandardMemoController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InformationService informationService;
|
private StandardMemoService standardMemoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品知识列表
|
* 产品知识列表
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/getInformations")
|
@RequestMapping("/getStandard")
|
||||||
public Msg getInformations(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
public Msg getStandard(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Information information) {
|
@RequestParam(value = "limit", defaultValue = "10") Integer limit, StandardMemo standardMemo) {
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
List<Information> informationList = informationService.getInformations(information);
|
List<StandardMemo> standardMemoList = standardMemoService.getStandardMemos(standardMemo);
|
||||||
PageInfo<Information> pageInfo = new PageInfo<Information>(informationList);
|
PageInfo<StandardMemo> pageInfo = new PageInfo<>(standardMemoList);
|
||||||
return Msg.success().add("list", pageInfo);
|
return Msg.success().add("list", pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加产品知识
|
* 添加产品知识
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/addInformation")
|
@RequestMapping("/addStandard")
|
||||||
public Msg addInformation(Information information, HttpSession session) {
|
public Msg addStandard(StandardMemo standardMemo, HttpSession session) {
|
||||||
informationService.addInformation(information, session);
|
standardMemoService.addStandardMemo(standardMemo, session);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改产品知识
|
* 修改产品知识
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/updateInformation")
|
@RequestMapping("/updateStandard")
|
||||||
public Msg updateInformation(Information information, HttpSession session) {
|
public Msg updateStandard(StandardMemo standardMemo, HttpSession session) {
|
||||||
informationService.updateInformationById(information, session);
|
standardMemoService.updateStandardMemoById(standardMemo, session);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/deleteInformation")
|
@RequestMapping("/deleteStandard")
|
||||||
public Msg deleteInformation(@RequestParam("id") Integer id) {
|
public Msg deleteStandard(@RequestParam("id") Integer id) {
|
||||||
informationService.deleteInformationById(id);
|
standardMemoService.deleteStandardMemoById(id);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package lingtao.net.dao;
|
package lingtao.net.dao;
|
||||||
|
|
||||||
|
import lingtao.net.bean.StandardMemo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lingtao.net.bean.Information;
|
public interface StandardMemoMapper {
|
||||||
|
|
||||||
public interface InformationMapper {
|
List<StandardMemo> getStandardMemos(StandardMemo standardMemo);
|
||||||
|
|
||||||
List<Information> getInformations(Information information);
|
void addStandardMemo(StandardMemo standardMemo);
|
||||||
|
|
||||||
void addInformation(Information information);
|
void updateStandardMemoById(StandardMemo standardMemo);
|
||||||
|
|
||||||
void updateInformationById(Information information);
|
void deleteStandardMemoById(Integer id);
|
||||||
|
|
||||||
void deleteInformationById(Integer id);
|
|
||||||
|
|
||||||
List<Information> getShortAnswers();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +1,56 @@
|
|||||||
package lingtao.net.service;
|
package lingtao.net.service;
|
||||||
|
|
||||||
import java.util.List;
|
import lingtao.net.bean.Msg;
|
||||||
|
import lingtao.net.bean.StandardMemo;
|
||||||
import javax.servlet.http.HttpSession;
|
import lingtao.net.bean.SysUser;
|
||||||
|
import lingtao.net.dao.StandardMemoMapper;
|
||||||
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 lingtao.net.bean.Information;
|
import javax.servlet.http.HttpSession;
|
||||||
import lingtao.net.bean.Msg;
|
import java.util.List;
|
||||||
import lingtao.net.bean.SysUser;
|
|
||||||
import lingtao.net.dao.InformationMapper;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class InformationService {
|
public class StandardMemoService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InformationMapper informationMapper;
|
private StandardMemoMapper standardMemoMapper;
|
||||||
|
|
||||||
public List<Information> getInformations(Information information) {
|
public List<StandardMemo> getStandardMemos(StandardMemo standardMemo) {
|
||||||
return informationMapper.getInformations(information);
|
return standardMemoMapper.getStandardMemos(standardMemo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Msg addInformation(Information information, HttpSession session) {
|
public Msg addStandardMemo(StandardMemo standardMemo, HttpSession session) {
|
||||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||||
information.setCreateBy(user.getRealname());
|
standardMemo.setCreateBy(user.getRealname());
|
||||||
try {
|
try {
|
||||||
informationMapper.addInformation(information);
|
standardMemoMapper.addStandardMemo(standardMemo);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Msg.fail();
|
return Msg.fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Msg updateInformationById(Information information, HttpSession session) {
|
public Msg updateStandardMemoById(StandardMemo standardMemo, HttpSession session) {
|
||||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||||
information.setUpdateBy(user.getRealname());
|
standardMemo.setUpdateBy(user.getRealname());
|
||||||
try {
|
try {
|
||||||
informationMapper.updateInformationById(information);
|
standardMemoMapper.updateStandardMemoById(standardMemo);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Msg.fail();
|
return Msg.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Msg deleteInformationById(Integer id) {
|
public Msg deleteStandardMemoById(Integer id) {
|
||||||
try {
|
try {
|
||||||
informationMapper.deleteInformationById(id);
|
standardMemoMapper.deleteStandardMemoById(id);
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Msg.fail();
|
return Msg.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Information> getShortAnswers() {
|
|
||||||
return informationMapper.getShortAnswers();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="lingtao.net.dao.InformationMapper">
|
<mapper namespace="lingtao.net.dao.StandardMemoMapper">
|
||||||
|
<select id="getStandardMemos" parameterType="lingtao.net.bean.StandardMemo"
|
||||||
|
resultType="lingtao.net.bean.StandardMemo">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
tbl_standard_memo
|
||||||
|
<where>
|
||||||
|
<if test="content != null and content != ''">
|
||||||
|
title like '%${content}%' or content like '%${content}%'
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getInformations" parameterType="Information"
|
<insert id="addStandardMemo" parameterType="lingtao.net.bean.StandardMemo">
|
||||||
resultType="Information">
|
insert into tbl_standard_memo
|
||||||
SELECT
|
(content, createBy, createDate, title)
|
||||||
*
|
values (#{content}, #{createBy}, now(), #{title})
|
||||||
FROM
|
</insert>
|
||||||
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">
|
<update id="updateStandardMemoById" parameterType="lingtao.net.bean.StandardMemo">
|
||||||
insert into
|
update tbl_standard_memo
|
||||||
tbl_information
|
<set>
|
||||||
(content,type,createBy,createDate,attachment)
|
<if test="content != null">
|
||||||
values
|
content = #{content,jdbcType=VARCHAR},
|
||||||
(#{content},#{type},#{createBy},now(),#{attachment})
|
</if>
|
||||||
</insert>
|
<if test="updateBy != null">
|
||||||
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="updateDate != null">
|
||||||
|
updateDate = now(),
|
||||||
|
</if>
|
||||||
|
<if test="attachment != null">
|
||||||
|
title = #{title,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateInformationById" parameterType="Information">
|
<delete id="deleteStandardMemoById">
|
||||||
update tbl_information
|
delete
|
||||||
<set>
|
from tbl_standard_memo
|
||||||
<if test="content != null">
|
where id = #{id}
|
||||||
content = #{content,jdbcType=VARCHAR},
|
</delete>
|
||||||
</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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user