Explorar o código

xml中数据库名称调整
导入原因类型,重复多次导入,执行替换原因类型

yue %!s(int64=5) %!d(string=hai) anos
pai
achega
abb81829e6

+ 26 - 26
src/main/java/com/jeeplus/modules/sg/information/mapper/xml/InformationMapper.xml

@@ -56,11 +56,11 @@
 		a.overdue
 	</sql>
     <select id="findAllInformationList" resultType="com.jeeplus.modules.sg.information.entity.Information">
-		select project_id,project_name from project_information
+		select project_id,project_name from sj_project_information
 	</select>
 
     <insert id="insert">
-		INSERT INTO project_information(
+		INSERT INTO sj_project_information(
 			id,
 			project_id,
 			project_name,
@@ -137,7 +137,7 @@
 
 
 	<insert id="insertInfor">
-	INSERT INTO project_information(
+	INSERT INTO sj_project_information(
 		id,
 		project_id,
 		project_name,
@@ -212,13 +212,13 @@
 	</insert>
 
     <update id="updateInformationDate" parameterType="com.jeeplus.modules.sg.information.entity.Information">
-		update project_information set
+		update sj_project_information set
 		approvalDate = #{approvalDate}
 		where project_Id = #{projectId} and project_Name = #{projectName}
 	</update>
 	
 	<update id="updateDate">
-		update project_information set firstFinishDate = CURDATE(),firstFinish = '是'
+		update sj_project_information set firstFinishDate = CURDATE(),firstFinish = '是'
 		where project_Id in(
 		<foreach collection="list" item="item" separator=",">
 			#{item.projectId}
@@ -228,15 +228,15 @@
 	</update>
 
     <select id="findInformationByID" resultType="com.jeeplus.modules.sg.information.entity.Information">
-		select * from project_information where project_Id = #{projectId} and project_Name = #{projectName}
+		select * from sj_project_information where project_Id = #{projectId} and project_Name = #{projectName}
 	</select>
 
     <select id="findList" resultType="Information">
         SELECT
 		<include refid="newInformationColumns"/>,b.trial,b.construction,b.outConstruction,b.settlement,b.underCentralized,
 		datediff(if(firstFinish='否' or secondFinish = '否',NOW(),if(secondFinish = '是',secondFinishDate,firstFinishDate)),approvalDate) as newdate
-        FROM project_information as a
-		left JOIN project_append as b on a.project_id = b.project_id
+        FROM sj_project_information as a
+		left JOIN sj_project_append as b on a.project_id = b.project_id
         <where>
 			1=1
             <if test="projectName != null and projectName != ''">
@@ -310,7 +310,7 @@
     <select id="findAllList" resultType="Information">
         SELECT
         <include refid="informationColumns"/>
-        FROM project_information a
+        FROM sj_project_information a
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
                 ORDER BY ${page.orderBy}
@@ -322,7 +322,7 @@
     </select>
 
     <insert id="saveInfo" parameterType="java.util.List">
-		replace into  project_information(
+		replace into  sj_project_information(
 		id,
 		project_id,
 		project_name,
@@ -387,7 +387,7 @@
 	<select id="findListBy" resultType="com.jeeplus.modules.sg.information.entity.Information">
 			select
 			<include refid="informationColumns"/>
-			from project_information
+			from sj_project_information
 			where project_Id in
 			<foreach collection="list" item="information" index="index" open="(" separator="," close=")">
 				#{information.projectId}
@@ -396,7 +396,7 @@
 				<if test="information.projectName != null and information.projectName !='' ">
 				or
 				project_Name in (
-				SELECT project_Name from project_information where
+				SELECT project_Name from sj_project_information where
 				<foreach collection="list" item="information" index="index" separator="or" >
 					<if test="information.projectName != null and information.projectName !='' ">
 					project_Name LIKE concat('%',#{information.projectName},'%')
@@ -408,11 +408,11 @@
 	</select>
 
 	<select id="findListById" resultType="com.jeeplus.modules.sg.information.entity.Information">
-		select project_id,project_name,firstFinish,firstFinishDate,secondFinish,secondFinishDate from project_information where project_Id=#{projectId}
+		select project_id,project_name,firstFinish,firstFinishDate,secondFinish,secondFinishDate from sj_project_information where project_Id=#{projectId}
 	</select>
 
 	<insert id="updateAppend">
-		replace into project_append(
+		replace into sj_project_append(
 			project_id,
 			trial,
 			construction,
@@ -435,7 +435,7 @@
 
 	<select id="allNoBack" resultType="com.jeeplus.modules.sg.material.entity.Material">
 		select *
-		from material_information
+		from sj_material_information
 		where project_Id in(
 		<foreach collection="list" item="item" index="index" separator=",">
 			#{item.projectId}
@@ -445,7 +445,7 @@
 
 	<select id="allNo" resultType="com.jeeplus.modules.sg.material.entity.Material">
 		select *
-		from material_information
+		from sj_material_information
 		where project_Id in(
 		<foreach collection="list" item="items" index="index"  separator=",">
 			#{items.projectId}
@@ -456,8 +456,8 @@
 	<select id="exportInfor" resultType="com.jeeplus.modules.sg.information.entity.Information">
 		SELECT
 		a.*,b.trial,b.construction,b.outConstruction,b.settlement
-		FROM project_information as a
-		left JOIN project_append as b on a.project_id = b.project_id
+		FROM sj_project_information as a
+		left JOIN sj_project_append as b on a.project_id = b.project_id
 		where a.project_Id in(
 		    <foreach collection="list" item="items" index="index" separator=",">
 				#{items.projectId}
@@ -468,8 +468,8 @@
 	<select id="export" resultType="com.jeeplus.modules.sg.information.entity.Information">
 		SELECT
 		a.*,b.trial,b.construction,b.outConstruction,b.settlement,b.underCentralized
-		FROM project_information as a
-		left JOIN project_append as b on a.project_id = b.project_id
+		FROM sj_project_information as a
+		left JOIN sj_project_append as b on a.project_id = b.project_id
 		where 1=1
 		<foreach collection="list" item="items" index="index">
 			<if test="items.projectId != null and items.projectId != ''">
@@ -498,7 +498,7 @@
 	<select id="findIdByList" resultType="com.jeeplus.modules.sg.information.entity.Information">
 		SELECT
 		a.project_Id
-		FROM project_information as a
+		FROM sj_project_information as a
 		<where>
 			1=1
 			<foreach collection="list" item="items" index="index">
@@ -526,11 +526,11 @@
 	</select>
 
 	<select id="findOverTime" resultType="string">
-		select overTime from project_constant where overType = #{overType} ;
+		select overTime from sj_project_constant where overType = #{overType} ;
 	</select>
 
 	<update id="updateConstant" parameterType="com.jeeplus.modules.sg.information.entity.constant">
-		update project_constant set overTime = #{overTime} where overType = 'overTime';
+		update sj_project_constant set overTime = #{overTime} where overType = 'overTime';
 	</update>
 
 
@@ -538,13 +538,13 @@
 		SELECT
 		<include refid="newInformationColumns"/>,b.trial,b.construction,b.outConstruction,b.settlement,b.underCentralized,
 		datediff(if(firstFinish='否' or secondFinish = '否',NOW(),if(secondFinish = '是',secondFinishDate,firstFinishDate)),approvalDate) as newdate
-		FROM project_information as a
-		left JOIN project_append as b on a.project_id = b.project_id
+		FROM sj_project_information as a
+		left JOIN sj_project_append as b on a.project_id = b.project_id
 		<where>
 			1=1
 			and a.project_Id in (
 				select project_Id
-				from material_information
+				from sj_material_information
 				where (status is not null
 				or status != '') group by project_id
 			)

+ 36 - 1
src/main/java/com/jeeplus/modules/sg/information/utils/ImportInformation.java

@@ -482,7 +482,7 @@ public  class ImportInformation {
                     for (Material maInfor:isBack) {
                         Information upInfor = new Information();
                         Information needInfor = materialService.findNeedInfor(maInfor);
-                        if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || needInfor.getFirstFinish().equals("否")) {
+                        if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
                             upInfor.setProjectId(needInfor.getProjectId());
                             upInfor.setFirstFinish("是");
                             upInfor.setFirstFinishDate(new Date());
@@ -497,6 +497,23 @@ public  class ImportInformation {
                 }
                 if (noChange.size() == 1000) {
                     materialService.updateStatus(noChange);
+                    List<Material> isBack = materialService.findIsBack(materialList);
+                    for (Material maInfor:isBack) {
+                        Information upInfor = new Information();
+                        Information needInfor = materialService.findNeedInfor(maInfor);
+                        if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
+                            upInfor.setProjectId(needInfor.getProjectId());
+                            upInfor.setFirstFinish("是");
+                            upInfor.setFirstFinishDate(new Date());
+                        } else if (("否").equals(needInfor.getSecondFinish())) {
+                            upInfor.setProjectId(needInfor.getProjectId());
+                            upInfor.setSecondFinish("是");
+                            upInfor.setSecondFinishDate(new Date());
+                        } else {
+                            continue;
+                        }
+                        materialService.updateNeed(upInfor);
+                    }
                     noChange.clear();
                 }
             } catch (Exception e) {
@@ -522,9 +539,27 @@ public  class ImportInformation {
                     //根据项目定义号,更新项目是否完成领退料的状态
                     materialService.updateNeed(upInfor);
                 }
+                materialList.clear();
             }
             if (noChange.size() != 0) {
                 materialService.updateStatus(noChange);
+                List<Material> isBack = materialService.findIsBack(materialList);
+                for (Material maInfor:isBack) {
+                    Information upInfor = new Information();
+                    Information needInfor = materialService.findNeedInfor(maInfor);
+                    if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
+                        upInfor.setProjectId(needInfor.getProjectId());
+                        upInfor.setFirstFinish("是");
+                        upInfor.setFirstFinishDate(new Date());
+                    } else if (("否").equals(needInfor.getSecondFinish())) {
+                        upInfor.setProjectId(needInfor.getProjectId());
+                        upInfor.setSecondFinish("是");
+                        upInfor.setSecondFinishDate(new Date());
+                    } else {
+                        continue;
+                    }
+                    materialService.updateNeed(upInfor);
+                }
                 noChange.clear();
             }
 

+ 3 - 0
src/main/java/com/jeeplus/modules/sg/information/web/InformationController.java

@@ -256,6 +256,9 @@ public class InformationController extends BaseController {
     }
 
 
+    /**
+     * 导入送审
+     * */
     @RequiresPermissions("modules:sg:information:information:importTrial")
     @ResponseBody
     @RequestMapping(value = "importInTrial")

+ 20 - 20
src/main/java/com/jeeplus/modules/sg/material/mapper/xml/MaterialMapper.xml

@@ -27,17 +27,17 @@
     <select id="findByMaterialId" resultType="com.jeeplus.modules.sg.material.entity.Material">
         SELECT
         <include refid="materialColumns"/>
-        FROM material_information
+        FROM sj_material_information
         where project_Id = #{projectId} and infor_id = #{inforId} and material_name = #{materialName}
     </select>
 
     <update id="updateInfo" parameterType="com.jeeplus.modules.sg.material.entity.Material">
-		update material_information set status = #{status},info = #{info},isback = "是",isBackNo=0,afterNumber=#{afterNumber},afterAuthor=#{afterAuthor} where id = #{id};
+		update sj_material_information set status = #{status},info = #{info},isback = "是",isBackNo=0,afterNumber=#{afterNumber},afterAuthor=#{afterAuthor} where id = #{id};
 	</update>
     <select id="findList" resultType="Material">
         SELECT
         <include refid="materialColumns"/>
-        FROM material_information
+        FROM sj_material_information
         <where>
             1 = 1
             <if test="projectId != null and projectId != ''">
@@ -60,7 +60,7 @@
     <select id="findAllList" resultType="Material">
         SELECT
         <include refid="materialColumns"/>
-        FROM material_information
+        FROM sj_material_information
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
                 ORDER BY ${page.orderBy}
@@ -71,10 +71,10 @@
         </choose>
     </select>
     <select id="get" resultType="Material">
-		select id,status,info from material_information where id = #{id}
+		select id,status,info from sj_material_information where id = #{id}
 	</select>
     <select id="projectNeed" resultType="com.jeeplus.modules.sg.material.entity.Material">
-        select project_id  from material_information where project_id
+        select project_id  from sj_material_information where project_id
         in(
             <foreach collection="list" index="index" item="material" separator=",">
                 #{material.projectId}
@@ -84,7 +84,7 @@
     </select>
     
     <insert id="saveMater">
-        replace into material_information(
+        replace into sj_material_information(
         id,
         project_id,
         infor_id,
@@ -143,7 +143,7 @@
     </insert>
 
     <insert id="insert">
-		INSERT INTO material_information(
+		INSERT INTO sj_material_information(
 			id,
 			project_id,
 			infor_id,
@@ -217,13 +217,13 @@
 <select id="findByProIn" resultType="com.jeeplus.modules.sg.material.entity.Material">
         SELECT
         <include refid="materialColumns"/>
-        FROM material_information
+        FROM sj_material_information
         where project_Id = #{projectId} and infor_id = #{inforId}
     </select>
 
     <select id="findInformation"  resultType="com.jeeplus.modules.sg.material.entity.Material">
         select project_id,SUM(isBackNo) as isBackNo
-        from material_information
+        from sj_material_information
         where project_id
         in (
         <foreach collection="list" item="item" index="index" separator=",">
@@ -234,11 +234,11 @@
     </select>
 
     <select id="findNeedInfor" resultType="com.jeeplus.modules.sg.information.entity.Information">
-        select * from project_information where project_id = #{projectId}
+        select * from sj_project_information where project_id = #{projectId}
     </select>
 
     <update id="updateNeed" parameterType="com.jeeplus.modules.sg.information.entity.Information">
-        update project_information
+        update sj_project_information
         <trim prefix="set" suffixOverrides=",">
                 secondFinishDate=#{secondFinishDate},
             <if test="firstFinish!=null and firstFinish != ''">
@@ -256,7 +256,7 @@
 
     <update id="updateStatus" parameterType="com.jeeplus.modules.sg.material.entity.Material">
         <foreach collection="list" item="item" index="index" separator=";">
-        update material_information
+        update sj_material_information
             <trim prefix="set" suffixOverrides=",">
                 <if test="item.isBackNo!=null">
                      isBackNo=0,
@@ -282,7 +282,7 @@
     </update>
 
     <select id="findIsBack" resultType="com.jeeplus.modules.sg.material.entity.Material">
-        SELECT project_id from material_information where project_id in(
+        SELECT project_id from sj_material_information where project_id in(
         <foreach collection="list" item="item" separator=",">
             #{item.projectId}
         </foreach>
@@ -291,7 +291,7 @@
     </select>
     
     <select id="findProId" resultType="com.jeeplus.modules.sg.material.entity.Material">
-        SELECT project_id from material_information where (status is not null or status != '')
+        SELECT project_id from sj_material_information where (status is not null or status != '')
          and project_id in(
          <foreach collection="list" item="item" separator=",">
              #{item.projectId}
@@ -301,7 +301,7 @@
     </select>
     
     <select id="proIdName" resultType="com.jeeplus.modules.sg.information.entity.Information">
-        select project_id,project_name from project_information where project_id in
+        select project_id,project_name from sj_project_information where project_id in
         (
             <foreach collection="list" item="item" separator=",">
                 #{item.projectId}
@@ -311,7 +311,7 @@
     
     <select id="findMateial" resultType="com.jeeplus.modules.sg.material.entity.Material">
         select infor_id,material_name,outbound_number,authorized_number,status,afterNumber,afterAuthor
-        from material_information
+        from sj_material_information
         where (status is not null
         or status != '')
         and project_id=#{projectId}
@@ -319,14 +319,14 @@
     
     
     <select id="findStatus" resultType="com.jeeplus.modules.sg.material.entity.Material">
-        select * from material_information where status is not null
+        select * from sj_material_information where status is not null
     </select>
 
     <select id="findNeedBack" resultType="string">
-        select isBack from material_information where id = #{id};
+        select isBack from sj_material_information where id = #{id};
     </select>
 
     <select id="idFormId" resultType="com.jeeplus.modules.sg.material.entity.Material">
-        select * from material_information where id =#{id};
+        select * from sj_material_information where id =#{id};
     </select>
 </mapper>

+ 4 - 4
src/main/java/com/jeeplus/modules/sg/record/mapper/xml/RecordMapper.xml

@@ -13,14 +13,14 @@
 	<select id="get" resultType="Record" >
 		SELECT
 		<include refid="recordColumns"/>
-		FROM project_record a
+		FROM sj_project_record a
 		WHERE a.id = #{id}
 	</select>
 
 	<select id="findList" resultType="Record" >
 		SELECT
 		<include refid="recordColumns"/>
-		FROM project_record a
+		FROM sj_project_record a
 <!--		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -53,7 +53,7 @@
 	<select id="findAllList" resultType="Record" >
 		SELECT
 		<include refid="recordColumns"/>
-		FROM project_record a
+		FROM sj_project_record a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -69,7 +69,7 @@
 	</select>
 
 	<insert id="insert">
-		insert into project_record (
+		insert into sj_project_record (
 			id,
 			information,
 			material,

+ 4 - 4
src/main/java/com/jeeplus/modules/sg/report/mapper/xml/ReportMapper.xml

@@ -10,7 +10,7 @@
 	    (SELECT department,
 	            if(firstFinish='否' or secondFinish = '否',0,1) as st1,
 	            if(firstFinish='否' or secondFinish = '否',1,0) as st2
-	            from project_information) a
+	            from sj_project_information) a
 	    GROUP BY department
 	</select>
 
@@ -31,7 +31,7 @@
 		department,
 		if(firstFinish='否' or secondFinish = '否',NOW(),if(secondFinish = '是',secondFinishDate,firstFinishDate) )as da ,
 		approvalDate ,if(firstFinish='否' or secondFinish = '否','0','1') as status
-		from project_information) a
+		from sj_project_information) a
 		<where>
 			<if test="status != null and status != ''">
 				a.status = #{status} and
@@ -51,7 +51,7 @@
 	    (SELECT if(t2.underCentralized is null,'未知部门',t2.underCentralized) as underCentralized,
 	            if(t1.firstFinish='否' or t1.secondFinish = '否',0,1) as st1,
 	            if(t1.firstFinish='否' or t1.secondFinish = '否',1,0) as st2
-	            from project_information t1 left join project_append t2 on t1.project_id = t2.project_id) a
+	            from sj_project_information t1 left join sj_project_append t2 on t1.project_id = t2.project_id) a
 	    GROUP BY a.underCentralized
 	</select>
 
@@ -72,7 +72,7 @@
 		if(t2.underCentralized is null,'未知部门',t2.underCentralized) as underCentralized,
 		if(t1.firstFinish='否' or t1.secondFinish = '否',NOW(),if(t1.secondFinish = '是',t1.secondFinishDate,t1.firstFinishDate) )as da ,
 		t1.approvalDate ,if(t1.firstFinish='否' or t1.secondFinish = '否','0','1') as status
-		from project_information t1 left join project_append t2 on t1.project_id = t2.project_id) a
+		from sj_project_information t1 left join sj_project_append t2 on t1.project_id = t2.project_id) a
 		<where>
 			<if test="status != null and status != ''">
 				a.status = #{status} and