新增备注列表
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package lingtao.net.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品知识点;
|
||||
*
|
||||
@@ -11,15 +11,12 @@ import lombok.Data;
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class Information {
|
||||
|
||||
public class StandardMemo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String content;
|
||||
|
||||
private String type;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
@@ -30,5 +27,5 @@ public class Information {
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String attachment;
|
||||
private String title;
|
||||
}
|
||||
|
||||
@@ -1,65 +1,64 @@
|
||||
package lingtao.net.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
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.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;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class InformationController {
|
||||
public class StandardMemoController {
|
||||
|
||||
@Autowired
|
||||
private InformationService informationService;
|
||||
@Autowired
|
||||
private StandardMemoService standardMemoService;
|
||||
|
||||
/**
|
||||
* 产品知识列表
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
/**
|
||||
* 产品知识列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getStandard")
|
||||
public Msg getStandard(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") Integer limit, StandardMemo standardMemo) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<StandardMemo> standardMemoList = standardMemoService.getStandardMemos(standardMemo);
|
||||
PageInfo<StandardMemo> pageInfo = new PageInfo<>(standardMemoList);
|
||||
return Msg.success().add("list", pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加产品知识
|
||||
*/
|
||||
@RequestMapping("/addInformation")
|
||||
public Msg addInformation(Information information, HttpSession session) {
|
||||
informationService.addInformation(information, session);
|
||||
return Msg.success();
|
||||
}
|
||||
/**
|
||||
* 添加产品知识
|
||||
*/
|
||||
@RequestMapping("/addStandard")
|
||||
public Msg addStandard(StandardMemo standardMemo, HttpSession session) {
|
||||
standardMemoService.addStandardMemo(standardMemo, session);
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品知识
|
||||
*/
|
||||
@RequestMapping("/updateInformation")
|
||||
public Msg updateInformation(Information information, HttpSession session) {
|
||||
informationService.updateInformationById(information, session);
|
||||
return Msg.success();
|
||||
}
|
||||
/**
|
||||
* 修改产品知识
|
||||
*/
|
||||
@RequestMapping("/updateStandard")
|
||||
public Msg updateStandard(StandardMemo standardMemo, HttpSession session) {
|
||||
standardMemoService.updateStandardMemoById(standardMemo, session);
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/deleteInformation")
|
||||
public Msg deleteInformation(@RequestParam("id") Integer id) {
|
||||
informationService.deleteInformationById(id);
|
||||
return Msg.success();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/deleteStandard")
|
||||
public Msg deleteStandard(@RequestParam("id") Integer id) {
|
||||
standardMemoService.deleteStandardMemoById(id);
|
||||
return Msg.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package lingtao.net.dao;
|
||||
|
||||
import lingtao.net.bean.StandardMemo;
|
||||
|
||||
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 deleteInformationById(Integer id);
|
||||
|
||||
List<Information> getShortAnswers();
|
||||
void deleteStandardMemoById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,62 +1,56 @@
|
||||
package lingtao.net.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import lingtao.net.bean.Msg;
|
||||
import lingtao.net.bean.StandardMemo;
|
||||
import lingtao.net.bean.SysUser;
|
||||
import lingtao.net.dao.StandardMemoMapper;
|
||||
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;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class InformationService {
|
||||
public class StandardMemoService {
|
||||
|
||||
@Autowired
|
||||
private InformationMapper informationMapper;
|
||||
@Autowired
|
||||
private StandardMemoMapper standardMemoMapper;
|
||||
|
||||
public List<Information> getInformations(Information information) {
|
||||
return informationMapper.getInformations(information);
|
||||
}
|
||||
public List<StandardMemo> getStandardMemos(StandardMemo standardMemo) {
|
||||
return standardMemoMapper.getStandardMemos(standardMemo);
|
||||
}
|
||||
|
||||
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 addStandardMemo(StandardMemo standardMemo, HttpSession session) {
|
||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||
standardMemo.setCreateBy(user.getRealname());
|
||||
try {
|
||||
standardMemoMapper.addStandardMemo(standardMemo);
|
||||
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 updateStandardMemoById(StandardMemo standardMemo, HttpSession session) {
|
||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||
standardMemo.setUpdateBy(user.getRealname());
|
||||
try {
|
||||
standardMemoMapper.updateStandardMemoById(standardMemo);
|
||||
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 Msg deleteStandardMemoById(Integer id) {
|
||||
try {
|
||||
standardMemoMapper.deleteStandardMemoById(id);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Information> getShortAnswers() {
|
||||
return informationMapper.getShortAnswers();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user