蔡德晨 преди 5 години
родител
ревизия
9d5b329287

+ 9 - 0
src/main/java/com/jeeplus/modules/sg/project/entity/WbsProject.java

@@ -7,6 +7,7 @@ import java.util.List;
 public class WbsProject extends DataEntity<WbsProject> {
     private String projectName;//工程名称
     private int number;  //项目数量
+    private String userName; //创建人
     private String parentNode; //父节点
 
     private List<WbsItem> wbsItems; //项目
@@ -43,4 +44,12 @@ public class WbsProject extends DataEntity<WbsProject> {
     public void setParentNode(String parentNode) {
         this.parentNode = parentNode;
     }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/sg/project/entity/WbsSelection.java

@@ -14,8 +14,17 @@ public class WbsSelection {
     private String unit;        //施工单位
     private Date itemStartDate;   //项目登记开始时间
     private Date itemEndDate;     //项目登记结束时间
+    private String userId;   //用户ID
 
 
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
     public String getProjectId() {
         return projectId;
     }

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/project/mapper/ProjectMapper.java

@@ -10,5 +10,5 @@ import java.util.List;
 
 @MyBatisMapper
 public interface ProjectMapper extends BaseMapper<WbsProject> {
-    List<WbsProject> findList(WbsSelection wbsSelection);
+    List<WbsProject> getList(WbsSelection wbsSelection);
 }

+ 6 - 12
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ItemMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.jeeplus.modules.sg.item.entity.WbsItem">
+<mapper namespace="com.jeeplus.modules.sg.project.mapper.ItemMapper">
     
 	<sql id="infoColumns">
 		a.id AS "id",
@@ -31,8 +31,6 @@
 			<include refid="infoColumns"/>
 		FROM sg_wbs_item a
 		<where>
-			a.del_flag = #{DEL_FLAG_NORMAL}
-			${dataScope}
 			<if test="itemName != null and itemName != ''">
 				AND a.item_name = #{itemName}
 			</if>
@@ -48,15 +46,12 @@
 			<if test="itemEndDate != null and itemEndDate != ''">
 				AND a.create_date &lt;= #{itemEndDate}
 			</if>
+			<if test="projectId != null and projectId != ''">
+				AND a.project_id = #{projectId}
+			</if>
 		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.update_date DESC
-			</otherwise>
-		</choose>
+		 ORDER BY a.update_date DESC
+
 	</select>
 	
 	<select id="findAllList" resultType="WbsItem" >
@@ -65,7 +60,6 @@
 		FROM sg_wbs_item a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
-			${dataScope}
 		</where>		
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">

+ 10 - 17
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ProjectMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.jeeplus.modules.sg.project.entity.WbsProject">
+<mapper namespace="com.jeeplus.modules.sg.project.mapper.ProjectMapper">
     
 	<sql id="infoColumns">
 		a.id AS "id",
@@ -12,7 +12,8 @@
 		a.del_flag AS "delFlag",
 		a.project_name AS "projectName",
 		a.number AS "number",
-		a.parent_node AS "parentNode"
+		a.parent_node AS "parentNode",
+		b.name AS "userName"
 	</sql>
 
 	<select id="get" resultType="WbsProject" >
@@ -22,18 +23,16 @@
 		WHERE a.id = #{id}
 	</select>
 	
-	<select id="findList" resultType="WbsProject" parameterType="com.jeeplus.modules.sg.project.entity.WbsSelection" >
+	<select id="getList" resultType="WbsProject" parameterType="com.jeeplus.modules.sg.project.entity.WbsSelection" >
 		SELECT 
 			<include refid="infoColumns"/>
-		FROM sg_wbs_project a
+		FROM sg_wbs_project a   left join sys_user b on a.create_by = b.id
 		<where>
-			a.del_flag = #{DEL_FLAG_NORMAL}
-			${dataScope}
 			<if test="projectName != null and projectName != ''">
 				AND a.project_name = #{projectName}
 			</if>
-			<if test="updateBy.id != null  and updateBy.id != ''">
-				AND a.update_by= #{updateBy.id}
+			<if test="userId != null  and userId != ''">
+				AND a.update_by= #{userId}
 			</if>
 			<if test="projectStartDate != null and projectEndDate != ''">
 				AND a.create_date &gt;= #{projectStartDate}
@@ -42,14 +41,8 @@
 				AND a.create_date &lt;= #{projectEndDate}
 			</if>
 		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.update_date DESC
-			</otherwise>
-		</choose>
+		 ORDER BY a.update_date DESC
+
 	</select>
 	
 	<select id="findAllList" resultType="WbsProject" >
@@ -58,7 +51,7 @@
 		FROM sg_wbs_project a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
-			${dataScope}
+
 		</where>		
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">

+ 18 - 7
src/main/java/com/jeeplus/modules/sg/project/service/ProjectService.java

@@ -1,5 +1,6 @@
 package com.jeeplus.modules.sg.project.service;
 
+import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.core.service.CrudService;
 import com.jeeplus.modules.sg.project.entity.WbsItem;
 import com.jeeplus.modules.sg.project.entity.WbsProject;
@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Service
@@ -27,13 +29,22 @@ public class ProjectService extends CrudService<ProjectMapper, WbsProject> {
 
 
     public List<WbsProject> findList(WbsSelection wbsSelection) {
-        List<WbsProject> list =  projectMapper.findList(wbsSelection);
-        for(WbsProject wbsProject1 : list){
-            String id = wbsProject1.getId();
-            wbsSelection.setProjectId(id);
-            List<WbsItem> items = itemService.findList(wbsSelection);
-            wbsProject1.setWbsItems(items);
-        }
+        List<WbsProject> list =  projectMapper.getList(wbsSelection);
+            for(WbsProject wbsProject1 : list){
+                String id = wbsProject1.getId();
+                wbsSelection.setProjectId(id);
+                List<WbsItem> items = itemService.findList(wbsSelection);
+                wbsProject1.setWbsItems(items);
+            }
+         if(StringUtils.isNoneBlank(wbsSelection.getItemName()) || wbsSelection.getItemStartDate() != null || wbsSelection.getItemEndDate() != null || StringUtils.isNoneBlank(wbsSelection.getUnit()) || StringUtils.isNoneBlank(wbsSelection.getType())){
+             List<WbsProject> wbsProjects = new ArrayList<>();
+             for(WbsProject wbsProject : list){
+                 if(wbsProject.getWbsItems().size()>0){
+                     wbsProjects.add(wbsProject);
+                 }
+             }
+             return wbsProjects;
+         }
         return list;
     }
 

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -61,7 +61,7 @@ public class ProjectController extends BaseController {
         //新增或编辑表单保存
         projectService.save(wbsProject);//保存
         j.setSuccess(true);
-        j.setMsg("新建项目成功");
+        j.setMsg("新建工程成功");
         return j;
     }
 

+ 109 - 86
src/main/webapp/webpage/modules/sg/project/management.jsp

@@ -52,28 +52,28 @@
             <div class="layui-card">
                 <div class="layui-card-header">工程管理</div>
                 <div class="layui-card-body">
-                    <form class="layui-form" action="" style="margin-top: 10px;">
+                    <form class="layui-form" action="${ctx}/project/list" style="margin-top: 10px;" method="post">
                         <div class="layui-form-item">
                             <div class="layui-inline">
                                 <label class="layui-form-label">工程名称</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="hcmc" lay-verify="" autocomplete="off" class="layui-input">
+                                    <input type="text" name="projectName"  autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                             <div class="layui-inline">
                                 <label class="layui-form-label">登记人</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="person" lay-verify="" autocomplete="off" class="layui-input">
+                                    <input type="text" name="createBy"  autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                             <div class="layui-inline">
                                 <label class="layui-form-label">工程登记时间</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="beginName1" id="beginDate1" lay-verify="" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
+                                    <input type="text" name="projectStartDate" id="beginDate1"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                                 </div>
                                 <div class="layui-form-mid">-</div>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="endName1" id="endDate1" lay-verify="" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
+                                    <input type="text" name="projectEndDate" id="endDate1"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                         </div>
@@ -81,19 +81,19 @@
                             <div class="layui-inline">
                                 <label class="layui-form-label">项目名称</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="xmmc" lay-verify="" autocomplete="off" class="layui-input">
+                                    <input type="text" name="itemName"  autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                             <div class="layui-inline">
                                 <label class="layui-form-label">项目划分</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="xmhf" lay-verify="" autocomplete="off" class="layui-input">
+                                    <input type="text" name="type"  autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                             <div class="layui-inline">
                                 <label class="layui-form-label">施工单位</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="sgdw" lay-verify="" autocomplete="off" class="layui-input">
+                                    <input type="text" name="unit"  autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                         </div>
@@ -101,11 +101,11 @@
                             <div class="layui-inline">
                                 <label class="layui-form-label">项目登记时间</label>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="beginDate2" id="beginDate2" lay-verify="" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
+                                    <input type="text" name="itemStartDate" id="beginDate2"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                                 </div>
                                 <div class="layui-form-mid">-</div>
                                 <div class="layui-input-inline">
-                                    <input type="text" name="endDate2" id="endDate2" lay-verify="" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
+                                    <input type="text" name="itemEndDate" id="endDate2"  placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                                 </div>
                             </div>
                             <div class="layui-inline" style="margin-left: 300px;">
@@ -154,17 +154,17 @@
         });
 
         //监听提交
-        form.on('submit(mybtnsubmit)', function(data){
-            layer.alert(JSON.stringify(data.field), {
-                title: '最终的提交信息'
-            })
-            return false;
-        });
+        // form.on('submit(mybtnsubmit)', function(data){
+        //     layer.alert(JSON.stringify(data.field), {
+        //         title: '最终的提交信息'
+        //     })
+        //     return false;
+        // });
     });
 </script>
 <script>
     layui.config({
-        base: 'module/'
+        base: '${ctxp}/static/plugin/assets/'
     }).extend({
         treetable: 'treetable-lay/treetable'
     }).use(['layer', 'table', 'treetable'], function () {
@@ -208,12 +208,14 @@
                         }}
                 ]],
                 "data": [
+                    <c:if test="${ not empty list}">
+                    <c:forEach items="${list}" var="data" varStatus="index">
                     {
-                        "id": "1",
-                        "gcmc":"某线路工程",
-                        "xmsl": "3",
-                        "cjsq": "2018/8/14",
-                        "djr":"home",
+                        "id": "${data.id}",
+                        "gcmc":"${data.projectName}",
+                        "xmsl": "${data.number}",
+                        "cjsq": "<fmt:formatDate value="${data.createDate}" pattern="yyyy-MM-dd hh:mm:ss"/>",
+                        "djr":"${data.userName}",
                         "status":"1",
                         "pid": -1
                     },
@@ -224,71 +226,92 @@
                         "cjsq": "项目划分",
                         "djr":"创建时间",
                         "status":"2",
-                        "pid": 1
+                        "pid": "${data.id}"
                     },
+                    <%--<c:if test="${ not empty data.wbsItems}">--%>
+                    <%--<c:forEach items="${data.wbsItems}" var="items" varStatus="index">--%>
+                    <%--{--%>
+                    <%--"id": "${items.id}",--%>
+                    <%--"gcmc":"${items.itemName}",--%>
+                    <%--"xmsl": "某施工单位一",--%>
+                    <%--"cjsq": "架空线路",--%>
+                    <%--"djr":"<fmt:formatDate value="${items.updateDate}" pattern="yyyy-MM-dd hh:mm:ss"/>",--%>
+                    <%--"status":"3",--%>
+                    <%--"pid": "${items.projectId}"--%>
+                    <%--},--%>
+                    <%--</c:forEach>--%>
+                    <%--</c:if>--%>
+                    </c:forEach>
+                    </c:if>
+                    <c:forEach items="${list}" var="item" varStatus="index">
+                      <c:forEach items="${item.wbsItems}" var="items" varStatus="index">
                     {
-                        "id": "3",
-                        "gcmc":"某项目",
+                        "id": "${items.id}",
+                        "gcmc":"${items.itemName}",
                         "xmsl": "某施工单位一",
                         "cjsq": "架空线路",
-                        "djr":"2018/8/14",
+                        "djr":"<fmt:formatDate value="${items.updateDate}" pattern="yyyy-MM-dd hh:mm:ss"/>",
                         "status":"3",
-                        "pid": 2
-                    },
-                    {
-                        "id": "4",
-                        "gcmc":"某项目",
-                        "xmsl": "某施工单位一",
-                        "cjsq": "架空线路",
-                        "djr":"2018/8/14",
-                        "status":"3",
-                        "pid": 2
-                    },
-                    {
-                        "id": "5",
-                        "gcmc":"某项目",
-                        "xmsl": "某施工单位一",
-                        "cjsq": "架空线路",
-                        "djr":"2018/8/14",
-                        "status":"3",
-                        "pid": 2
-                    },
-                    {
-                        "id": "6",
-                        "gcmc":"某线路工程二",
-                        "xmsl": "1",
-                        "cjsq": "2018/8/15",
-                        "djr":"home1",
-                        "status":"1",
-                        "pid": -1
-                    },
-                    {
-                        "id": "7",
-                        "gcmc":"项目名称",
-                        "xmsl": "施工单位",
-                        "cjsq": "项目类型",
-                        "djr":"创建时间",
-                        "status":"2",
-                        "pid": 6
-                    },
-                    {
-                        "id": "8",
-                        "gcmc":"某项目",
-                        "xmsl": "某施工单位一",
-                        "cjsq": "架空线路",
-                        "djr":"2018/8/14",
-                        "status":"3",
-                        "pid": 7
-                    },
-                    {
-                        "id": "9",
-                        "gcmc":"某项目",
-                        "xmsl": "某施工单位一",
-                        "cjsq": "架空线路",
-                        "djr":"2018/8/14",
-                        "status":"3",
-                        "pid": 7
+                        "pid": "${items.projectId}"
                     },
+                    </c:forEach>
+                    </c:forEach>
+
+
+                    // {
+                    //     "id": "4",
+                    //     "gcmc":"某项目",
+                    //     "xmsl": "某施工单位一",
+                    //     "cjsq": "架空线路",
+                    //     "djr":"2018/8/14",
+                    //     "status":"3",
+                    //     "pid": 2
+                    // },
+                    // {
+                    //     "id": "5",
+                    //     "gcmc":"某项目",
+                    //     "xmsl": "某施工单位一",
+                    //     "cjsq": "架空线路",
+                    //     "djr":"2018/8/14",
+                    //     "status":"3",
+                    //     "pid": 2
+                    // },
+                    // {
+                    //     "id": "6",
+                    //     "gcmc":"某线路工程二",
+                    //     "xmsl": "1",
+                    //     "cjsq": "2018/8/15",
+                    //     "djr":"home1",
+                    //     "status":"1",
+                    //     "pid": -1
+                    // },
+                    // {
+                    //     "id": "7",
+                    //     "gcmc":"项目名称",
+                    //     "xmsl": "施工单位",
+                    //     "cjsq": "项目类型",
+                    //     "djr":"创建时间",
+                    //     "status":"2",
+                    //     "pid": 6
+                    // },
+                    // {
+                    //     "id": "8",
+                    //     "gcmc":"某项目",
+                    //     "xmsl": "某施工单位一",
+                    //     "cjsq": "架空线路",
+                    //     "djr":"2018/8/14",
+                    //     "status":"3",
+                    //     "pid": 7
+                    // },
+                    // {
+                    //     "id": "9",
+                    //     "gcmc":"某项目",
+                    //     "xmsl": "某施工单位一",
+                    //     "cjsq": "架空线路",
+                    //     "djr":"2018/8/14",
+                    //     "status":"3",
+                    //     "pid": 7
+                    // },
                 ],
 
                 done: function () {
@@ -321,16 +344,16 @@
             layer.close(index);
             $.ajax({
                 type: "post",
-                url: "#",
-                data:{name:text},
+                url: "${ctx}/project/save",
+                data:{projectName:text},
                 dataType: "json",
                 success: function(data){
-                    if(data.result!=null){
-                        layer.msg(data.result, {icon: 1});
+                    if(data.success){
+                        layer.msg(data.msg, {icon: 1});
                         window.location.reload();
                     }else{
                         layer.msg('添加失败', {icon: 1});
-                    }
+                    }
                 }
             });