现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本T公司项目管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此T公司项目管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发.T公司项目管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。
2.1 Java语言
Java语言最早是由Sun公司在1995年推出的一门新型的计算机编程语言,经过多年的发展,能够具有大部分计算机编程语言的一些特点。Java语言又是一门基于面向对象思想的计算机编程语言,不仅可以吸收接纳C++语言的优势,也在一定程度上放弃了它的一些不足之处。Java计算机语言具有分布式等特点。Java语言可以开发的应用主要有安卓应用、网站开发等应用。
2.2 Vue框架
Vue框架是可以构建项目用户操作界面的应用框架,所有的系统页面效果设计通过采取自底向上的增量开发设计思想,在项目数据传输上提供了MVVM的业务数据双向绑定思想。Vue框架的主要特点是:1.Vue框架提供了数据的双向绑定进行传输的效果;2.Vue框架项目的数据是通过路由进行管理;3.Vue框架的轻量级,使得开发人员更加容易上手进行项目开发。
2.3 MySQL数据库
MySQL数据库在项目中运行速度快,对于平时开发使用到的平台是没用任何的限制,能够被广泛的应用在企业级开发中。MySQL数据库是指一个基于开源的和多线程的用户关系和管理的数据库系统,MySQL是基于开放源代码的数据库管理系统,能够跨一定的平台且可以正常的进行使用。
MySQL数据库管理并不是让所有的数据表都统一放在一个空间足够大的数据存储容器的里面,而是要把同一个数据库里面存储的全部数据信息都可以分别的存放在各个不同格式的存储表当中,MySQL作为一种关联性数据库的管理系统,能够有效快速地去提升数据处理存储的速度安全性与效率。并且这样也可以让数据库的灵活程度得到很大幅度的提高。
2.4 IDEA开发工具
IDEA开发工具的全称是叫IntelliJ IDEA,是可以进行Java语言功能编码实现的工具之一。IDEA编译工具目前在Java程序编程中是最理想的一种开发工具,它本身既拥有智能的且便捷实用的代码助手、丰富而灵活强大的编码模板库支持、超强且高效简洁的快捷键体系,并且它能自动提示代码、代码分析、全栈开发等方面的功能都极为优秀。提倡智能编码,能够最大限度的减少系统设计上的工作量。
2.5 SSM框架
SSM框架是JAVA语言里面三大基本的应用框架的组合体,是一个标准的MVC的应用框架之一。一个完整的使用SSM框架开发的系统,其代码结构,主要是由四个部分进行组成,能够对业务进行结构化的拆分。在项目中,使用Spring框架可以实现对项目中的所有业务对象信息进行管理,使用SpringMVC框架能够对项目中的用户操作功能的请求信息进行转发并进行其他的操作,使用Mybatis框架可以对项目中的数据信息进行持久化的操作处理。
package com.controller;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
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.DictionaryEntity;
import com.service.DictionaryService;
import com.entity.view.DictionaryView;
import com.utils.PageUtils;
import com.utils.R;
/**
* 字典表
* 后端接口
* @author
* @email
* @date 2021-03-24
*/
@RestController
@Controller
@RequestMapping("/dictionary")
public class DictionaryController {
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
@Autowired
private DictionaryService dictionaryService;
@Autowired
private TokenService tokenService;
//级联表service
/**
* 后端列表
*/
@RequestMapping("/page")
@IgnoreAuth
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isNotEmpty(role) && "员工".equals(role)){
params.put("yonghuId",request.getSession().getAttribute("userId"));
}
PageUtils page = dictionaryService.queryPage(params);
//字典表数据转换
List<DictionaryView> list =(List<DictionaryView>)page.getList();
for(DictionaryView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
DictionaryEntity dictionary = dictionaryService.selectById(id);
if(dictionary !=null){
//entity转view
DictionaryView view = new DictionaryView();
BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.eq("code_index", dictionary.getCodeIndex())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
if(dictionaryEntity==null){
dictionary.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// dictionary.set
// }
dictionaryService.insert(dictionary);
//如果字典表新增数据的话,把数据再重新查出,放入监听器中
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
Map<String, Map<Integer,String>> map = new HashMap<>();
for(DictionaryEntity d :dictionaryEntities){
Map<Integer, String> m = map.get(d.getDicCode());
if(m ==null || m.isEmpty()){
m = new HashMap<>();
}
m.put(d.getCodeIndex(),d.getIndexName());
map.put(d.getDicCode(),m);
}
servletContext.setAttribute("dictionaryMap",map);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
//根据字段查询是否有相同数据
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.notIn("id",dictionary.getId())
.eq("dic_code", dictionary.getDicCode())
.eq("code_index", dictionary.getCodeIndex())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
if(dictionaryEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// dictionary.set
// }
dictionaryService.updateById(dictionary);//根据id更新
//如果字典表修改数据的话,把数据再重新查出,放入监听器中
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
Map<String, Map<Integer,String>> map = new HashMap<>();
for(DictionaryEntity d :dictionaryEntities){
Map<Integer, String> m = map.get(d.getDicCode());
if(m ==null || m.isEmpty()){
m = new HashMap<>();
}
m.put(d.getCodeIndex(),d.getIndexName());
map.put(d.getDicCode(),m);
}
servletContext.setAttribute("dictionaryMap",map);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
dictionaryService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
package com.controller;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
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.KehuEntity;
import com.service.KehuService;
import com.entity.view.KehuView;
import com.utils.PageUtils;
import com.utils.R;
/**
* 客户模块
* 后端接口
* @author
* @email
* @date 2021-03-24
*/
@RestController
@Controller
@RequestMapping("/kehu")
public class KehuController {
private static final Logger logger = LoggerFactory.getLogger(KehuController.class);
@Autowired
private KehuService kehuService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isNotEmpty(role) && "员工".equals(role)){
params.put("yonghuId",request.getSession().getAttribute("userId"));
}
PageUtils page = kehuService.queryPage(params);
//字典表数据转换
List<KehuView> list =(List<KehuView>)page.getList();
for(KehuView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
KehuEntity kehu = kehuService.selectById(id);
if(kehu !=null){
//entity转view
KehuView view = new KehuView();
BeanUtils.copyProperties( kehu , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody KehuEntity kehu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,kehu:{}",this.getClass().getName(),kehu.toString());
Wrapper<KehuEntity> queryWrapper = new EntityWrapper<KehuEntity>()
.eq("khname", kehu.getKhname())
.eq("sex_types", kehu.getSexTypes())
.eq("khphone", kehu.getKhphone())
.eq("gongshi", kehu.getGongshi())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
KehuEntity kehuEntity = kehuService.selectOne(queryWrapper);
if(kehuEntity==null){
kehu.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// kehu.set
// }
kehuService.insert(kehu);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody KehuEntity kehu, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,kehu:{}",this.getClass().getName(),kehu.toString());
//根据字段查询是否有相同数据
Wrapper<KehuEntity> queryWrapper = new EntityWrapper<KehuEntity>()
.notIn("id",kehu.getId())
.andNew()
.eq("khname", kehu.getKhname())
.eq("sex_types", kehu.getSexTypes())
.eq("khphone", kehu.getKhphone())
.eq("gongshi", kehu.getGongshi())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
KehuEntity kehuEntity = kehuService.selectOne(queryWrapper);
if("".equals(kehu.getImgPhoto()) || "null".equals(kehu.getImgPhoto())){
kehu.setImgPhoto(null);
}
if(kehuEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// kehu.set
// }
kehuService.updateById(kehu);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
kehuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}