57 lines
1.6 KiB
Java
57 lines
1.6 KiB
Java
package lingtao.net.service;
|
|
|
|
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 javax.servlet.http.HttpSession;
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class StandardMemoService {
|
|
|
|
@Autowired
|
|
private StandardMemoMapper standardMemoMapper;
|
|
|
|
public List<StandardMemo> getStandardMemos(StandardMemo standardMemo) {
|
|
return standardMemoMapper.getStandardMemos(standardMemo);
|
|
}
|
|
|
|
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 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 deleteStandardMemoById(Integer id) {
|
|
try {
|
|
standardMemoMapper.deleteStandardMemoById(id);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
|
|
}
|
|
|
|
}
|