liupeng 5 år sedan
förälder
incheckning
92c8923010

+ 30 - 0
code/sapparent/sapcms/src/main/java/org/fouram/controller/ApiController.java

@@ -8,7 +8,9 @@ import org.fouram.core.util.AppUtil.ResultConstant;
 import org.fouram.core.util.LoggerUtil;
 import org.fouram.core.util.TreeUtil;
 import org.fouram.entity.SapOrg;
+import org.fouram.entity.SapUser;
 import org.fouram.service.SapOrgService;
+import org.fouram.service.SapUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +22,8 @@ public class ApiController extends BaseController {
 	
 	@Autowired
 	private SapOrgService sapOrgService;
+	@Autowired
+	private SapUserService sapUserService;
 
 	@RequestMapping(value = "/getDepartTree", produces = "application/json;charset=utf-8")
 	@ResponseBody
@@ -32,4 +36,30 @@ public class ApiController extends BaseController {
 			return AppUtil.error(ResultConstant.WEB_ERR_MSG);
 		}
 	}
+	
+	@RequestMapping(value = "/getDepartListByName", produces = "application/json;charset=utf-8")
+	@ResponseBody
+	public Object getDepartListByName() {
+		try {
+			String name = getPageData().getString("name");
+			List<SapOrg> orgs = sapOrgService.getDepartListByName(name);
+			return AppUtil.success(orgs, null);
+		} catch (Exception e) {
+			LoggerUtil.error(e);
+			return AppUtil.error(ResultConstant.WEB_ERR_MSG);
+		}
+	}
+	
+	@RequestMapping(value = "/getUserListByName", produces = "application/json;charset=utf-8")
+	@ResponseBody
+	public Object getUserListByName() {
+		try {
+			String name = getPageData().getString("name");
+			List<SapUser> users = sapUserService.getUserListByName(name);
+			return AppUtil.success(users, null);
+		} catch (Exception e) {
+			LoggerUtil.error(e);
+			return AppUtil.error(ResultConstant.WEB_ERR_MSG);
+		}
+	}
 }

+ 4 - 0
code/sapparent/sapservice/src/main/java/org/fouram/mapper/SapOrgMapper.xml

@@ -22,6 +22,10 @@
 		</if>
 	</select>
 	
+	<select id="getDepartListByName" resultType="SapOrg">
+		select * from sap_org where sapName like CONCAT(CONCAT('%', #{pd.name}),'%')
+	</select>
+	
 	<update id="updateWxDepartId">
 		update sap_org set wxDepartId=#{wxDepartId} where id=#{id}
 	</update>

+ 5 - 0
code/sapparent/sapservice/src/main/java/org/fouram/mapper/SapUserMapper.xml

@@ -64,4 +64,9 @@
 	<select id="selectReportUserList" resultType="SapUser">
 		select * from sap_user where result != '垃圾数据' or result is null
 	</select>
+	
+	<select id="getUserListByName" resultType="SapUser">
+		select * from sap_user 
+		where result = 'SUCCESS' and name like CONCAT(CONCAT('%', #{name}),'%')
+	</select>
 </mapper>

+ 5 - 0
code/sapparent/sapservice/src/main/java/org/fouram/service/SapOrgService.java

@@ -172,4 +172,9 @@ public class SapOrgService extends BaseService {
 	public void updateWxDepartId(SapOrg org) throws Exception {
 		update("SapOrgMapper.updateWxDepartId", org);
 	}
+
+	@SuppressWarnings("unchecked")
+	public List<SapOrg> getDepartListByName(String name) throws Exception {
+		return (List<SapOrg>) findList("SapOrgMapper.getDepartListByName", name);
+	}
 }

+ 5 - 0
code/sapparent/sapservice/src/main/java/org/fouram/service/SapUserService.java

@@ -197,4 +197,9 @@ public class SapUserService extends BaseService {
 		String authorizationStr = stringBuilder.append("Basic ").append(Base64Util.encodeString(sapApiUser)).toString();
 		System.out.println(authorizationStr);
 	}
+
+	@SuppressWarnings("unchecked")
+	public List<SapUser> getUserListByName(String name) throws Exception {
+		return (List<SapUser>) findList("SapUserMapper.getUserListByName", name);
+	}
 }