博主介绍:专注于Java(springboot ssm 等开发框架) vue .net php phython node.js uniapp 微信小程序 等诸多技术领域和毕业项目实战、企业信息化系统建设,从业十五余年开发设计教学工作
☆☆☆ 精彩专栏推荐订阅☆☆☆☆☆不然下次找不到哟
我的博客空间发布了2000+毕设题目 方便大家学习使用
感兴趣的可以先收藏起来,还有大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助更多的人
文末下方有源码获取地址
4.2功能结构设计
为了让系统的编码可以顺利进行,特意对本系统功能进行细分设计,设计的系统功能结构见下图。
图4.1 系统功能结构图
4.3.1 数据库概念设计
4.3.2 数据库物理设计
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
dic_code |
String |
字段 |
是 |
3 |
dic_name |
String |
字段名 |
是 |
4 |
code_index |
Integer |
编码 |
是 |
5 |
index_name |
String |
编码名字 |
是 |
6 |
super_id |
Integer |
父字段id |
是 |
7 |
beizhu |
String |
备注 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.2公司表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
gongsi_name |
String |
公司名称 |
是 |
3 |
hanye_types |
Integer |
所在行业 |
是 |
4 |
gongsi_phone |
String |
联系方式 |
是 |
5 |
gongsi_email |
String |
邮箱 |
是 |
6 |
gongsi_photo |
String |
营业执照展示 |
是 |
7 |
gongsi_content |
String |
公司简介 |
是 |
8 |
gongsi_delete |
Integer |
逻辑删除 |
是 |
9 |
create_time |
Date |
创建时间 |
是 |
表4.3简历表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
yonghu_id |
Integer |
学生 |
是 |
3 |
jianli_uuid_number |
String |
简历唯一编号 |
是 |
4 |
jianli_name |
String |
简历名称 |
是 |
5 |
jianli_xingming |
String |
姓名 |
是 |
6 |
jianli_types |
Integer |
求职意向 |
是 |
7 |
jianli_xinzi |
String |
期望工资 |
是 |
8 |
jianli_xueli |
String |
学历 |
是 |
9 |
jianli_jingli |
String |
工作经历 |
是 |
10 |
sex_types |
Integer |
性别 |
是 |
11 |
jianli_phone |
String |
手机号 |
是 |
12 |
jianli_photo |
String |
照片 |
是 |
13 |
jianli_address |
String |
位置 |
是 |
14 |
jiaoyu_text |
String |
教育经历 |
是 |
15 |
shixi_text |
String |
实习或工作经历 |
是 |
16 |
geren_text |
String |
个人介绍 |
是 |
17 |
create_time |
Date |
创建时间 |
是 |
表4.4就业统计表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
yonghu_id |
Integer |
学生 |
是 |
3 |
zhaopin_name |
String |
应聘公司 |
是 |
4 |
zhaopin_yuexin |
String |
月薪 |
是 |
5 |
zhaopin_xinzi |
String |
就业薪资 |
是 |
6 |
jiuyetongji_types |
Integer |
是否就业 |
是 |
7 |
jiuyetongji_yesno_types |
Integer |
审核状态 |
是 |
8 |
jiuyetongji_yesno_text |
String |
审核留言 |
是 |
9 |
create_time |
Date |
创建时间 |
是 |
表4.5公告信息表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
news_name |
String |
公告信息标题 |
是 |
3 |
news_types |
Integer |
公告信息类型 |
是 |
4 |
news_photo |
String |
公告信息图片 |
是 |
5 |
insert_time |
Date |
公告信息时间 |
是 |
6 |
news_content |
String |
公告信息详情 |
是 |
7 |
news_delete |
Integer |
假删 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.6简历投递表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
jianli_id |
Integer |
简历 |
是 |
3 |
zhaopin_id |
Integer |
招聘 |
是 |
4 |
insert_time |
Date |
投递时间 |
是 |
5 |
create_time |
Date |
创建时间 |
是 |
表4.7学生表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
yonghu_name |
String |
学生姓名 |
是 |
3 |
yonghu_photo |
String |
头像 |
是 |
4 |
yonghu_phone |
String |
学生手机号 |
是 |
5 |
yonghu_id_number |
String |
学生身份证号 |
是 |
6 |
yonghu_email |
String |
邮箱 |
是 |
7 |
yonghu_delete |
Integer |
假删 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.8职位招聘表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
gongsi_id |
Integer |
公司 |
是 |
3 |
zhaopin_name |
String |
招聘信息名称 |
是 |
4 |
zhaopin_photo |
String |
招聘信息照片 |
是 |
5 |
zhaopin_daiyu |
String |
薪资待遇 |
是 |
6 |
zhaopin_shebao |
String |
社保信息 |
是 |
7 |
zhaopin_address |
String |
工作地点 |
是 |
8 |
lianxiren_name |
String |
联系人 |
是 |
9 |
zhaopin_phone |
String |
招聘电话 |
是 |
10 |
zan_number |
Integer |
赞 |
是 |
11 |
cai_number |
Integer |
踩 |
是 |
12 |
zhaopin_types |
Integer |
招聘岗位 |
是 |
13 |
zhaopin_renshu_number |
Integer |
招聘人数 |
是 |
14 |
shangxia_types |
Integer |
是否上架 |
是 |
15 |
zhaopin_content |
String |
招聘信息详情 |
是 |
16 |
create_time |
Date |
创建时间 |
是 |
表4.9职位留言表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
zhaopin_id |
Integer |
职位 |
是 |
3 |
yonghu_id |
Integer |
学生 |
是 |
4 |
zhaopin_liuyan_text |
String |
留言内容 |
是 |
5 |
reply_text |
String |
回复内容 |
是 |
6 |
insert_time |
Date |
留言时间 |
是 |
7 |
update_time |
Date |
回复时间 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.10用户表表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
username |
String |
用户名 |
是 |
3 |
password |
String |
密码 |
是 |
4 |
role |
String |
角色 |
是 |
5 |
addtime |
Date |
新增时间 |
是 |
第5章 系统实现
这个环节需要使用前面的设计方案,包括对系统模块的设计,还有对程序后台的数据支持的数据库的设计等。不过这部分内容还是强调系统编码人员的开发能力,要把前面设计的内容通过编码的形式以一个完整的,可以运行的系统呈现出来。
功能模块的实现
5.1学生信息管理
如图5.1显示的就是学生信息管理页面,此页面提供给管理员的功能有:学生信息的查询管理,可以删除学生信息、修改学生信息、新增学生信息,
还进行了对用户名称的模糊查询的条件
图5.1 学生信息管理页面
5.2 公司信息管理
如图5.2显示的就是公司信息管理页面,此页面提供给管理员的功能有:查看已发布的公司信息数据,修改公司信息,公司信息作废,即可删除,还进行了对公司信息名称的模糊查询 公司信息信息的类型查询等等一些条件。
图5.2 公司信息管理页面
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
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.*;
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.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 公司
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/gongsi")
public class GongsiController {
private static final Logger logger = LoggerFactory.getLogger(GongsiController.class);
@Autowired
private GongsiService gongsiService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@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(false)
return R.error(511,"永不会进入");
else if("学生".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("公司".equals(role))
params.put("gongsiId",request.getSession().getAttribute("userId"));
params.put("gongsiDeleteStart",1);params.put("gongsiDeleteEnd",1);
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = gongsiService.queryPage(params);
//字典表数据转换
List<GongsiView> list =(List<GongsiView>)page.getList();
for(GongsiView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
GongsiEntity gongsi = gongsiService.selectById(id);
if(gongsi !=null){
//entity转view
GongsiView view = new GongsiView();
BeanUtils.copyProperties( gongsi , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody GongsiEntity gongsi, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,gongsi:{}",this.getClass().getName(),gongsi.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<GongsiEntity> queryWrapper = new EntityWrapper<GongsiEntity>()
.eq("username", gongsi.getUsername())
.or()
.eq("gongsi_phone", gongsi.getGongsiPhone())
.andNew()
.eq("gongsi_delete", 1)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GongsiEntity gongsiEntity = gongsiService.selectOne(queryWrapper);
if(gongsiEntity==null){
gongsi.setGongsiDelete(1);
gongsi.setCreateTime(new Date());
gongsi.setPassword("123456");
gongsiService.insert(gongsi);
return R.ok();
}else {
return R.error(511,"账户或者联系方式已经被使用");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody GongsiEntity gongsi, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,gongsi:{}",this.getClass().getName(),gongsi.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<GongsiEntity> queryWrapper = new EntityWrapper<GongsiEntity>()
.notIn("id",gongsi.getId())
.andNew()
.eq("username", gongsi.getUsername())
.or()
.eq("gongsi_phone", gongsi.getGongsiPhone())
.andNew()
.eq("gongsi_delete", 1)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GongsiEntity gongsiEntity = gongsiService.selectOne(queryWrapper);
if("".equals(gongsi.getGongsiPhoto()) || "null".equals(gongsi.getGongsiPhoto())){
gongsi.setGongsiPhoto(null);
}
if(gongsiEntity==null){
gongsiService.updateById(gongsi);//根据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());
ArrayList<GongsiEntity> list = new ArrayList<>();
for(Integer id:ids){
GongsiEntity gongsiEntity = new GongsiEntity();
gongsiEntity.setId(id);
gongsiEntity.setGongsiDelete(2);
list.add(gongsiEntity);
}
if(list != null && list.size() >0){
gongsiService.updateBatchById(list);
}
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<GongsiEntity> gongsiList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
GongsiEntity gongsiEntity = new GongsiEntity();
// gongsiEntity.setUsername(data.get(0)); //账户 要改的
// //gongsiEntity.setPassword("123456");//密码
// gongsiEntity.setGongsiName(data.get(0)); //公司名称 要改的
// gongsiEntity.setHanyeTypes(Integer.valueOf(data.get(0))); //所在行业 要改的
// gongsiEntity.setGongsiPhone(data.get(0)); //联系方式 要改的
// gongsiEntity.setGongsiEmail(data.get(0)); //邮箱 要改的
// gongsiEntity.setGongsiPhoto("");//照片
// gongsiEntity.setGongsiContent("");//照片
// gongsiEntity.setGongsiDelete(1);//逻辑删除字段
// gongsiEntity.setCreateTime(date);//时间
gongsiList.add(gongsiEntity);
//把要查询是否重复的字段放入map中
//账户
if(seachFields.containsKey("username")){
List<String> username = seachFields.get("username");
username.add(data.get(0));//要改的
}else{
List<String> username = new ArrayList<>();
username.add(data.get(0));//要改的
seachFields.put("username",username);
}
//联系方式
if(seachFields.containsKey("gongsiPhone")){
List<String> gongsiPhone = seachFields.get("gongsiPhone");
gongsiPhone.add(data.get(0));//要改的
}else{
List<String> gongsiPhone = new ArrayList<>();
gongsiPhone.add(data.get(0));//要改的
seachFields.put("gongsiPhone",gongsiPhone);
}
}
//查询是否重复
//账户
List<GongsiEntity> gongsiEntities_username = gongsiService.selectList(new EntityWrapper<GongsiEntity>().in("username", seachFields.get("username")).eq("gongsi_delete", 1));
if(gongsiEntities_username.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(GongsiEntity s:gongsiEntities_username){
repeatFields.add(s.getUsername());
}
return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());
}
//联系方式
List<GongsiEntity> gongsiEntities_gongsiPhone = gongsiService.selectList(new EntityWrapper<GongsiEntity>().in("gongsi_phone", seachFields.get("gongsiPhone")).eq("gongsi_delete", 1));
if(gongsiEntities_gongsiPhone.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(GongsiEntity s:gongsiEntities_gongsiPhone){
repeatFields.add(s.getGongsiPhone());
}
return R.error(511,"数据库的该表中的 [联系方式] 字段已经存在 存在数据为:"+repeatFields.toString());
}
gongsiService.insertBatch(gongsiList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
GongsiEntity gongsi = gongsiService.selectOne(new EntityWrapper<GongsiEntity>().eq("username", username));
if(gongsi==null || !gongsi.getPassword().equals(password))
return R.error("账号或密码不正确");
else if(gongsi.getGongsiDelete() != 1)
return R.error("账户已被删除");
// // 获取监听器中的字典表
// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
// Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
// Map<Integer, String> role_types = dictionaryMap.get("role_types");
// role_types.get(.getRoleTypes());
String token = tokenService.generateToken(gongsi.getId(),username, "gongsi", "公司");
R r = R.ok();
r.put("token", token);
r.put("role","公司");
r.put("username",gongsi.getGongsiName());
r.put("tableName","gongsi");
r.put("userId",gongsi.getId());
return r;
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody GongsiEntity gongsi){
// ValidatorUtils.validateEntity(user);
Wrapper<GongsiEntity> queryWrapper = new EntityWrapper<GongsiEntity>()
.eq("username", gongsi.getUsername())
.or()
.eq("gongsi_phone", gongsi.getGongsiPhone())
.andNew()
.eq("gongsi_delete", 1)
;
GongsiEntity gongsiEntity = gongsiService.selectOne(queryWrapper);
if(gongsiEntity != null)
return R.error("账户或者联系方式已经被使用");
gongsi.setGongsiDelete(1);
gongsi.setCreateTime(new Date());
gongsiService.insert(gongsi);
return R.ok();
}
/**
* 重置密码
*/
@GetMapping(value = "/resetPassword")
public R resetPassword(Integer id){
GongsiEntity gongsi = new GongsiEntity();
gongsi.setPassword("123456");
gongsi.setId(id);
gongsiService.updateById(gongsi);
return R.ok();
}
/**
* 忘记密码
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) {
GongsiEntity gongsi = gongsiService.selectOne(new EntityWrapper<GongsiEntity>().eq("username", username));
if(gongsi!=null){
gongsi.setPassword("123456");
boolean b = gongsiService.updateById(gongsi);
if(!b){
return R.error();
}
}else{
return R.error("账号不存在");
}
return R.ok();
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrGongsi(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
GongsiEntity gongsi = gongsiService.selectById(id);
if(gongsi !=null){
//entity转view
GongsiView view = new GongsiView();
BeanUtils.copyProperties( gongsi , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = gongsiService.queryPage(params);
//字典表数据转换
List<GongsiView> list =(List<GongsiView>)page.getList();
for(GongsiView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
GongsiEntity gongsi = gongsiService.selectById(id);
if(gongsi !=null){
//entity转view
GongsiView view = new GongsiView();
BeanUtils.copyProperties( gongsi , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody GongsiEntity gongsi, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,gongsi:{}",this.getClass().getName(),gongsi.toString());
Wrapper<GongsiEntity> queryWrapper = new EntityWrapper<GongsiEntity>()
.eq("username", gongsi.getUsername())
.or()
.eq("gongsi_phone", gongsi.getGongsiPhone())
.andNew()
.eq("gongsi_delete", 1)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GongsiEntity gongsiEntity = gongsiService.selectOne(queryWrapper);
if(gongsiEntity==null){
gongsi.setGongsiDelete(1);
gongsi.setCreateTime(new Date());
gongsi.setPassword("123456");
gongsiService.insert(gongsi);
return R.ok();
}else {
return R.error(511,"账户或者联系方式已经被使用");
}
}
}
5.3公告类型管理
如图5.3显示的就是公告类型管理页面,此页面提供给管理员的功能有:根据公告类型进行条件查询,还可以对公告类型进行新增、修改、查询操作等等。
图5.3 公告类型管理页面
5.1公告信息管理
如图5.4显示的就是公告信息管理页面,此页面提供给管理员的功能有:根据公告信息进行新增、修改、查询操作等等。
图5.4 公告信息管理页面
大家点赞、收藏、关注、评论啦 其他的定制服务 商务合作 下方联系卡片↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 或者私信作者