对比新文件 |
| | |
| | | package com.nanometer.smartlab.controller; |
| | | |
| | | |
| | | import com.nanometer.smartlab.entity.SysWarehouse; |
| | | import com.nanometer.smartlab.entity.SysWarehouseStatus; |
| | | import com.nanometer.smartlab.service.SysWarehouseService; |
| | | import com.nanometer.smartlab.service.SysWarehouseStatusService; |
| | | import org.primefaces.model.LazyDataModel; |
| | | import org.primefaces.model.SortOrder; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | @Scope("session") |
| | | public class WarehouseStatusController extends BaseController{ |
| | | |
| | | |
| | | private LazyDataModel<SysWarehouseStatus> dataModel; |
| | | |
| | | @Resource |
| | | private SysWarehouseStatusService sysWarehouseStatusService; |
| | | |
| | | private String name; |
| | | private Date startTime; |
| | | private Date endTime; |
| | | |
| | | public LazyDataModel<SysWarehouseStatus> getDataModel() { |
| | | if (this.dataModel == null) { |
| | | this.dataModel = new LazyDataModel<SysWarehouseStatus>() { |
| | | @Override |
| | | public List<SysWarehouseStatus> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { |
| | | int count = sysWarehouseStatusService.getCount(name, startTime, endTime); |
| | | this.setRowCount(count); |
| | | return count != 0 ? sysWarehouseStatusService.selectList(name, startTime, endTime, first, pageSize) : new ArrayList<>(); |
| | | } |
| | | |
| | | @Override |
| | | public SysWarehouseStatus getRowData(String rowKey) { |
| | | return sysWarehouseStatusService.getById(rowKey); |
| | | } |
| | | }; |
| | | } |
| | | return dataModel; |
| | | } |
| | | |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.nanometer.smartlab.entity.SysWarehouse; |
| | | import com.nanometer.smartlab.entity.SysWarehouseStatus; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | public interface SysWarehouseStatusDao { |
| | | |
| | | int insertOne(SysWarehouseStatus one); |
| | | |
| | | int selectCount(@Param("params") Map<String, Object> params); |
| | | |
| | | List<SysWarehouseStatus> selectList(@Param("params") Map<String, Object> params); |
| | | |
| | | SysWarehouseStatus selectById(String id); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.nanometer.smartlab.dao.SysWarehouseStatusDao"> |
| | | <resultMap id="BaseMap" type="com.nanometer.smartlab.entity.SysWarehouseStatus"> |
| | | <id property="id" column="id"/> |
| | | <result property="name" column="name" /> |
| | | <result property="type" column="type"/> |
| | | <result property="temperature" column="temperature"/> |
| | | <result property="humidity" column="humidity"/> |
| | | <result property="creator" column="creator"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="validFlag" column="valid_flag"/> |
| | | <result property="warehouseId" column="warehouse_id"/> |
| | | <result property="warning" column="warning"/> |
| | | <result property="selectDate" column="select_date"/> |
| | | </resultMap> |
| | | |
| | | <insert id="insertOne" parameterType="com.nanometer.smartlab.entity.SysWarehouseStatus"> |
| | |
| | | values |
| | | (#{type},#{name},#{temperature},#{humidity},#{creator},#{createTime},1,#{warehouseId},#{selectDate},#{warning}) |
| | | </insert> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(0) |
| | | from sys_warehouse_status |
| | | <where> |
| | | <if test="params.name != null and params.name != ''"> |
| | | name = #{params.name} |
| | | </if> |
| | | <if test="params.startTime != null and params.startTime != ''"> |
| | | and select_date >= #{params.startTime} |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"> |
| | | and select_date <= #{params.endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectList" resultMap="BaseMap"> |
| | | select * |
| | | from sys_warehouse_status |
| | | <where> |
| | | <if test="params.name != null and params.name != ''"> |
| | | and name = #{params.name} |
| | | </if> |
| | | <if test="params.startTime != null and params.startTime != ''"> |
| | | and select_date >= #{params.startTime} |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"> |
| | | and select_date <= #{params.endTime} |
| | | </if> |
| | | </where> |
| | | <if test="params.first != null and params.pageSize != null"> |
| | | limit #{params.first},#{params.pageSize} |
| | | </if> |
| | | </select> |
| | | <select id="selectById" resultType="com.nanometer.smartlab.entity.SysWarehouseStatus"> |
| | | select * |
| | | from sys_warehouse_status |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.nanometer.smartlab.service; |
| | | |
| | | import com.nanometer.smartlab.entity.SysWarehouse; |
| | | import com.nanometer.smartlab.entity.SysWarehouseStatus; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface SysWarehouseStatusService { |
| | | |
| | | void addOne(SysWarehouseStatus one); |
| | | |
| | | int getCount(String name, Date startTime, Date endTime); |
| | | |
| | | List<SysWarehouseStatus> selectList(String name, Date startTime, Date endTime, int first, int pageSize); |
| | | |
| | | SysWarehouseStatus getById(String rowKey); |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Service("sysWarehouseStatusService") |
| | | public class SysWarehouseStatusServiceImpl implements SysWarehouseStatusService { |
| | | |
| | | @Resource |
| | |
| | | one.setWarning(warningSb.toString()); |
| | | sysWarehouseStatusDao.insertOne(one); |
| | | } |
| | | |
| | | @Override |
| | | public int getCount(String name, Date startTime, Date endTime) { |
| | | Map<String,Object> params = new HashMap<>(); |
| | | params.put("name", name); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | return sysWarehouseStatusDao.selectCount(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysWarehouseStatus> selectList(String name, Date startTime, Date endTime, int first, int pageSize) { |
| | | Map<String,Object> params = new HashMap<>(); |
| | | params.put("name", name); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | params.put("first", first); |
| | | params.put("pageSize", pageSize); |
| | | return sysWarehouseStatusDao.selectList(params); |
| | | } |
| | | |
| | | @Override |
| | | public SysWarehouseStatus getById(String rowKey) { |
| | | return sysWarehouseStatusDao.selectById(rowKey); |
| | | } |
| | | } |
| | |
| | | <property name="privilegeCode" value="container_status_mng"></property> |
| | | <property name="initMethod" value="initPage"></property> |
| | | </bean> |
| | | |
| | | <bean class="com.nanometer.smartlab.model.MenuModel"> |
| | | <property name="id" value="warehouse_status_mng"></property> |
| | | <property name="title" value="库房状态管理"></property> |
| | | <property name="page" value="warehouse_status_mng"></property> |
| | | <property name="privilegeCode" value="warehouse_status_mng"></property> |
| | | <property name="initMethod" value="initPage"></property> |
| | | </bean> |
| | | <bean class="com.nanometer.smartlab.model.MenuModel"> |
| | | <property name="id" value="laboratory_store"></property> |
| | | <property name="dispInMenuList" value="false"></property> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE html |
| | | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| | | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| | | |
| | | <html xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" |
| | | xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" |
| | | xmlns:c="http://java.sun.com/jsp/jstl/core"> |
| | | <ui:composition> |
| | | <h:form id="warehouseStatusMngForm"> |
| | | <p:panel styleClass="center-header"> |
| | | <p:outputLabel styleClass="title" value="仓库状态管理"/> |
| | | <p:panelGrid styleClass="filter" columns="7"> |
| | | |
| | | <p:outputLabel value="仓库名:"/> |
| | | <p:selectOneMenu value="#{warehouseStatusController.name}"> |
| | | <f:selectItem itemLabel="全部" itemValue="#{null}" noSelectionOption="true"/> |
| | | <f:selectItems value="#{sysWarehouseService.getSysWarehouseList(null,null,null,null)}" |
| | | var="item" itemLabel="#{item.name}" itemValue="#{item.name}"/> |
| | | </p:selectOneMenu> |
| | | |
| | | <p:outputLabel for="startTime" value="开始时间:" /> |
| | | <p:calendar id="startTime" value="#{warehouseStatusController.startTime}" |
| | | pattern="yyyy-MM-dd HH:mm:ss" locale="zh_CN"/> |
| | | |
| | | <p:outputLabel for="endTime" value="结束时间:" /> |
| | | <p:calendar id="endTime" value="#{warehouseStatusController.endTime}" |
| | | pattern="yyyy-MM-dd HH:mm:ss" locale="zh_CN"/> |
| | | |
| | | <p:commandLink styleClass="search" process="@form" update="@form"/> |
| | | </p:panelGrid> |
| | | </p:panel> |
| | | <style type="text/css"> |
| | | .warning{color:red} |
| | | </style> |
| | | <p:panel styleClass="center-body"> |
| | | |
| | | <p:dataTable id="warehouseStatusMngDataTable" styleClass="data-table" |
| | | paginator="true" paginatorAlwaysVisible="false" paginatorPosition="bottom" |
| | | lazy="true" value="#{warehouseStatusController.dataModel}" var="row" |
| | | rowKey="#{row.id}" emptyMessage="无数据" |
| | | rows="20" pageLinks="5"> |
| | | |
| | | |
| | | <p:column headerText="仓库类型" style="text-align: center;" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText value="#{row.type}"/> |
| | | </p:column> |
| | | |
| | | <p:column headerText="仓库名" style="text-align: center" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText value="#{row.name}" /> |
| | | </p:column> |
| | | |
| | | <p:column headerText="温度" style="text-align: center" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText |
| | | value="#{row.temperature}" /> |
| | | </p:column> |
| | | |
| | | <p:column headerText="湿度" style="text-align: center" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText |
| | | value="#{row.humidity}"/> |
| | | </p:column> |
| | | |
| | | <p:column headerText="提交人" style="text-align: center" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText |
| | | value="#{row.creator}"/> |
| | | </p:column> |
| | | |
| | | <p:column headerText="日期" style="text-align: center" styleClass="#{row.warning == null?'warning':''}"> |
| | | <h:outputText |
| | | value="#{row.selectDate}"> |
| | | <f:convertDateTime pattern="yyyy-M-d HH:mm:ss" /></h:outputText> |
| | | </p:column> |
| | | |
| | | |
| | | |
| | | |
| | | </p:dataTable> |
| | | </p:panel> |
| | | </h:form> |
| | | </ui:composition> |
| | | </html> |