Browse Source

Merge branch 'master' of https://git.coding.net/aft/AFT.git

Conflicts:
	src/main/java/com/goafanti/achievement/bo/AchievementUserOwnerDetailBo.java
	src/main/java/com/goafanti/achievement/service/AchievementService.java
	src/main/java/com/goafanti/demand/service/DemandService.java
	src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java
anderx 8 years ago
parent
commit
37fcf9a83a

+ 1 - 1
src/main/java/com/goafanti/achievement/bo/AchievementUserOwnerDetailBo.java

@@ -107,7 +107,7 @@ public class AchievementUserOwnerDetailBo extends AchievementOrgOwnerDetailBo {
 	}
 
 	public String getCountInterest() {
-		if (StringUtils.isBlank(CountInterest)) CountInterest = "20";
+		if (StringUtils.isBlank(CountInterest)) CountInterest = "20";
 		return String.valueOf(Integer.valueOf(CountInterest)+20);
 	}
 

+ 57 - 5
src/main/java/com/goafanti/achievement/controller/AdminAchievementApiController.java

@@ -26,6 +26,7 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.AchievementFields;
 import com.goafanti.common.enums.AchievementImportFields;
@@ -57,6 +58,8 @@ public class AdminAchievementApiController extends CertifyApiController {
     private AchievementOrderService	achievementOrderService;
     @Resource
     private MarketingManagementService marketingManagementService;
+    @Resource
+    private AdminMapper adminMapper;
     /**
      * 个人成果列表
      */
@@ -80,7 +83,7 @@ public class AdminAchievementApiController extends CertifyApiController {
         return res;
     }
     /**
-     * 组织用户成果列表
+     * 组织用户成果列表(个人组织合并)
      */
     @RequestMapping(value = "/orgList", method = RequestMethod.GET)
     private Result orgList(Integer ownerType,String unitName, String ownerName, String ownerId, Integer auditStatus, Integer serialNumber, String name,
@@ -142,16 +145,20 @@ public class AdminAchievementApiController extends CertifyApiController {
         return res;
     }
     /**
-     * 组织用户成果详情详情
+     * 组织用户成果详情详情(个人组织合并)
      */
     @RequestMapping(value = "/orgDetail", method = RequestMethod.GET)
-    private Result orgDetail(String id) {
+    private Result orgDetail(String id,int ownerType) {
         Result res = new Result();
         if (StringUtils.isBlank(id)) {
             res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
             return res;
         }
-        res.setData(achievementService.selectOrgOwnerDetail(id));
+        if(ownerType==0){
+        	res.setData(achievementService.selectUserOwnerDetail(id));
+        }else if(ownerType==1){
+        	res.setData(achievementService.selectOrgOwnerDetail(id));
+        }       
         return res;
     }
     /**
@@ -511,7 +518,7 @@ public class AdminAchievementApiController extends CertifyApiController {
             return res;
         }
         if (null == ia.getOwnerType()) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到所有人类型", "所有人类型"));
+            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到所有人类型", "成果类别"));
             return res;
         }
         if (null == ia.getCooperationMode()) {
@@ -629,4 +636,49 @@ public class AdminAchievementApiController extends CertifyApiController {
         res.setData(data);
         return res;
     }
+    /**
+     * 我的成果列表
+     */
+    @RequestMapping(value = "/myList", method = RequestMethod.GET)
+    private Result myList(Integer ownerType,String unitName, String ownerName, String ownerId, Integer auditStatus, Integer serialNumber, String name,
+            String keyword, Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate,
+            Integer releaseStatus,String internationalFlag, String pageNo, String pageSize,Integer boutique,Integer hot) {
+        Result res = new Result();
+        Integer pNo = 1;
+        Integer pSize = 10;
+        if (StringUtils.isNumeric(pageSize)) {
+            pSize = Integer.parseInt(pageSize);
+        }
+        if (StringUtils.isNumeric(pageNo)) {
+            pNo = Integer.parseInt(pageNo);
+        }
+        String techBrokerId=TokenManager.getAdminId();
+        Object o = achievementService.listMyAchievement(techBrokerId,ownerType,unitName, ownerName, ownerId, auditStatus, serialNumber, name,
+                keyword, category, status, releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, releaseStatus,internationalFlag, pNo, pSize,boutique,hot);
+        res.setData(o);     
+        return res;
+    }
+    
+    /**
+     * 科技成果管理列表
+     */
+    @RequestMapping(value = "/manageList", method = RequestMethod.GET)
+    private Result manageList(Integer ownerType,String unitName, String ownerName, String ownerId, Integer auditStatus, Integer serialNumber, String name,
+            String keyword, Integer category, Integer status, String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate,
+            Integer releaseStatus,String internationalFlag, String pageNo, String pageSize,Integer boutique,Integer hot) {
+        Result res = new Result();
+        Integer pNo = 1;
+        Integer pSize = 10;
+        if (StringUtils.isNumeric(pageSize)) {
+            pSize = Integer.parseInt(pageSize);
+        }
+        if (StringUtils.isNumeric(pageNo)) {
+            pNo = Integer.parseInt(pageNo);
+        }
+        String techBrokerId=TokenManager.getAdminId();
+        Object o = achievementService.listManageAchievement(techBrokerId,ownerType,unitName, ownerName, ownerId, auditStatus, serialNumber, name,
+                keyword, category, status, releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, releaseStatus,internationalFlag, pNo, pSize,boutique,hot);
+        res.setData(o);     
+        return res;
+    }
 }

+ 7 - 0
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -93,9 +93,16 @@ public interface AchievementService {
 	Pagination<AchievementPartnerListBo> listAppMyAchievement(Integer pNo, Integer pSize);
 
 	AchievementUserOwnerDetailBo selectAppUserOwnerDetail(String id);
+
 
 	void saveAppAchievement(Achievement a, String[] keywords);
 
+	Pagination<AchievementListBo> listManageAchievement(String techBrokerId,Integer ownerType,String unitName, String ownerName, String ownerId, Integer auditStatus, Integer serialNumber,
+			String name, String keyword, Integer category, Integer status, String releaseDateStartDate,
+			String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer releaseStatus,String internationalFlag, Integer pNo, Integer pSize,Integer boutique,Integer hot);
 	
+	Pagination<AchievementListBo> listMyAchievement(String techBrokerId,Integer ownerType,String unitName, String ownerName, String ownerId, Integer auditStatus, Integer serialNumber,
+			String name, String keyword, Integer category, Integer status, String releaseDateStartDate,
+			String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer releaseStatus,String internationalFlag, Integer pNo, Integer pSize,Integer boutique,Integer hot);
 	
 }

+ 50 - 0
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -771,6 +771,56 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		return (Pagination<AchievementPartnerListBo>) findPage("findMyAchievementListByPage", "findMyAchievementCount",
 				params,pNo, pSize);
 	}
+	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementListBo> listMyAchievement(String techBrokerId,Integer ownerType,String unitName, String ownerName, String ownerId,
+			Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category, Integer status,
+			String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer releaseStatus, String internationalFlag,Integer pNo, Integer pSize,
+			Integer boutique, Integer hot) {
+		Map<String, Object> params = disposeParams(ownerType,unitName, ownerName, ownerId, auditStatus, serialNumber, name, keyword, category, status,
+				releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, releaseStatus, UserType.ORGANIZATION.getCode(),
+				boutique,internationalFlag, hot);
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		
+		if (null != techBrokerId) {
+			params.put("techBrokerId", techBrokerId);
+		}
+		
+		return (Pagination<AchievementListBo>) findPage("findMyyAchievementListByPage",
+				"findMyyAchievementCount",params,pNo, pSize);
+	}
+	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AchievementListBo> listManageAchievement(String techBrokerId,Integer ownerType,String unitName, String ownerName, String ownerId,
+			Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category, Integer status,
+			String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer releaseStatus, String internationalFlag,Integer pNo, Integer pSize,
+			Integer boutique, Integer hot) {
+		Map<String, Object> params = disposeParams(ownerType,unitName, ownerName, ownerId, auditStatus, serialNumber, name, keyword, category, status,
+				releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, releaseStatus, UserType.ORGANIZATION.getCode(),
+				boutique,internationalFlag, hot);
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		
+		if (null != techBrokerId) {
+			params.put("techBrokerId", techBrokerId);
+		}
+		
+		return (Pagination<AchievementListBo>) findPage("findManageAchievementListByPage",
+				"findManageAchievementCount",params,pNo, pSize);
+	}
 
 	@Override
 	public void saveAppAchievement(Achievement a, String[] keywords) {

+ 36 - 1
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -9,6 +9,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -25,6 +26,7 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.AdminLocation;
 import com.goafanti.common.utils.PasswordUtil;
@@ -43,6 +45,8 @@ public class AdminSuperviserApiController extends CertifyApiController {
 	private AdminLocationService	adminLocationService;
 	@Resource
 	private UserService				userService;
+	@Autowired
+	private AdminMapper			adminMapper;
 	/**管理员列表*/
 	@RequestMapping(value = "/adminList", method = RequestMethod.GET)
 	public Result adminList(AdminListBo alb, String rid, String pageNo,
@@ -147,9 +151,40 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			Admin a = newAdminService.selectByPrimaryKey(admin.getId());
 			if (null == a) {	
 				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));				
+				return res;	
+			}	
+			//*********用户编号判断**************
+			String sdepNo=adminMapper.selectUserNoBySuperiorId(admin.getSuperiorId());
+			int Count=adminMapper.selectCountBySuperiorId(admin.getSuperiorId());
+			if((Count+1)>99){
+				res.getError().add(buildError("","每层最多存在99个子类"));
 				return res;
-				
 			}
+			if(Count<10){
+				String dep=sdepNo+"0"+Count;
+				String sid=adminMapper.selectIdByUserNo(dep);
+				while(sid!=null){
+					Count=(Count+1)%100;				
+					if(Count>=10){
+						dep=sdepNo+Count;	
+					}else{
+						dep=sdepNo+"0"+Count;
+					}
+					sid=adminMapper.selectIdByUserNo(dep);				
+				}
+				admin.setUserNo(dep);
+			}
+			if(Count>=10){
+				String dep=sdepNo+Count;
+				String sid=adminMapper.selectIdByUserNo(dep);
+				while(sid!=null){
+					Count=(Count+1)%100;				
+					dep=sdepNo+Count;
+					sid=adminMapper.selectIdByUserNo(dep);				
+				}
+				admin.setUserNo(dep);
+			}
+			
 			Admin ad = new Admin();
 			BeanUtils.copyProperties(admin, ad);
 			res = disposeAdminLocationList(res, jo, ad);

+ 65 - 23
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -86,33 +86,75 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
-		String sdepNo=adminMapper.selectUserNoBySuperiorId(ad.getSuperiorId());
-		int Count=adminMapper.selectCountBySuperiorId(ad.getSuperiorId());
-		if(Count<10){
-			String dep=sdepNo+"0"+Count;
-			String sid=adminMapper.selectIdByUserNo(dep);
-			while(sid!=null){
-				Count=Count+1;				
-				if(Count>=10){
-					dep=sdepNo+Count;	
+			
+		int count=adminMapper.updateByPrimaryKeySelective(ad);
+		//*******下第一级管理员用户修改
+		String autNo;
+		int n=0;
+		List<Admin> Nos =adminMapper.selectIDNBySuperiorId(ad.getId());
+		for(Admin i:Nos){			
+			autNo=adminMapper.selectUserNoById(i.getSuperiorId());
+			if(n<10){
+				String aut=autNo+"0"+n;			
+				if(n>=10){
+					aut=autNo+n;	
 				}else{
-					dep=sdepNo+"0"+Count;
+					aut=autNo+"0"+n;
+				}	
+				i.setUserNo(aut);
+			}
+			if(n>=10){
+				String aut=autNo+n;			
+				aut=autNo+n;	
+				i.setUserNo(aut);
+			}
+			adminMapper.updateByUserNo(i);
+			n++;
+			//*******下第二级管理员用户修改
+			int m=0;
+			List<Admin> Noss =adminMapper.selectIDNBySuperiorId(i.getId());
+			for(Admin o:Noss){			
+				autNo=adminMapper.selectUserNoById(o.getSuperiorId());
+				if(m<10){
+					String aut=autNo+"0"+m;			
+					if(m>=10){
+						aut=autNo+m;	
+					}else{
+						aut=autNo+"0"+m;
+					}	
+					o.setUserNo(aut);
+				}
+				if(m>=10){
+					String aut=autNo+m;			
+					aut=autNo+m;	
+					o.setUserNo(aut);
+				}
+				adminMapper.updateByUserNo(o);
+				m++;
+				//*******下第三级管理员用户修改
+				int z=0;
+				List<Admin> Nosss =adminMapper.selectIDNBySuperiorId(o.getId());
+				for(Admin p:Nosss){			
+					autNo=adminMapper.selectUserNoById(p.getSuperiorId());
+					if(z<10){
+						String aut=autNo+"0"+z;			
+						if(z>=10){
+							aut=autNo+z;	
+						}else{
+							aut=autNo+"0"+z;
+						}	
+						p.setUserNo(aut);
+					}
+					if(z>=10){
+						String aut=autNo+z;			
+						aut=autNo+z;	
+						p.setUserNo(aut);
+					}
+					adminMapper.updateByUserNo(p);
+					z++;
 				}
-				sid=adminMapper.selectIdByUserNo(dep);				
 			}
-			ad.setUserNo(dep);
 		}
-		if(Count>=10){
-			String dep=sdepNo+Count;
-			String sid=adminMapper.selectIdByUserNo(dep);
-			while(sid!=null){
-				Count=Count+1;				
-				dep=sdepNo+Count;
-				sid=adminMapper.selectIdByUserNo(dep);				
-			}
-			ad.setUserNo(dep);
-		}	
-		int count=adminMapper.updateByPrimaryKeySelective(ad);
 		return count;
 	}
 

+ 8 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -83,5 +83,13 @@ public interface AdminMapper {
 	int deleteById(String id);
 
 	Pagination<AppAdminListBo> consultantList();
+	
+	List<Admin> selectIDNBySuperiorId(String superiorId);
+	
+	String selectUserNoById(String superiorId);
+	
+	int updateByUserNo(Admin record);
+	
+	List<String>selectIdBySuperiorId(String superiorId);
 
 }

+ 332 - 22
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -855,7 +855,7 @@
   	select 
   		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
   		a.name, a.keyword, a.category, a.owner_name as ownerName, a.owner_type as ownerType, 
-  		<!-- oi.unit_name as username,  -->a.owner_id as ownerId, a.org_id as orgId, a.contacts,a.create_time as createTime,
+  		a.owner_id as ownerId, a.org_id as orgId, a.contacts,a.create_time as createTime,
   		a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId,a.boutique
   	<if test="hot != null and hot == 1"><!-- 在首页 -->
 		,1 as hot
@@ -868,10 +868,6 @@
 	</if>
   	from achievement a
   	LEFT JOIN admin ad on ad.id = a.tech_broker_id
-	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
-	<if test="adminId != null">
-		LEFT JOIN user u on a.owner_id = u.id
-	</if>
   	<if test="hot != null and hot == 1"> <!-- 在首页 -->
 		inner join marketing_management mm on a.id = mm.product_id
 	</if>
@@ -882,15 +878,9 @@
   	<if test="ownerType != null">
 		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
 	</if>
-  	<if test="techBrokerId != null">
-		and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
-	</if>
   	<if test="ownerName != null">
   		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%') 	
   	</if>
-  	<!-- <if test="unitName != null">
-  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
-  	</if> -->
   	<if test="ownerId != null">
 		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
 	</if>
@@ -948,10 +938,6 @@
   		count(1)
   	from achievement a
   	LEFT JOIN admin ad on ad.id = a.tech_broker_id
-	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
-	<if test="adminId != null">
-		LEFT JOIN user u on a.owner_id = u.id
-	</if>
   	<if test="hot != null and hot == 1"><!-- 在首页 -->
 		inner join marketing_management mm on a.id = mm.product_id
 	</if>
@@ -962,15 +948,9 @@
   	<if test="ownerType != null">
 		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
 	</if>
-  	<if test="techBrokerId != null">
-		and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
-	</if>
   	<if test="ownerName != null">
   		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%')
   	</if>
-  	<!-- <if test="unitName != null">
-  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
-  	</if> -->
   	<if test="ownerId != null">
 		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
 	</if>
@@ -1007,7 +987,6 @@
 	<if test="releaseStatus != null">
 	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
 	</if>
-	
 	<if test="hot != null and hot == 0"><!-- 不在首页 -->
 		and a.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
 	</if>
@@ -1804,5 +1783,336 @@
   	</if>
   	</select>
   	
+  	<select id="findMyyAchievementListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementListBo">
+  	select 
+  		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
+  		a.name, a.keyword, a.category, a.owner_name as ownerName, a.owner_type as ownerType, 
+  		<!-- oi.unit_name as username,  -->a.owner_id as ownerId, a.org_id as orgId, a.contacts,a.create_time as createTime,
+  		a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId,a.boutique
+  	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		,1 as hot
+	</if>
+	<if test="hot != null and hot == 0"><!-- 无首页参数 -->
+		,0 as hot
+	</if>
+	<if test="hot==null"><!-- 在首页 -->
+		,ifnull(mm.effective,0) as hot
+	</if>
+  	from achievement a
+  	LEFT JOIN admin ad on ad.id = a.tech_broker_id
+	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
+	<if test="adminId != null">
+		LEFT JOIN user u on a.owner_id = u.id
+	</if>
+  	<if test="hot != null and hot == 1"> <!-- 在首页 -->
+		inner join marketing_management mm on a.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on a.id = mm.product_id 
+	</if>
+  	where a.deleted_sign = 0 
+  	<if test="ownerType != null">
+		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
+	</if>
+  	<if test="techBrokerId != null">
+		and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} 
+	</if>
+  	<if test="ownerName != null">
+  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%') 	
+  	</if>
+  	<!-- <if test="unitName != null">
+  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+  	</if> -->
+  	<if test="ownerId != null">
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  a.category = #{category,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  a.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	a.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	a.create_time <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and a.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+	
+	<if test="boutique != null">
+		and a.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and a.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+	order by serial_number desc
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id="findMyyAchievementCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from achievement a
+  	LEFT JOIN admin ad on ad.id = a.tech_broker_id
+	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
+	<if test="adminId != null">
+		LEFT JOIN user u on a.owner_id = u.id
+	</if>
+  	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on a.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on a.id = mm.product_id 
+	</if>
+  	where a.deleted_sign = 0 
+  	<if test="ownerType != null">
+		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
+	</if>
+  	<if test="techBrokerId != null">
+		and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} 
+	</if>
+  	<if test="ownerName != null">
+  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%')
+  	</if>
+  	<!-- <if test="unitName != null">
+  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+  	</if> -->
+  	<if test="ownerId != null">
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  a.category = #{category,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  a.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	a.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	a.create_time <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and a.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+	
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and a.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and  mm.effective = 1
+	</if>
+  </select>
+  	
+  	<select id="findManageAchievementListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementListBo">
+  	select 
+  		a.id, a.serial_number as serialNumber, a.data_category as dataCategory, 
+  		a.name, a.keyword, a.category, a.owner_name as ownerName, a.owner_type as ownerType, 
+  		<!-- oi.unit_name as username,  -->a.owner_id as ownerId, a.org_id as orgId, a.contacts,a.create_time as createTime,
+  		a.release_date as releaseDate, a.audit_status as auditStatus, ad.name as techBrokerId,a.boutique
+  	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		,1 as hot
+	</if>
+	<if test="hot != null and hot == 0"><!-- 无首页参数 -->
+		,0 as hot
+	</if>
+	<if test="hot==null"><!-- 在首页 -->
+		,ifnull(mm.effective,0) as hot
+	</if>
+  	from achievement a
+  	LEFT JOIN admin ad on ad.id = a.tech_broker_id
+  	LEFT JOIN department_management dm on dm.id = ad.department_id
+	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
+	<if test="adminId != null">
+		LEFT JOIN user u on a.owner_id = u.id
+	</if>
+  	<if test="hot != null and hot == 1"> <!-- 在首页 -->
+		inner join marketing_management mm on a.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on a.id = mm.product_id 
+	</if>
+  	where a.deleted_sign = 0 
+  	<if test="ownerType != null">
+		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
+	</if>
+  	<if test="techBrokerId != null">
+		and (a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or ad.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
+	</if>
+  	<if test="ownerName != null">
+  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%') 	
+  	</if>
+  	<!-- <if test="unitName != null">
+  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+  	</if> -->
+  	<if test="ownerId != null">
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  a.category = #{category,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  a.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	a.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	a.create_time <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and a.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+	
+	<if test="boutique != null">
+		and a.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and a.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+	order by serial_number desc
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id="findManageAchievementCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from achievement a
+  	LEFT JOIN admin ad on ad.id = a.tech_broker_id
+  	LEFT JOIN department_management dm on dm.id = ad.department_id
+	<!-- LEFT JOIN organization_identity oi on a.owner_id = oi.uid -->
+	<if test="adminId != null">
+		LEFT JOIN user u on a.owner_id = u.id
+	</if>
+  	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on a.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on a.id = mm.product_id 
+	</if>
+  	where a.deleted_sign = 0 
+  	<if test="ownerType != null">
+		and a.owner_type = #{ownerType,jdbcType=VARCHAR}
+	</if>
+  	<if test="techBrokerId != null">
+		and (a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or ad.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
+	</if>
+  	<if test="ownerName != null">
+  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%')
+  	</if>
+  	<!-- <if test="unitName != null">
+  		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+  	</if> -->
+  	<if test="ownerId != null">
+		and  a.owner_id = #{ownerId,jdbcType=VARCHAR}
+	</if>
+  	<if test="serialNumber != null">
+		and  a.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="category != null">
+		and  a.category = #{category,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  a.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="rStart != null">
+       and	a.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and a.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	a.create_time <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and a.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="releaseStatus != null">
+	   and  a.release_status = #{releaseStatus,jdbcType=INTEGER}
+	</if>
+	
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and a.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and  mm.effective = 1
+	</if>
+  </select>
   	
 </mapper>

+ 29 - 1
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -543,5 +543,33 @@
   	delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-
+  
+  <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
+	select id, mobile, name, 
+	    password, email, create_time as createTime, 
+	    province, position, 
+	    superior_id as superiorId,department_id as departmentId,
+	    status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
+	from admin
+	where
+	superior_id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+  <select id="selectUserNoById" resultType="java.lang.String">
+	select user_no as userNo
+	from admin
+	where
+	id=#{superiorId,jdbcType=VARCHAR}  
+  </select>
+  <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
+	update admin
+	set user_no = #{userNo,jdbcType=VARCHAR}
+	where
+	id=#{id,jdbcType=VARCHAR}  
+  </update>
+  <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
+	select id
+	from admin
+	where
+	superior_id=#{superiorId,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 420 - 39
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -728,11 +728,7 @@
 		,ifnull(mm.effective,0) as hot
 	 </if>
 	from  demand d 
-	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="adminId != null">
-		LEFT JOIN user u on d.employer_id = u.id
-	</if>
 	<if test="hot != null and hot == 1"><!-- 在首页 -->
 		inner join marketing_management mm on d.id = mm.product_id
 	</if>
@@ -743,19 +739,6 @@
 	<if test="dataCategory != null">
 		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
 	</if>
-	<if test="adminId != null">
-		and (u.mid = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
-		)
-	</if>
-	<!-- <if test="province != null">
-		and  oi.licence_province = #{province,jdbcType=INTEGER}
-	</if> -->
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
@@ -768,9 +751,6 @@
 	<if test="keyword != null">
 		and  d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
 	</if>
-	<!-- <if test="unitName != null">
-		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
-	</if> -->
 	<if test="employerName != null">
 		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
 		and  (d.employer_id is null or d.employer_id='')
@@ -826,9 +806,6 @@
 	from  demand d 
 	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="adminId != null">
-		LEFT JOIN user u on d.employer_id = u.id
-	</if>
 	<if test="hot != null and hot == 1"><!-- 在首页 -->
 		inner join marketing_management mm on d.id = mm.product_id
 	</if>
@@ -839,34 +816,18 @@
 	<if test="dataCategory != null">
 		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
 	</if>
-	<if test="adminId != null">
-		and (u.mid = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
-		)
-	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
 	</if>
 	<if test="auditStatus != null">
 		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
 	</if>
-	<!-- <if test="province != null">
-		and  oi.licence_province = #{province,jdbcType=INTEGER}
-	</if> -->
 	<if test="name != null">
 		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>
 	<if test="keyword != null">
 		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
 	</if>
-	<!-- <if test="unitName != null">
-		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
-	</if> -->
 	<if test="employerName != null">
 		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
 		and  (d.employer_id is null or d.employer_id='')
@@ -1704,4 +1665,424 @@
 	left join business_project  b on t.project_id=b.id
 	where  t.uid=#{uid,jdbcType=VARCHAR}
 	</select>
+	
+  <select id="findMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
+  	select 
+	  d.id, d.serial_number as serialNumber, d.data_category as dataCategory, 
+	  d.name, d.keyword, d.info_sources as infoSources, 
+	  <!-- oi.unit_name as username, --> d.demand_type as demandType, d.validity_period as validityPeriod, 
+	  d.employer_name as employerName, <!-- oi.licence_province as province, --> d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
+	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
+	  d.employer_id as employerId, d.audit_status as auditStatus,
+	  d.tech_broker_id as techBrokerId,d.boutique
+	 <if test="hot != null and hot == 1"><!-- 在首页 -->
+		,1 as hot
+	 </if>
+	 <if test="hot != null and hot == 0"><!-- 不在首页 -->
+		,0 as hot
+	 </if>
+	 <if test="hot==null"><!-- 无首页参数 -->
+		,ifnull(mm.effective,0) as hot
+	 </if>
+	from  demand d 
+	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
+	LEFT JOIN admin a on a.id = d.tech_broker_id
+	<if test="adminId != null">
+		LEFT JOIN user u on d.employer_id = u.id
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on d.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on d.id = mm.product_id 
+	</if>
+	where d.deleted_sign = 0 
+	<if test="techBrokerId != null">
+		and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
+	</if>
+	<if test="dataCategory != null">
+		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		and (u.mid = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
+		)
+	</if>
+	<!-- <if test="province != null">
+		and  oi.licence_province = #{province,jdbcType=INTEGER}
+	</if> -->
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
+	</if>
+	<!-- <if test="unitName != null">
+		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+	</if> -->
+	<if test="employerName != null">
+		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
+		and  (d.employer_id is null or d.employer_id='')
+	</if>
+	<if test="infoSources != null">
+		and  d.info_sources = #{infoSources,jdbcType=INTEGER}
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="boutique != null">
+		and d.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+  	order by d.serial_number desc
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id ="findMyDemandCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+	count(1)
+	from  demand d 
+	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
+	LEFT JOIN admin a on a.id = d.tech_broker_id
+	<if test="adminId != null">
+		LEFT JOIN user u on d.employer_id = u.id
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on d.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on d.id = mm.product_id 
+	</if>
+	where d.deleted_sign = 0 
+	<if test="techBrokerId != null">
+		and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
+	</if>
+	<if test="dataCategory != null">
+		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		and (u.mid = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
+		)
+	</if>
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<!-- <if test="province != null">
+		and  oi.licence_province = #{province,jdbcType=INTEGER}
+	</if> -->
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<!-- <if test="unitName != null">
+		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+	</if> -->
+	<if test="employerName != null">
+		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
+		and  (d.employer_id is null or d.employer_id='')
+	</if>
+	<if test="infoSources != null">
+		and  d.info_sources = #{infoSources,jdbcType=INTEGER}
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="boutique != null">
+		and d.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+  </select>
+  
+  <select id="findManageDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
+  	select 
+	  d.id, d.serial_number as serialNumber, d.data_category as dataCategory, 
+	  d.name, d.keyword, d.info_sources as infoSources, 
+	  <!-- oi.unit_name as username, --> d.demand_type as demandType, d.validity_period as validityPeriod, 
+	  d.employer_name as employerName, <!-- oi.licence_province as province, --> d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
+	  d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
+	  d.employer_id as employerId, d.audit_status as auditStatus,
+	  d.tech_broker_id as techBrokerId,d.boutique
+	 <if test="hot != null and hot == 1"><!-- 在首页 -->
+		,1 as hot
+	 </if>
+	 <if test="hot != null and hot == 0"><!-- 不在首页 -->
+		,0 as hot
+	 </if>
+	 <if test="hot==null"><!-- 无首页参数 -->
+		,ifnull(mm.effective,0) as hot
+	 </if>
+	from  demand d 
+	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
+	LEFT JOIN admin a on a.id = d.tech_broker_id
+	LEFT JOIN department_management dm on dm.id = a.department_id
+	<if test="adminId != null">
+		LEFT JOIN user u on d.employer_id = u.id
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on d.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on d.id = mm.product_id 
+	</if>
+	where d.deleted_sign = 0 
+	<if test="techBrokerId != null">
+		and (d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or a.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
+	</if>
+	<if test="dataCategory != null">
+		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		and (u.mid = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
+		)
+	</if>
+	<!-- <if test="province != null">
+		and  oi.licence_province = #{province,jdbcType=INTEGER}
+	</if> -->
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
+	</if>
+	<!-- <if test="unitName != null">
+		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+	</if> -->
+	<if test="employerName != null">
+		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
+		and  (d.employer_id is null or d.employer_id='')
+	</if>
+	<if test="infoSources != null">
+		and  d.info_sources = #{infoSources,jdbcType=INTEGER}
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=INTEGER}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="boutique != null">
+		and d.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+  	order by d.serial_number desc
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id ="findManagegDemandCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+	count(1)
+	from  demand d 
+	<!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
+	LEFT JOIN admin a on a.id = d.tech_broker_id
+	LEFT JOIN department_management dm on dm.id = a.department_id
+	<if test="adminId != null">
+		LEFT JOIN user u on d.employer_id = u.id
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		inner join marketing_management mm on d.id = mm.product_id
+	</if>
+	<if test="hot == null"> <!-- 无首页参数 -->
+		left join marketing_management mm on d.id = mm.product_id 
+	</if>
+	where d.deleted_sign = 0 
+	<if test="techBrokerId != null">
+		and (d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or a.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
+	</if>
+	<if test="dataCategory != null">
+		and d.data_category = #{dataCategory,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		and (u.mid = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
+		)
+	</if>
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<!-- <if test="province != null">
+		and  oi.licence_province = #{province,jdbcType=INTEGER}
+	</if> -->
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<!-- <if test="unitName != null">
+		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+	</if> -->
+	<if test="employerName != null">
+		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
+		and  (d.employer_id is null or d.employer_id='')
+	</if>
+	<if test="infoSources != null">
+		and  d.info_sources = #{infoSources,jdbcType=INTEGER}
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cStart != null">
+       and	d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="cEnd != null">
+	   and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="boutique != null">
+		and d.boutique = #{boutique,jdbcType=INTEGER}
+	</if>
+	<if test="hot != null and hot == 0"><!-- 不在首页 -->
+		and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
+	</if>
+	<if test="hot != null and hot == 1"><!-- 在首页 -->
+		and mm.effective = 1
+	</if>
+  </select>
 </mapper>

+ 63 - 7
src/main/java/com/goafanti/demand/controller/AdminDemandApiController.java

@@ -214,7 +214,7 @@ public class AdminDemandApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 组织用户--需求列表
+	 * 组织用户--需求列表(个人组织合并)
 	 */
 	@RequestMapping(value = "/orgList", method = RequestMethod.GET)
 	public Result orgList(Integer dataCategory,String employerName, Integer auditStatus, Integer province, Integer serialNumber, String name, String keyword,
@@ -307,18 +307,23 @@ public class AdminDemandApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 组织用户详情
+	 * 组织用户详情(个人组织合并)
 	 */
 	@RequestMapping(value = "/orgDemandDetail", method = RequestMethod.GET)
-	public Result orgDemandDetail(String id) {
+	public Result orgDemandDetail(String id,int dataCategory) {
 		Result res = new Result();
 
 		if (StringUtils.isBlank(id)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
 			return res;
 		}
-
-		res.setData(demandService.selectOrgDemandDetail(id));
+		if(dataCategory==0){
+			res.setData(demandService.selectUserDemandDetail(id));
+			return res;
+		}else if(dataCategory==1){
+			res.setData(demandService.selectOrgDemandDetail(id));
+			return res;
+		}
 		return res;
 	}
 
@@ -551,13 +556,16 @@ public class AdminDemandApiController extends CertifyApiController {
 			return res;
 		}
 
-		if (!DemandDataCategory.USERDEMAND.getCode().equals(demand.getDataCategory())
+		/*if (!DemandDataCategory.USERDEMAND.getCode().equals(demand.getDataCategory())
 				&& !DemandDataCategory.ORGDEMAND.getCode().equals(demand.getDataCategory())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "数据类型"));
 			return res;
+		}*/
+		if (null == demand.getDataCategory()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求类型", "需求类别"));
+			return res;
 		}
 
-
 		if (StringUtils.isBlank(demand.getKeyword())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到关键词", "关键词"));
 			return res;
@@ -652,5 +660,53 @@ public class AdminDemandApiController extends CertifyApiController {
 		res.setData(data);
 		return res;
 	}
+	
+	/**
+	 * 我的需求列表
+	 */
+	@RequestMapping(value = "/myList", method = RequestMethod.GET)
+	public Result myList(Integer dataCategory,String employerName, Integer auditStatus, Integer province, Integer serialNumber, String name, String keyword,
+			Integer infoSources, Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate,
+			String unitName, Integer status, Integer releaseStatus, String releaseDateStartDate,
+			String releaseDateEndDate,String createDateStartDate, String createDateEndDate, String pageNo, String pageSize,Integer boutique,Integer hot) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(demandService.selectMyDemandManageList(dataCategory,employerName, auditStatus, province, serialNumber, name, keyword,
+				infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate, unitName, status,
+				releaseStatus, releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, pNo, pSize,boutique,hot,TokenManager.getAdminId()));
+		return res;
+	}
+	
+	/**
+	 * 我的需求列表
+	 */
+	@RequestMapping(value = "/manageList", method = RequestMethod.GET)
+	public Result manageList(Integer dataCategory,String employerName, Integer auditStatus, Integer province, Integer serialNumber, String name, String keyword,
+			Integer infoSources, Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate,
+			String unitName, Integer status, Integer releaseStatus, String releaseDateStartDate,
+			String releaseDateEndDate,String createDateStartDate, String createDateEndDate, String pageNo, String pageSize,Integer boutique,Integer hot) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(demandService.selectManageDemandManageList(dataCategory,employerName, auditStatus, province, serialNumber, name, keyword,
+				infoSources, demandType, validityPeriodStartDate, validityPeriodEndDate, unitName, status,
+				releaseStatus, releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, pNo, pSize,boutique,hot,TokenManager.getAdminId()));
+		return res;
+	}
 
 }

+ 10 - 0
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -94,7 +94,17 @@ public interface DemandService {
 
 	Pagination<DemandSearchListBo> listMyDemand(Integer pNo, Integer pSize);
 
+
 	void saveAppUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords);
 
+
+	Pagination<DemandManageListBo> selectMyDemandManageList(Integer dataCategory,String employerName, Integer auditStatus, Integer province, Integer serialNumber,
+			String name, String keyword, Integer infoSources, Integer demandType, String validityPeriodStartDate,
+			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus,
+			String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer pNo, Integer pSize,Integer boutique,Integer hot,String techBrokerId);
 	
+	Pagination<DemandManageListBo> selectManageDemandManageList(Integer dataCategory,String employerName, Integer auditStatus, Integer province, Integer serialNumber,
+			String name, String keyword, Integer infoSources, Integer demandType, String validityPeriodStartDate,
+			String validityPeriodEndDate, String username, Integer status, Integer releaseStatus,
+			String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer pNo, Integer pSize,Integer boutique,Integer hot,String techBrokerId);
 }

+ 85 - 2
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -197,9 +197,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			params.put("dataCategory", dataCategory);
 		}
 
-		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+		/*if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
 			params.put("adminId", TokenManager.getAdminId());
-		}
+		}*/
 
 		if (StringUtils.isNotBlank(employerName)) {
 			params.put("employerName", employerName);
@@ -945,6 +945,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		return (Pagination<DemandSearchListBo>) findPage("findAppMyDemandListByPage", "findAppMyDemandCount", params, pNo, pSize);
 	}
 
+
 	public void saveAppUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords) {
 		Date validityPeriod = null;
 		if (!StringUtils.isBlank(validityPeriodFormattedDate)) {
@@ -993,7 +994,89 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		disposeDemandKeyword(keywords, d, false);
 	}
 
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandManageListBo> selectMyDemandManageList(Integer dataCategory,String employerName, Integer auditStatus,
+			Integer province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer pNo,
+			Integer pSize, Integer boutique, Integer hot, String techBrokerId) {
+		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
+				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
+				releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, boutique, hot);
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		if (null != dataCategory) {
+			params.put("dataCategory", dataCategory);
+		}
+
+		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+			params.put("adminId", TokenManager.getAdminId());
+		}
+
+		if (StringUtils.isNotBlank(employerName)) {
+			params.put("employerName", employerName);
+		}
+
+		if (StringUtils.isNotBlank(username)) {
+			params.put("unitName", username);
+		}
+		if (null != techBrokerId) {
+			params.put("techBrokerId", techBrokerId);
+		}
+
+		return (Pagination<DemandManageListBo>) findPage("findMyDemandListByPage", "findMyDemandCount",
+				params, pNo, pSize);
+	}
+	
 	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandManageListBo> selectManageDemandManageList(Integer dataCategory,String employerName, Integer auditStatus,
+			Integer province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate,String createDateStartDate, String createDateEndDate, Integer pNo,
+			Integer pSize, Integer boutique, Integer hot, String techBrokerId) {
+		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
+				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
+				releaseDateStartDate, releaseDateEndDate, createDateStartDate,  createDateEndDate, boutique, hot);
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		if (null != dataCategory) {
+			params.put("dataCategory", dataCategory);
+		}
+
+		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+			params.put("adminId", TokenManager.getAdminId());
+		}
+
+		if (StringUtils.isNotBlank(employerName)) {
+			params.put("employerName", employerName);
+		}
+
+		if (StringUtils.isNotBlank(username)) {
+			params.put("unitName", username);
+		}
+		if (null != techBrokerId) {
+			params.put("techBrokerId", techBrokerId);
+		}
+
+		return (Pagination<DemandManageListBo>) findPage("findManageDemandListByPage", "findManagegDemandCount",
+				params, pNo, pSize);
+	}
 		
 	
 }