gdg
2021-01-11 2b3cbd3f1275cd997202f05d31211ca3ed42e493
模块:实验室临时存储库管理
修改:多选课题组
提出:秦老师
已修改4个文件
64 ■■■■■ 文件已修改
src/main/java/com/nanometer/smartlab/controller/LaboratoryContainerMngController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/entity/SysLaboratoryContainer.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/laboratory_container_mng.xhtml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/controller/LaboratoryContainerMngController.java
@@ -138,10 +138,6 @@
    public void onSaveBtnClick() {
        try {
            if (!StringUtils.isNotBlank(sysLaboratoryContainer.getProjectId())){
                sysLaboratoryContainer.setProjectId(null);
            }
            // 新建
            if (this.action == Constants.ACTION_ADD) {
                if (this.sysLaboratoryContainer == null) {
@@ -215,6 +211,9 @@
                    return;
                }
                sysLaboratoryContainer.setProject(null);
                sysLaboratoryContainer.getProject();
                this.sysLaboratoryContainerService.updateSysLaboratoryContainer(sysLaboratoryContainer);
                FacesUtils.info("修改成功。");
src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml
@@ -30,7 +30,7 @@
  </select>
  <select id="getSysLaboratoryContainer" parameterType="java.lang.String"  resultMap="SysLaboratoryContainer" >
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project_id projectId from sys_laboratory_container as su
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project project from sys_laboratory_container as su
    left join sys_laboratory as ss on su.laboratory_id = ss.id
    where su.id = #{id} and su.valid_flag = 1
  </select>
@@ -52,7 +52,7 @@
  </select>
  <select id="getSysLaboratoryContainerList" parameterType="java.util.Map" resultMap="SysLaboratoryContainer">
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName,su.project_id as projectId  from sys_laboratory_container as su
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName,su.project as project  from sys_laboratory_container as su
    left join sys_laboratory as ss on su.laboratory_id = ss.id
    left join sys_controller sc on sc.controller_code=su.controller_code
    where su.valid_flag = 1
@@ -130,14 +130,14 @@
  </select>
  <insert id="insertSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer">
    insert into sys_laboratory_container(id, laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code,project_id)
    values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{projectId})
    insert into sys_laboratory_container(id, laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code,project)
    values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{project})
  </insert>
  <update id="updateSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer">
    update sys_laboratory_container set laboratory_id=#{laboratoryId}, type=#{type}, container_code=#{containerCode}, info_code=#{infoCode},
    structure=#{structure}, name=#{name}, character_left=#{characterLeft}, character_right=#{characterRight},controller_code=#{controllerCode},
    update_time=now(),project_id = #{projectId}
    update_time=now(),project = #{project}
    where id=#{id}
  </update>
src/main/java/com/nanometer/smartlab/entity/SysLaboratoryContainer.java
@@ -4,6 +4,7 @@
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.*;
/**
 * Created by johnny on 17/11/23.
@@ -27,8 +28,8 @@
    private String characterRight;
    private String controllerCode;
    private String controllerName;
    private String projectId;
    private List<String> projects;
    private String project;
    public String getControllerName() {
        return controllerName;
    }
@@ -157,11 +158,32 @@
        this.controllerCode = controllerCode;
    }
    public String getProjectId() {
        return projectId;
    public List<String> getProjects() {
        if (projects == null && project != null){
            this.projects = Arrays.asList(this.project.split(","));
        }
        return projects;
    }
    public void setProjectId(String projectId) {
        this.projectId = projectId;
    public void setProjects(List<String> projects) {
        this.projects = projects;
    }
    public String getProject() {
        if (this.project == null){
            this.project = "";
            if (projects != null && projects.size() > 0) {
                projects.forEach(pro->{
                    this.project += ",";
                    this.project += pro;
                });
                this.project = this.project.substring(1);
            }
        }
        return project;
    }
    public void setProject(String project) {
        this.project = project;
    }
}
src/main/webapp/laboratory_container_mng.xhtml
@@ -69,7 +69,7 @@
                </p:column>
                <p:column headerText="课题组">
                    <h:outputText value="#{sysProjectServiceImpl.getSysProject(row.projectId).project}"></h:outputText>
                    <h:outputText value="#{row.project}"></h:outputText>
                </p:column>
                <p:column headerText="主控名称">
@@ -182,12 +182,11 @@
                        var="item" itemLabel="#{item.metaValue}" itemValue="#{item.id}"></f:selectItems>
                </p:selectOneMenu>
                <p:outputLabel value="课题组"></p:outputLabel>
                <p:selectOneMenu value="#{laboratoryContainerMngController.sysLaboratoryContainer.projectId}">
                    <f:selectItem itemLabel="不选择课题组"  />
                    <f:selectItems value="#{sysProjectServiceImpl.getAll()}"
                                   var="item" itemLabel="#{item.project}" itemValue="#{item.id}"></f:selectItems>
                </p:selectOneMenu>
                <p:outputLabel value="课题组" for="multiple"/>
                <p:selectCheckboxMenu id="multiple" value="#{laboratoryContainerMngController.sysLaboratoryContainer.projects}" label="Cities" multiple="true"
                                      filter="true" filterMatchMode="startsWith" panelStyle="width:250px">
                    <f:selectItems value="#{sysProjectServiceImpl.getAll()}" var="item" itemValue="#{item.project}" itemLabel="#{item.project}"/>
                </p:selectCheckboxMenu>
            </p:panelGrid>
            <p:panel styleClass="btn">