Browse Source

部门管理查询接口修改

Michael 8 years ago
parent
commit
e69bd69c9a

+ 1 - 1
src/main/java/com/goafanti/common/dao/OrganizationManagementMapper.java

@@ -1,5 +1,5 @@
 package com.goafanti.common.dao;
 
 public interface OrganizationManagementMapper {
-	
+	int selectsuperId (String name);
 }

+ 37 - 2
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -1,7 +1,7 @@
 <?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.goafanti.common.dao.OrganizationManagementMapper">
-	<select id="selectOrganizationList" resultType="com.goafanti.organization.bo.OrganizationListOut">
+	<select id="selectOrganizationList" resultType="com.goafanti.organization.bo.OrganizationListOut" parameterType="String">
 		select
 		u.id as uid,om.id,om.create_id as createId,om.create_time as createTime,
 		om.update_time as updateTime,om.deleted_sign as deletedSign,
@@ -11,6 +11,19 @@
 		om.desc
 		from user u
 		left join organization_management om on om.id = u.id
+		where
+		<if test="name !=null">
+			AND om.name=#{name,jdbcType=VARCHAR}
+		</if>
+		<if test="superId !=null">
+			AND om.super_id=#{superId,jdbcType=VARCHAR}
+		</if>
+		<if test="type !=null">
+			AND om.type=#{type,jdbcType=VARCHAR}
+		</if>
+		<if test="depNo !=null">
+			AND om.dep_no=#{depNo,jdbcType=VARCHAR}
+		</if>
 	</select>
 	<select id="selectOrganizationCount" resultType="java.lang.Integer">
 		select
@@ -19,6 +32,28 @@
 		(select
 		id
 		from idorganization_management
-		)	
+		)as a
+		where
+		<if test="name !=null">
+			AND om.name=#{name,jdbcType=VARCHAR}
+		</if>
+		<if test="superId !=null">
+			AND om.super_id=#{superId,jdbcType=VARCHAR}
+		</if>
+		<if test="type !=null">
+			AND om.type=#{type,jdbcType=VARCHAR}
+		</if>
+		<if test="depNo !=null">
+			AND om.dep_no=#{depNo,jdbcType=VARCHAR}
+		</if>	
+	</select>
+	<select id="selectsuperId" resultType="String">
+		select
+		om.super_id
+		from organization_management om
+		where
+		<if test="name !=null">
+			AND om.name=#{name,jdbcType=VARCHAR}
+		</if> 
 	</select>
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/organization/controller/OrganizationManagementController.java

@@ -23,4 +23,10 @@ public class OrganizationManagementController {
 		res.setData(organizationService.listOrganizationManagement(olo, pageNo, pageSize));
 		return res;		
 	}
+	/**部门组织管理上级组织查询 **/
+	@RequestMapping(value = "/selectsuperId" , method = RequestMethod.POST)
+	public int selectsuperId(String name){
+		int superid=organizationService.selectsuperId(name);
+		return superid;
+	}
 }

+ 2 - 0
src/main/java/com/goafanti/organization/service/OrganizationService.java

@@ -13,4 +13,6 @@ public interface OrganizationService {
 	 */
 	Pagination<OrganizationListOut> 
 	listOrganizationManagement(OrganizationListOut olo,Integer pageNo, Integer pageSize);
+	/**组织名称查上级组织*/
+	int selectsuperId (String name);
 }

+ 7 - 1
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -9,12 +9,13 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.organization.service.OrganizationService;
+import com.goafanti.common.dao.OrganizationManagementMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 @Service
 public class OrganizationServiceImpl extends BaseMybatisDao<UserMapper> implements OrganizationService {
-	
+	private OrganizationManagementMapper organizationManagementMapper;
 	@Override
 	public Pagination<OrganizationListOut> listOrganizationManagement(OrganizationListOut olo, Integer pageNo,
 			Integer pageSize) {
@@ -39,6 +40,11 @@ public class OrganizationServiceImpl extends BaseMybatisDao<UserMapper> implemen
 		if(StringUtils.isNotBlank(olo.getDesc())) params.put("id", olo.getDesc());
 		return params;
 	}
+	@Override
+	public int selectsuperId(String name) {
+		int superid=(int)organizationManagementMapper.selectsuperId(name);
+		return superid;
+	}