一、新建设备表(t_base_device)

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for t_base_device
-- ----------------------------
DROP TABLE IF EXISTS `t_base_device`;
CREATE TABLE `t_base_device` (
`deviceid` int(10) NOT NULL,
`devicecode` varchar(50) DEFAULT NULL,
`devicename` varchar(50) DEFAULT NULL,
`deviceclassno` varchar(10) DEFAULT NULL,
`status` varchar(10) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`userdept` varchar(200) DEFAULT NULL,
PRIMARY KEY (`deviceid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of t_base_device
-- ----------------------------
INSERT INTO `t_base_device` VALUES ('', 'STPC201711001', '华硕X550', '', '使用中', '谢红卫', '软件研发部');
INSERT INTO `t_base_device` VALUES ('', 'STPC201711002', '联想T440P', '', '库存', null, null);

二、实体类(BaseDevice.java)

package net.xhw.device.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table; @SuppressWarnings("serial")
@Entity
@Table(name = "t_base_device")
public class BaseDevice implements java.io.Serializable{ private int deviceid;
private String devicecode;
private String devicename;
private String deviceclassno;
private String status;
private String username;
private String userdept; @Id
@Column(name = "deviceid", length = 10)
public int getDeviceid() {
return deviceid;
} @Column(name = "devicecode", length = 50)
public String getDevicecode() {
return devicecode;
} @Column(name = "devicename", length = 50)
public String getDevicename() {
return devicename;
} @Column(name = "deviceclassno", length = 10)
public String getDeviceclassno() {
return deviceclassno;
} @Column(name = "status", length = 10)
public String getStatus() {
return status;
} @Column(name = "username", length = 50)
public String getUsername() {
return username;
} @Column(name = "userdept", length = 200)
public String getUserdept() {
return userdept;
} public void setDeviceid(int deviceid) {
this.deviceid = deviceid;
} public void setDevicecode(String devicecode) {
this.devicecode = devicecode;
} public void setDevicename(String devicename) {
this.devicename = devicename;
} public void setDeviceclassno(String deviceclassno) {
this.deviceclassno = deviceclassno;
} public void setStatus(String status) {
this.status = status;
} public void setUsername(String username) {
this.username = username;
} public void setUserdept(String userdept) {
this.userdept = userdept;
} }

三、action控制类(DeviceController.java)

package net.xhw.device.ctrl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import net.xhw.device.entity.BaseDevice; @Controller
@RequestMapping("/deviceController")
public class DeviceController extends BaseController { private SystemService systemService; @Autowired
public void setSystemService(SystemService systemService) {
this.systemService = systemService;
} @RequestMapping(params = "deviceList")
public ModelAndView deviceList(HttpServletRequest request) {
return new ModelAndView("device/deviceList");
} @RequestMapping(params = "datagrid")
public void datagrid(BaseDevice basedevice, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(BaseDevice.class, dataGrid);
this.systemService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
} }

四、页面文件(deviceList.jsp)

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base> <t:datagrid name="deviceList" title="设备信息列表" actionUrl="deviceController.do?datagrid"
fit="true" fitColumns="true" idField="deviceid" queryMode="group">
<t:dgCol title="设备ID" field="deviceid" hidden="true"></t:dgCol>
<t:dgCol title="设备编码" field="devicecode" query="false" width="100"></t:dgCol>
<t:dgCol title="设备名称" field="devicename" query="false" width="100"></t:dgCol>
<t:dgCol title="状态" field="status" query="false" width="100"></t:dgCol>
<t:dgCol title="使用人" field="username" query="false" width="100"></t:dgCol>
</t:datagrid>

五、修改配置文件

  1、修改spring-mvc.xml,添加扫描控制类包    

<context:component-scan base-package="org.jeecgframework.web.*,com.jeecg.*,net.xhw.*">
  <context:exclude-filter type="annotation"
  expression="org.springframework.stereotype.Service" />
</context:component-scan>

  2、修改spring-mvc-hibernate.xml,添加注解方式配置

<!-- 注解方式配置 -->
<property name="packagesToScan">
  <list>
  <value>org.jeecgframework.web.system.pojo.*</value>
  <value>org.jeecgframework.web.test.entity.*</value>
    <value>org.jeecgframework.web.autoform.*</value>
    <value>org.jeecgframework.web.cgform.entity.*</value>
    <value>org.jeecgframework.web.cgreport.entity.*</value>
    <value>org.jeecgframework.web.cgdynamgraph.entity.*</value>
    <value>org.jeecgframework.web.graphreport.entity.*</value>
    <value>org.jeecgframework.web.system.sms.*</value>
    <value>com.jeecg.*</value>
    <value>net.xhw.*</value>
</list>
</property>

六、菜单配置及结果

JEECG开发第一个菜单显示设备列表的更多相关文章

  1. wxPython制作跑monkey工具(python3)-带显示设备列表界面

    一. wxPython制作跑monkey工具(python3)-带显示设备列表界面  源代码 Run Monkey.py #!/usr/bin/env python import wx import ...

  2. 解决Genymotion无法创建新设备或无法显示设备列表问题

    准备工作: 链接: https://pan.baidu.com/s/1i5v4IBN 密码: jc3m 用2.8的和最新VirtualBox-5.1.10-112026-Win 注意事项: 1.笔记本 ...

  3. Winform开发主界面菜单的动态树形列表展示

    我在之前很多文章里面,介绍过Winform主界面的开发,基本上都是标准的界面,在顶部放置工具栏,中间区域则放置多文档的内容,但是在顶部菜单比较多的时候,就需要把菜单分为几级处理,如可以在顶部菜单放置一 ...

  4. (android 地图实战开发)2 创建MapActivity,根据设备当前位置,显示地图

    (android 地图实战开发)2 创建MapActivity,根据设备当前位置,显示地图 http://www.cnblogs.com/macroxu-1982/archive/2011/09/13 ...

  5. odoo开发笔记--一个模块显示两个一级菜单

    场景描述: 在已启动开发的模块中,odoo顶部一级菜单只有一个“会员管理”,需求是:在同一级顶部菜单,增加新菜单“产品管理”.举例如图:       处理方式: 按照odoo的机制,实现这种效果,可以 ...

  6. dedecms 列表 用分页标签 判断 当第一页则显示,第二页以上不显示 土办法!

    arc.listview.class.php function GetPageListST($list_len,$listitem="index,end,pre,next,pageno,sp ...

  7. XE7 & IOS开发之开发账号(1):开发证书、AppID、设备、开发授权profile的申请使用,附Debug真机调试演示(XCode所有版本通用,有图有真相)

    网上能找到的关于Delphi XE系列的移动开发的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 注意,以下讨论都是以&q ...

  8. 【React Native开发】React Native应用设备执行(Running)以及调试(Debugging)(3)

    ),React Native技术交流4群(458982758),请不要反复加群.欢迎各位大牛,React Native技术爱好者加入交流!同一时候博客左側欢迎微信扫描关注订阅号,移动技术干货,精彩文章 ...

  9. HoloLens开发手记 - 使用Windows设备控制台 Using Windows Device Portal

    Windows设备控制台允许你通过Wi-Fi或USB来远程控制你的HoloLens设备.设备控制台是HoloLens上的一个Web Server,你可以通过PC的浏览器来连接到它.设备控制台包含了很多 ...

随机推荐

  1. java mail发送html格式的邮件

    // 获取系统属性 Properties properties = System.getProperties(); // 设置邮件服务器 properties.setProperty("ma ...

  2. Docker镜像加速-配置阿里云镜像仓库

    Docker默认远程仓库是https://hub.docker.com/ 比如我们下载一个大点的东西,龟速 由于是国外主机,类似Maven仓库,慢得一腿,经常延迟,破损: 所以我们一般都是配置国内镜像 ...

  3. Python标准库之时间模块time与datatime模块详解

    时间模块time与datatime 时间表示方式: 时间戳 格式化时间字符串 元组 时间戳格式: time.time()#输出1581664531.749063 元组格式: time.localtim ...

  4. JS代码的位置

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. git add 时忽略某些文件或者文件夹

    1.git bash 新建  .gitignore文件 touch .gitignore 2.修改.gitignore文件,如下 target/ !.mvn/wrapper/maven-wrapper ...

  6. PLSQL官网下载地址

    记录一下 https://www.allroundautomations.com/registered/plsqldev.html

  7. B - 青蛙的约会

    两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面. 它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止. 可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方 ...

  8. SP1716 GSS3 - Can you answer these queries III - 动态dp,线段树

    GSS3 Description 动态维护最大子段和,支持单点修改. Solution 设 \(f[i]\) 表示以 \(i\) 为结尾的最大子段和, \(g[i]\) 表示 \(1 \sim i\) ...

  9. java基础异常处理

    异常的定义:中断了正常指令流的事件. try..catch..finally结构: class Test{ public static void main(String[] args){ System ...

  10. 面试题:HashSet、TreeSet 和HashMap 的实现与原理

    说下 TreeSet 和 HashSet 什么区别呢? 它们的区别点主要在他们的底层数据结构不同,HashSet 使用的是 HashMap 来实现,而 TreeSet 使用的是 TreeMap 来实现 ...