Browse Source

利库平衡管理-提报人提报部门修改

wangqiang 2 years ago
parent
commit
81970d09c9

+ 8 - 2
src/main/java/com/jeeplus/modules/sg/balancedlibrary/materialReportDetails/service/MaterialReportDetailsService.java

@@ -17,6 +17,7 @@ import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.constant.Mat
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.LikuDetail;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.entity.MaterialReportDetails;
 import com.jeeplus.modules.sg.balancedlibrary.materialReportDetails.mapper.MaterialReportDetailsMapper;
+import com.jeeplus.modules.sg.balancedlibrary.reportPerson.entity.ReportPerson;
 import com.jeeplus.modules.sg.balancedlibrary.reportPerson.mapper.ReportPersonMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -415,8 +416,13 @@ public class MaterialReportDetailsService extends CrudService<MaterialReportDeta
             m.setReportPerson(m.getReportPerson());
             if (m.getReportDepartment().equals("")) {
                 //根据提报人找到提报部门
-                String department = personMapper.getDepartmentByPerson(m.getReportPerson());
-                m.setReportDepartment(department);
+                List<ReportPerson> departmentByPerson = personMapper.getDepartmentByPerson();
+                departmentByPerson.forEach(de->{
+                    if (de.getReportPerson().equals(m.getReportPerson())){
+                        m.setReportDepartment(de.getReportDepartment());
+                    }
+                });
+
             }else {
                 m.setReportDepartment(m.getReportDepartment());
             }

+ 15 - 1
src/main/java/com/jeeplus/modules/sg/balancedlibrary/reportPerson/entity/ReportPerson.java

@@ -1,6 +1,5 @@
 package com.jeeplus.modules.sg.balancedlibrary.reportPerson.entity;
 
-import com.jeeplus.common.utils.excel.annotation.ExcelField;
 import com.jeeplus.core.persistence.DataEntity;
 
 /**
@@ -18,6 +17,13 @@ public class ReportPerson extends DataEntity<ReportPerson> {
      */
     private String reportDepartment;
 
+    /**
+     * 提报部门id
+     */
+    private String reportDepartmentId;
+
+
+
     public String getReportPerson() {
         return reportPerson;
     }
@@ -33,4 +39,12 @@ public class ReportPerson extends DataEntity<ReportPerson> {
     public void setReportDepartment(String reportDepartment) {
         this.reportDepartment = reportDepartment;
     }
+
+    public String getReportDepartmentId() {
+        return reportDepartmentId;
+    }
+
+    public void setReportDepartmentId(String reportDepartmentId) {
+        this.reportDepartmentId = reportDepartmentId;
+    }
 }

+ 5 - 1
src/main/java/com/jeeplus/modules/sg/balancedlibrary/reportPerson/mapper/ReportPersonMapper.java

@@ -33,5 +33,9 @@ public interface ReportPersonMapper extends BaseMapper<ReportPerson> {
 
     List<ReportPerson> findDepartmentGroupByPerson();
 
-    String getDepartmentByPerson(String person);
+    /**
+     * 查出所有的 部门信息
+     * @return
+     */
+    List<ReportPerson> getDepartmentByPerson();
 }

+ 7 - 2
src/main/java/com/jeeplus/modules/sg/balancedlibrary/reportPerson/mapper/xml/ReportPersonMapper.xml

@@ -80,8 +80,13 @@
         on a.report_department = b.value
 
 	</select>
-    <select id="getDepartmentByPerson" resultType="java.lang.String">
-        SELECT report_department FROM bla_report_person WHERE report_person = #{person}
+    <select id="getDepartmentByPerson" resultType="com.jeeplus.modules.sg.balancedlibrary.reportPerson.entity.ReportPerson">
+        SELECT
+        label as reportDepartment,`value` as reportDepartmentId,e.report_person as reportPerson
+        FROM
+        sys_dict_value d
+        left JOIN	bla_report_person e on d.`value` = e.report_department
+        WHERE dict_type_id = ( SELECT id FROM sys_dict_type WHERE type = 'report_department' )
     </select>
 
     <insert id="insert">