ssm基于Java ssm的校園驛站管理系統(tǒng)源碼和論文016
?開(kāi)發(fā)工具:idea?
?數(shù)據(jù)庫(kù)mysql5.7+
?數(shù)據(jù)庫(kù)鏈接工具:navcat,小海豚等
?技術(shù):ssm?
摘 ?要
互聯(lián)網(wǎng)發(fā)展至今,無(wú)論是其理論還是技術(shù)都已經(jīng)成熟,而且它廣泛參與在社會(huì)中的方方面面。它讓信息都可以通過(guò)網(wǎng)絡(luò)傳播,搭配信息管理工具可以很好地為人們提供服務(wù)。針對(duì)校園快遞信息管理混亂,出錯(cuò)率高,信息安全性差,勞動(dòng)強(qiáng)度大,費(fèi)時(shí)費(fèi)力等問(wèn)題,采用校園驛站管理系統(tǒng)可以有效管理,使信息管理能夠更加科學(xué)和規(guī)范。
校園驛站管理系統(tǒng)在JDK環(huán)境中,使用Java語(yǔ)言進(jìn)行編碼,使用Mysql創(chuàng)建數(shù)據(jù)表保存本系統(tǒng)產(chǎn)生的數(shù)據(jù)。系統(tǒng)可以提供信息顯示和相應(yīng)服務(wù),其管理員管理快遞倉(cāng)庫(kù)信息,管理待發(fā)貨信息,管理已收快遞,管理物流以及留言信息,管理員工和用戶(hù)資料。員工更改物流信息,管理快遞倉(cāng)庫(kù)信息,管理待發(fā)貨信息,管理已收快遞,發(fā)布留言信息。用戶(hù)簽收快遞,查看系統(tǒng)公告,發(fā)布留言,查看已收快遞信息,查看快遞物流信息。
總之,校園驛站管理系統(tǒng)集中管理信息,有著保密性強(qiáng),效率高,存儲(chǔ)空間大,成本低等諸多優(yōu)點(diǎn)。它可以降低信息管理成本,實(shí)現(xiàn)信息管理計(jì)算機(jī)化。
關(guān)鍵詞:校園驛站管理系統(tǒng);Java語(yǔ)言;Mysql
package com.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.annotation.IgnoreAuth;
import com.entity.YuangongxinxiEntity;
import com.service.TokenService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.YuangongxinxiEntity;
import com.service.YuangongxinxiService;
import com.utils.PageUtils;
import com.utils.R;
/**
*
* 后端接口
* @author
* @email
* @date 2021-02-22
*/
@RestController
@Controller
@RequestMapping("/yuangongxinxi")
public class YuangongxinxiController {
private static final Logger logger = LoggerFactory.getLogger(YuangongxinxiController.class);
@Autowired
private YuangongxinxiService yuangongxinxiService;
@Autowired
private TokenService tokenService;
/**
* 登錄
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String role, HttpServletRequest request) {
YuangongxinxiEntity user = yuangongxinxiService.selectOne(new EntityWrapper<YuangongxinxiEntity>().eq("account", username));
if(user != null){
if(!user.getRole().equals(role)){
return R.error("權(quán)限不正常");
}
if(user==null || !user.getPassword().equals(password)) {
return R.error("賬號(hào)或密碼不正確");
}
String token = tokenService.generateToken(user.getId(),user.getName(), "users", user.getRole());
return R.ok().put("token", token);
}else{
return R.error("賬號(hào)或密碼或權(quán)限不對(duì)");
}
}
/**
* 注冊(cè)
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody YuangongxinxiEntity user){
if(yuangongxinxiService.selectOne(new EntityWrapper<YuangongxinxiEntity>().eq("account", user.getAccount())) !=null) {
return R.error("員工已存在");
}
user.setRole("員工");
yuangongxinxiService.insert(user);
return R.ok();
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密碼重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YuangongxinxiEntity user = yuangongxinxiService.selectOne(new EntityWrapper<YuangongxinxiEntity>().eq("username", username));
if(user==null) {
return R.error("賬號(hào)不存在");
}
user.setPassword("123456");
yuangongxinxiService.update(user,null);
return R.ok("密碼已重置為:123456");
}
/**
* 獲取員工的session員工信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
YuangongxinxiEntity user = yuangongxinxiService.selectById(id);
return R.ok().put("data", user);
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
Object role = request.getSession().getAttribute("role");
PageUtils page = null;
if(role.equals("員工")){
params.put("yh",request.getSession().getAttribute("userId"));
page = yuangongxinxiService.queryPage(params);
}else{
page = yuangongxinxiService.queryPage(params);
}
return R.ok().put("data", page);
}
/**
* 后端詳情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
YuangongxinxiEntity yuangongxinxi = yuangongxinxiService.selectById(id);
if(yuangongxinxi!=null){
return R.ok().put("data", yuangongxinxi);
}else {
return R.error(511,"查不到數(shù)據(jù)");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YuangongxinxiEntity yuangongxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<YuangongxinxiEntity> queryWrapper = new EntityWrapper<YuangongxinxiEntity>()
.eq("name", yuangongxinxi.getName())
.eq("account", yuangongxinxi.getAccount())
.eq("password", yuangongxinxi.getPassword())
.eq("role", yuangongxinxi.getRole())
;
yuangongxinxi.setRole("員工");
logger.info("sql語(yǔ)句:"+queryWrapper.getSqlSegment());
YuangongxinxiEntity yuangongxinxiEntity = yuangongxinxiService.selectOne(queryWrapper);
if("".equals(yuangongxinxi.getImgPhoto()) || "null".equals(yuangongxinxi.getImgPhoto())){
yuangongxinxi.setImgPhoto(null);
}
if(yuangongxinxiEntity==null){
yuangongxinxiService.insert(yuangongxinxi);
return R.ok();
}else {
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YuangongxinxiEntity yuangongxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根據(jù)字段查詢(xún)是否有相同數(shù)據(jù)
Wrapper<YuangongxinxiEntity> queryWrapper = new EntityWrapper<YuangongxinxiEntity>()
.notIn("id",yuangongxinxi.getId())
.eq("name", yuangongxinxi.getName())
.eq("account", yuangongxinxi.getAccount())
.eq("password", yuangongxinxi.getPassword())
.eq("role", yuangongxinxi.getRole())
;
logger.info("sql語(yǔ)句:"+queryWrapper.getSqlSegment());
YuangongxinxiEntity yuangongxinxiEntity = yuangongxinxiService.selectOne(queryWrapper);
if("".equals(yuangongxinxi.getImgPhoto()) || "null".equals(yuangongxinxi.getImgPhoto())){
yuangongxinxi.setImgPhoto(null);
}
if(yuangongxinxiEntity==null){
yuangongxinxiService.updateById(yuangongxinxi);//根據(jù)id更新
return R.ok();
}else {
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
/**
* 刪除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
yuangongxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-654072.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-654072.html
package com.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.annotation.IgnoreAuth;
import com.entity.UserEntity;
import com.entity.YonghuxinxiEntity;
import com.service.TokenService;
import com.utils.MPUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.YonghuxinxiEntity;
import com.service.YonghuxinxiService;
import com.utils.PageUtils;
import com.utils.R;
/**
*
* 后端接口
* @author
* @email
* @date 2021-02-05
*/
@RestController
@Controller
@RequestMapping("/yonghuxinxi")
public class YonghuxinxiController {
private static final Logger logger = LoggerFactory.getLogger(YonghuxinxiController.class);
@Autowired
private YonghuxinxiService yonghuxinxiService;
@Autowired
private TokenService tokenService;
/**
* 登錄
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String role, HttpServletRequest request) {
YonghuxinxiEntity user = yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("account", username));
if(user != null){
if(!user.getRole().equals(role)){
return R.error("權(quán)限不正常");
}
if(user==null || !user.getPassword().equals(password)) {
return R.error("賬號(hào)或密碼不正確");
}
String token = tokenService.generateToken(user.getId(),user.getName(), "users", user.getRole());
return R.ok().put("token", token);
}else{
return R.error("賬號(hào)或密碼或權(quán)限不對(duì)");
}
}
/**
* 注冊(cè)
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody YonghuxinxiEntity user){
if(yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("account", user.getAccount())) !=null) {
return R.error("用戶(hù)已存在");
}
user.setRole("用戶(hù)");
yonghuxinxiService.insert(user);
return R.ok();
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密碼重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YonghuxinxiEntity user = yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("username", username));
if(user==null) {
return R.error("賬號(hào)不存在");
}
user.setPassword("123456");
yonghuxinxiService.update(user,null);
return R.ok("密碼已重置為:123456");
}
/**
* 獲取用戶(hù)的session用戶(hù)信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
YonghuxinxiEntity user = yonghuxinxiService.selectById(id);
return R.ok().put("data", user);
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
Object role = request.getSession().getAttribute("role");
PageUtils page = null;
if(role.equals("用戶(hù)")){
params.put("yh",request.getSession().getAttribute("userId"));
page = yonghuxinxiService.queryPage(params);
}else{
page = yonghuxinxiService.queryPage(params);
}
return R.ok().put("data", page);
}
/**
* 后端詳情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
YonghuxinxiEntity yonghuxinxi = yonghuxinxiService.selectById(id);
if(yonghuxinxi!=null){
return R.ok().put("data", yonghuxinxi);
}else {
return R.error(511,"查不到數(shù)據(jù)");
}
}
/**
* 后端保存
*/
@IgnoreAuth
@RequestMapping("/save")
public R save(@RequestBody YonghuxinxiEntity yonghuxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<YonghuxinxiEntity> queryWrapper = new EntityWrapper<YonghuxinxiEntity>()
.eq("name", yonghuxinxi.getName())
.eq("account", yonghuxinxi.getAccount())
.eq("password", yonghuxinxi.getPassword())
.eq("role", yonghuxinxi.getRole())
;
yonghuxinxi.setRole("用戶(hù)");
logger.info("sql語(yǔ)句:"+queryWrapper.getSqlSegment());
YonghuxinxiEntity yonghuxinxiEntity = yonghuxinxiService.selectOne(queryWrapper);
if("".equals(yonghuxinxi.getImgPhoto()) || "null".equals(yonghuxinxi.getImgPhoto())){
yonghuxinxi.setImgPhoto(null);
}
if(yonghuxinxiEntity==null){
yonghuxinxiService.insert(yonghuxinxi);
return R.ok();
}else {
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YonghuxinxiEntity yonghuxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根據(jù)字段查詢(xún)是否有相同數(shù)據(jù)
Wrapper<YonghuxinxiEntity> queryWrapper = new EntityWrapper<YonghuxinxiEntity>()
.notIn("id",yonghuxinxi.getId())
.eq("name", yonghuxinxi.getName())
.eq("account", yonghuxinxi.getAccount())
.eq("password", yonghuxinxi.getPassword())
.eq("role", yonghuxinxi.getRole())
;
logger.info("sql語(yǔ)句:"+queryWrapper.getSqlSegment());
YonghuxinxiEntity yonghuxinxiEntity = yonghuxinxiService.selectOne(queryWrapper);
if("".equals(yonghuxinxi.getImgPhoto()) || "null".equals(yonghuxinxi.getImgPhoto())){
yonghuxinxi.setImgPhoto(null);
}
if(yonghuxinxiEntity==null){
yonghuxinxiService.updateById(yonghuxinxi);//根據(jù)id更新
return R.ok();
}else {
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
/**
* 刪除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
yonghuxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
到了這里,關(guān)于ssm基于Java ssm的校園驛站管理系統(tǒng)源碼和論文的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!