源码获取:俺的博客首页 "资源" 里下载!
项目介绍
管理员角色包含以下功能:
管理员登陆,设备管理,客户管理,用户管理,产品管理,工序管理,车间管理,订单管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
技术栈
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:HTML+CSS+JavaScript+jsp
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/get/{userId}")
@ResponseBody
public SysUser getItemById(@PathVariable String userId) throws Exception{
SysUser sysUser = userService.get(userId);
return sysUser;
}
@RequestMapping("/find")
public String find() throws Exception{
return "/user/user_list";
}
@RequestMapping("/role")
public String userRole() throws Exception{
return "/user/user_role_edit";
}
@RequestMapping("/add")
public String add() throws Exception{
return "/user/user_add";
}
@RequestMapping("/edit")
public String edit() throws Exception{
return "/user/user_edit";
}
@RequestMapping("/list")
@ResponseBody
public EUDataGridResult getList(Integer page, Integer rows, SysUser sysUser) throws Exception{
EUDataGridResult result = userService.getList(page, rows, sysUser);
return result;
}
@RequestMapping(value="/insert", method=RequestMethod.POST)
@ResponseBody
private CustomResult insert(@Valid SysUser user, BindingResult bindingResult) throws Exception {
CustomResult result;
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
if(userService.findByUserNameAndId(user.getUsername(), user.getId()).size()>0){
return CustomResult.build(101, "该用户名已经存在,请更换用户名!");
}else if(userService.get(user.getId()) != null){
return CustomResult.build(101, "该用户编号已经存在,请更换用户编号!");
}
result = userService.insert(user);
return result;
}
@RequestMapping(value="/update")
@ResponseBody
private CustomResult update(@Valid SysUser user, BindingResult bindingResult) throws Exception {
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
return userService.update(user);
}
@RequestMapping(value="/update_all")
@ResponseBody
private CustomResult updateAll(@Valid SysUser user, BindingResult bindingResult) throws Exception {
CustomResult result;
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
if(userService.findByUserNameAndId(user.getUsername(), user.getId()).size()>0){
return CustomResult.build(101, "该用户名已经存在,请更换用户名!");
}
result = userService.updateAll(user);
return result;
}
@RequestMapping(value="/delete")
@ResponseBody
private CustomResult delete(String id) throws Exception {
CustomResult result = userService.delete(id);
return result;
}
@RequestMapping(value="/delete_batch")
@ResponseBody
private CustomResult deleteBatch(String[] ids) throws Exception {
CustomResult result = userService.deleteBatch(ids);
return result;
}
@RequestMapping(value="/change_status")
@ResponseBody
public CustomResult changeStatus(String[] ids) throws Exception{
CustomResult result = userService.changeStatus(ids);
return result;
}
//根据用户id查找
@RequestMapping("/search_user_by_userId")
@ResponseBody
public EUDataGridResult searchUserByUserId(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = userService.searchUserByUserId(page, rows, searchValue);
return result;
}
//根据用户名查找
@RequestMapping("/search_user_by_userName")
@ResponseBody
public EUDataGridResult searchUserByUserName(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = userService.searchUserByUserName(page, rows, searchValue);
return result;
}
//搜根据角色名查找
@RequestMapping("/search_user_by_roleName")
@ResponseBody
public EUDataGridResult searchUserByRoleName(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = userService.searchUserByRoleName(page, rows, searchValue);
return result;
}
}
加工处理控制层:
@Controller
@RequestMapping("/process")
public class ProcessController {
@Autowired
private ProcessService processService;
@RequestMapping("/get/{processId}")
@ResponseBody
public Process getItemById(@PathVariable String processId) throws Exception{
Process process = processService.get(processId);
return process;
}
@RequestMapping("/find")
public String find() throws Exception{
return "/process/process_list";
}
@RequestMapping("/add")
public String add() throws Exception{
return "/process/process_add";
}
@RequestMapping("/edit")
public String edit() throws Exception{
return "/process/process_edit";
}
@RequestMapping("/get_data")
@ResponseBody
public List<Process> getData() throws Exception{
List<Process> list = processService.find();
return list;
}
@RequestMapping("/list")
@ResponseBody
public EUDataGridResult getItemList(Integer page, Integer rows, Process process) throws Exception{
EUDataGridResult result = processService.getList(page, rows, process);
return result;
}
@RequestMapping(value="/insert", method=RequestMethod.POST)
@ResponseBody
private CustomResult insert(@Valid Process process, BindingResult bindingResult) throws Exception {
CustomResult result;
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
if(processService.get(process.getProcessId()) != null){
result = new CustomResult(0, "该工序编号已经存在,请更换工序编号!", null);
}else{
result = processService.insert(process);
}
return result;
}
@RequestMapping(value="/update_all")
@ResponseBody
private CustomResult updateAll(@Valid Process process, BindingResult bindingResult) throws Exception {
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
return processService.updateAll(process);
}
@RequestMapping(value="/delete_batch")
@ResponseBody
private CustomResult deleteBatch(String[] ids) throws Exception {
CustomResult result = processService.deleteBatch(ids);
return result;
}
//根据工序id查找
@RequestMapping("/search_process_by_processId")
@ResponseBody
public EUDataGridResult searchProcessByProcessId(Integer page, Integer rows, String searchValue) throws Exception{
EUDataGridResult result = processService.searchProcessByProcessId(page, rows, searchValue);
return result;
}
//根据工序计划id查找
@RequestMapping("/search_process_by_technologyPlanId")
@ResponseBody
public EUDataGridResult searchProcessByTechnologyPlanId(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = processService.searchProcessByTechnologyPlanId(page, rows, searchValue);
return result;
}
}
客户管理控制层:
@Controller
@RequestMapping("/custom")
public class CustomController {
@Autowired
private CustomService customService;
@RequestMapping("/get/{customId}")
@ResponseBody
public Custom getItemById(@PathVariable String customId) throws Exception{
Custom custom = customService.get(customId);
return custom;
}
@RequestMapping("/find")
public String find() throws Exception{
return "custom/custom_list";
}
@RequestMapping("/add")
public String add() {
return "custom/custom_add";
}
@RequestMapping("/edit")
public String edit() throws Exception{
return "custom/custom_edit";
}
@RequestMapping("/get_data")
@ResponseBody
public List<Custom> getData() throws Exception{
List<Custom> list = customService.find();
return list;
}
@RequestMapping("/list")
@ResponseBody
public EUDataGridResult getItemList(Integer page, Integer rows, Custom custom) throws Exception{
EUDataGridResult result = customService.getList(page, rows, custom);
return result;
}
@RequestMapping(value="/insert", method=RequestMethod.POST)
@ResponseBody
private CustomResult insert(@Valid Custom custom, BindingResult bindingResult) throws Exception {
CustomResult result;
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
if(customService.get(custom.getCustomId()) != null){
result = new CustomResult(0, "该客户编号已经存在,请更换客户编号!", null);
}else{
result = customService.insert(custom);
}
return result;
}
@RequestMapping(value="/update")
@ResponseBody
private CustomResult update(@Valid Custom custom, BindingResult bindingResult) throws Exception {
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
return customService.update(custom);
}
@RequestMapping(value="/update_all")
@ResponseBody
private CustomResult updateAll(@Valid Custom custom, BindingResult bindingResult) throws Exception {
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
return customService.updateAll(custom);
}
@RequestMapping(value="/update_note")
@ResponseBody
private CustomResult updateNote(@Valid Custom custom, BindingResult bindingResult) throws Exception {
if(bindingResult.hasErrors()){
FieldError fieldError = bindingResult.getFieldError();
return CustomResult.build(100, fieldError.getDefaultMessage());
}
return customService.updateNote(custom);
}
@RequestMapping(value="/delete")
@ResponseBody
private CustomResult delete(String id) throws Exception {
CustomResult result = customService.delete(id);
return result;
}
@RequestMapping(value="/delete_batch")
@ResponseBody
private CustomResult deleteBatch(String[] ids) throws Exception {
CustomResult result = customService.deleteBatch(ids);
return result;
}
@RequestMapping(value="/change_status")
@ResponseBody
public CustomResult changeStatus(String[] ids) throws Exception{
CustomResult result = customService.changeStatus(ids);
return result;
}
//根据客户id查找
@RequestMapping("/search_custom_by_customId")
@ResponseBody
public EUDataGridResult searchCustomByCustomId(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = customService.searchCustomByCustomId(page, rows, searchValue);
return result;
}
//根据客户名查找
@RequestMapping("/search_custom_by_customName")
@ResponseBody
public EUDataGridResult searchCustomByCustomName(Integer page, Integer rows, String searchValue)
throws Exception{
EUDataGridResult result = customService.searchCustomByCustomName(page, rows, searchValue);
return result;
}
}
源码获取:俺的博客首页 "资源" 里下载!