From f13b30b4b7e5e7251fec524ee9b475c288dd7243 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Sun, 15 Mar 2020 19:59:41 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=B4=BB=E5=8A=A8contr?= =?UTF-8?q?oller=E4=BF=AE=E6=94=B9=E4=BB=A5=E5=8F=8A=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E3=80=82=E9=83=A8=E5=88=86=E6=A0=A1=E9=AA=8C=E5=99=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=82activity=E7=B3=BB=E7=BB=9Fbug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/activity/CurrentUserGetter.java | 26 +++ .../activity/NullValueAttributes.java | 12 ++ .../ase/controller/ActivityController.java | 82 ---------- .../activity/ActivityCreatorController.java | 148 ++++++++++++++++++ .../activity/ActivityViewerController.java | 1 - .../ase/exception/UserNotFoundException.java | 7 +- .../ase/model/activity/Activity.java | 5 +- .../ase/model/activity/UserActivity.java | 2 +- .../activity/UserActivityRepository.java | 14 ++ .../ase/validator/ActivityValidator.java | 17 ++ .../ase/validator/WebFormValidator.java | 2 +- 11 files changed, 228 insertions(+), 88 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/activity/CurrentUserGetter.java create mode 100644 src/main/java/com/codesdream/ase/component/activity/NullValueAttributes.java delete mode 100644 src/main/java/com/codesdream/ase/controller/ActivityController.java create mode 100644 src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java create mode 100644 src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java create mode 100644 src/main/java/com/codesdream/ase/validator/ActivityValidator.java diff --git a/src/main/java/com/codesdream/ase/component/activity/CurrentUserGetter.java b/src/main/java/com/codesdream/ase/component/activity/CurrentUserGetter.java new file mode 100644 index 0000000..cfebcbc --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/activity/CurrentUserGetter.java @@ -0,0 +1,26 @@ +package com.codesdream.ase.component.activity; + +import com.codesdream.ase.component.ASESpringUtil; +import com.codesdream.ase.model.permission.User; +import com.codesdream.ase.repository.permission.UserRepository; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.security.Principal; +import java.util.Optional; + +//获取当前用户的用户名 +@Component +public class CurrentUserGetter { + private Optional user; + public Optional getCurrentUser(HttpServletRequest request){ + + Principal principal = request.getUserPrincipal(); + String username = principal.getName(); + ASESpringUtil aseSpringUtil = new ASESpringUtil(); + UserRepository userRepository = aseSpringUtil.getBean(UserRepository.class); + this.user = userRepository.findByUsername(username); + return this.user; + } + +} diff --git a/src/main/java/com/codesdream/ase/component/activity/NullValueAttributes.java b/src/main/java/com/codesdream/ase/component/activity/NullValueAttributes.java new file mode 100644 index 0000000..dcd93ea --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/activity/NullValueAttributes.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.component.activity; + +import lombok.Data; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Data +@Component +public class NullValueAttributes { + private List nullValueAttributes; +} diff --git a/src/main/java/com/codesdream/ase/controller/ActivityController.java b/src/main/java/com/codesdream/ase/controller/ActivityController.java deleted file mode 100644 index cc214a0..0000000 --- a/src/main/java/com/codesdream/ase/controller/ActivityController.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.codesdream.ase.controller; - -import com.alibaba.fastjson.JSONObject; -import com.codesdream.ase.component.ASESpringUtil; -import com.codesdream.ase.component.activity.NullValueAttributes; -import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.configure.ActivityFormConfigure; -import com.codesdream.ase.exception.InvalidFormFormatException; -import com.codesdream.ase.exception.LackOfActivityInformation; -import com.codesdream.ase.model.activity.Activity; -import com.codesdream.ase.service.ActivityService; -import com.codesdream.ase.validator.NullValueValidator; -import com.codesdream.ase.validator.WebFormValidator; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.validation.constraints.Null; -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -@Controller -public class ActivityController { - - @Resource - ActivityService activityService; - - @Resource - JSONParameter jsonParameter; - - - - @RequestMapping(value = "/activity_creator") - String activityCreatorView(Model model){return "activity_creator";} - - @PostMapping(value = "/activity_creator") - String activityCreator(Model model, HttpServletRequest request) throws InvalidFormFormatException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - - Map parameterMap = request.getParameterMap(); - ASESpringUtil aseSpringUtil = new ASESpringUtil(); - ActivityFormConfigure activityFormConfigure = aseSpringUtil.getBean(ActivityFormConfigure.class); - WebFormValidator webFormValidator = aseSpringUtil.getBean(WebFormValidator.class); - if(!webFormValidator.check(activityFormConfigure.getStdActivityForm(), parameterMap)) { - throw new InvalidFormFormatException("Invalid activity form."); - } - // 需要检查JSON是否合法 - Optional jsonObject = jsonParameter.getJSONByRequest(request); - if(!jsonObject.isPresent()) return "error"; - Activity activity = jsonObject.get().toJavaObject(Activity.class); - - NullValueValidator nullValueValidator = aseSpringUtil.getBean(NullValueValidator.class); - List nullValues = nullValueValidator.checkNullValues(activity); - NullValueAttributes nullValueAttributes = aseSpringUtil.getBean(NullValueAttributes.class); - for (String str : nullValues){ - if(str.equals("title")){ - nullValueAttributes.getNullValueAttributes().add("title"); - } - else if(str.equals("creator")){ - nullValueAttributes.getNullValueAttributes().add("creator"); - } - else if(str.equals("type")){ - nullValueAttributes.getNullValueAttributes().add("type"); - } - else if(str.equals("planPeriod")){ - nullValueAttributes.getNullValueAttributes().add("planPeriod"); - } - else if(str.equals("chiefManager")){ - nullValueAttributes.getNullValueAttributes().add("chiefManager"); - } - } - - return "act_created"; - } -} - - diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java new file mode 100644 index 0000000..25f1d4b --- /dev/null +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java @@ -0,0 +1,148 @@ +package com.codesdream.ase.controller.activity; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.codesdream.ase.component.ASESpringUtil; +import com.codesdream.ase.component.activity.NullValueAttributes; +import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; +import com.codesdream.ase.configure.ActivityFormConfigure; +import com.codesdream.ase.exception.InvalidFormFormatException; +import com.codesdream.ase.exception.UserNotFoundException; +import com.codesdream.ase.model.activity.Activity; +import com.codesdream.ase.model.activity.UserActivity; +import com.codesdream.ase.model.permission.User; +import com.codesdream.ase.repository.activity.UserActivityRepository; +import com.codesdream.ase.repository.permission.UserRepository; +import com.codesdream.ase.service.ActivityService; +import com.codesdream.ase.validator.ActivityValidator; +import com.codesdream.ase.validator.NullValueValidator; +import com.codesdream.ase.validator.WebFormValidator; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Controller +public class ActivityCreatorController { + + @Resource + ActivityService activityService; + + @Resource + JSONParameter jsonParameter; + + @Resource + ASESpringUtil aseSpringUtil; + + @Resource + ActivityFormConfigure activityFormConfigure; + + @Resource + WebFormValidator webFormValidator; + + @Resource + NullValueValidator nullValueValidator; + + @Resource + NullValueAttributes nullValueAttributes; + + @Resource + ActivityValidator activityValidator; + + @Resource + UserRepository userRepository; + + @Resource + UserActivityRepository userActivityRepository; + + private final String url = "/forget/activity"; + + @RequestMapping(value = url + "/activity_creator") + String activityCreatorView(Model model){return "activity_creator";} + + + @PostMapping(value = url + "/activity_creator") + @ResponseBody + String activityCreator(@RequestBody JSONObject jsonParam, Model model, HttpServletRequest request) throws InvalidFormFormatException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { + + JSONObject error = new JSONObject(); + + Map parameterMap = request.getParameterMap(); + aseSpringUtil = new ASESpringUtil(); + //WebFormValidator webFormValidator = aseSpringUtil.getBean(WebFormValidator.class); + if(!webFormValidator.check(activityFormConfigure.getStdActivityForm(), parameterMap)) { + error.put("error", "Invalid form format"); + return error.toJSONString(); + } + // 需要检查JSON是否合法 + Optional jsonObject = jsonParameter.getJSONByRequest(request); + if(!jsonObject.isPresent()){ + error.put("error", "Invalid type."); + return error.toJSONString(); + } + Activity activity = jsonObject.get().toJavaObject(Activity.class); + + //NullValueValidator nullValueValidator = aseSpringUtil.getBean(NullValueValidator.class); + List nullValues = nullValueValidator.checkNullValues(activity); + //= aseSpringUtil.getBean(NullValueAttributes.class); + for (String str : nullValues){ + if(str.equals("title")){ + nullValueAttributes.getNullValueAttributes().add("title"); + } + else if(str.equals("creator")){ + nullValueAttributes.getNullValueAttributes().add("creator"); + } + else if(str.equals("type")){ + nullValueAttributes.getNullValueAttributes().add("type"); + } + else if(str.equals("planPeriod")){ + nullValueAttributes.getNullValueAttributes().add("planPeriod"); + } + else if(str.equals("chiefManager")){ + nullValueAttributes.getNullValueAttributes().add("chiefManager"); + } + } + //如果为空,存下此活动并跳转至成功创建页面 + if(nullValueAttributes.getNullValueAttributes().isEmpty()){ + + //ActivityValidator activityValidator = aseSpringUtil.getBean(ActivityValidator.class); + String[] errorParameters = activityValidator.check(parameterMap); + if(errorParameters != null){ + JSONObject invalidParameters = new JSONObject(); + invalidParameters.put("invalid_parameters", errorParameters); + return invalidParameters.toJSONString(); + + } + else{ + //UserRepository userRepository = aseSpringUtil.getBean(UserRepository.class); + //activityService = aseSpringUtil.getBean(ActivityService.class); + activity = activityService.createActivity(activity); + String username = parameterMap.get("creator")[0]; + Optional user = userRepository.findByUsername(username); + //UserActivityRepository userActivityRepository = aseSpringUtil.getBean(UserActivityRepository.class); + UserActivity userActivity = userActivityRepository.findByUser(user.get()); + userActivity.getCreatedActivities().add(activity); + userActivityRepository.save(userActivity); + } + } + //否则返回一个JSON对象给前端,此处应该是JSP页面,动态标红 + else{ + JSONObject nullParameters = new JSONObject(); + nullParameters.put("null_values",nullValueAttributes.getNullValueAttributes()); + return nullParameters.toJSONString(); + } + return url + "/act_created"; + } +} + + diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java index 91a112d..e6df04e 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.security.Principal; -import java.util.List; @Controller public class ActivityViewerController { diff --git a/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java b/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java index f0d38e3..c721ae9 100644 --- a/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java +++ b/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java @@ -8,10 +8,15 @@ import lombok.EqualsAndHashCode; public class UserNotFoundException extends RuntimeException { Integer id; String username; - + String message; public UserNotFoundException(Integer id, String username){ super(); this.id = id; this.username = username; } + + public UserNotFoundException(String message){ + super(); + this.message = message; + } } diff --git a/src/main/java/com/codesdream/ase/model/activity/Activity.java b/src/main/java/com/codesdream/ase/model/activity/Activity.java index 6359756..4da4f56 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Activity.java +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -129,6 +129,7 @@ public class Activity { //计划开始时间 @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(nullable = false) private Period planPeriod; //实际开始时间 @@ -154,11 +155,11 @@ public class Activity { private Set assistManagers; //是否开始 - @Column//(name = "is_on", nullable = false) + @Column(name = "is_on", nullable = false) boolean isOn; //是否结束 - @Column//(name = "is_off", nullable = false) + @Column(name = "is_off", nullable = false) boolean isOff; //考勤安排 diff --git a/src/main/java/com/codesdream/ase/model/activity/UserActivity.java b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java index b1acab7..01add89 100644 --- a/src/main/java/com/codesdream/ase/model/activity/UserActivity.java +++ b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java @@ -18,7 +18,7 @@ public class UserActivity { //关联的用户 @OneToOne(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY, mappedBy = "userActivity") - @JoinColumn(nullable = false) + @JoinColumn(nullable = false, unique = true) private User user; //主要负责的活动 diff --git a/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java b/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java new file mode 100644 index 0000000..80ff99c --- /dev/null +++ b/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java @@ -0,0 +1,14 @@ +package com.codesdream.ase.repository.activity; + +import com.codesdream.ase.model.activity.UserActivity; +import com.codesdream.ase.model.permission.User; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface UserActivityRepository extends CrudRepository { + + UserActivity findByUser(User user); +} diff --git a/src/main/java/com/codesdream/ase/validator/ActivityValidator.java b/src/main/java/com/codesdream/ase/validator/ActivityValidator.java new file mode 100644 index 0000000..2d8b4bf --- /dev/null +++ b/src/main/java/com/codesdream/ase/validator/ActivityValidator.java @@ -0,0 +1,17 @@ +package com.codesdream.ase.validator; + +import com.codesdream.ase.model.activity.Activity; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +//检查当前活动各属性值是否合法(存在) +@Component +public class ActivityValidator { + + public String[] check(Map parameterMap){ + return null; + } +} diff --git a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java b/src/main/java/com/codesdream/ase/validator/WebFormValidator.java index e710ce3..6ffaac0 100644 --- a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java +++ b/src/main/java/com/codesdream/ase/validator/WebFormValidator.java @@ -11,7 +11,7 @@ public class WebFormValidator { public boolean check(Collection stdForm, Map webFormMap){ Collection webForm = webFormMap.keySet(); - if(stdForm.containsAll(webForm)){ + if(webForm.containsAll(stdForm)){ return true; } return false; From 4916dea8913764bef7346f7a58318ff94b027846 Mon Sep 17 00:00:00 2001 From: Vindicator645 <45960487+Vindicator645@users.noreply.github.com> Date: Sun, 15 Mar 2020 20:25:42 +0800 Subject: [PATCH 02/19] Leaving --- .../json/request/UserLeaveRequest.java | 7 +++++ .../ase/controller/LeavesController.java | 26 ++++++------------- .../codesdream/ase/model/leaves/Leave.java | 12 ++++++++- 3 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/json/request/UserLeaveRequest.java diff --git a/src/main/java/com/codesdream/ase/component/json/request/UserLeaveRequest.java b/src/main/java/com/codesdream/ase/component/json/request/UserLeaveRequest.java new file mode 100644 index 0000000..485c0ce --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/request/UserLeaveRequest.java @@ -0,0 +1,7 @@ +package com.codesdream.ase.component.json.request; + +public class UserLeaveRequest { + + + +} diff --git a/src/main/java/com/codesdream/ase/controller/LeavesController.java b/src/main/java/com/codesdream/ase/controller/LeavesController.java index 8694283..9ad7eb1 100644 --- a/src/main/java/com/codesdream/ase/controller/LeavesController.java +++ b/src/main/java/com/codesdream/ase/controller/LeavesController.java @@ -2,11 +2,10 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.json.request.UserLeaveRequest; import com.codesdream.ase.component.json.respond.FailedSONRespond; import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; import com.codesdream.ase.component.permission.ASEUsernameEncoder; -import com.codesdream.ase.component.json.request.UserLeaveChecker; -import com.codesdream.ase.component.json.respond.UserLeaveCheckerJSONRespond; import com.codesdream.ase.service.LeavesService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; @@ -41,31 +40,22 @@ public class LeavesController { return "Leave"; } + //提交请假申请 @RequestMapping(value = "/Leave/check", method = RequestMethod.POST) @ResponseBody - String checkLeave(HttpServletRequest request){ + String requestLeave(HttpServletRequest request){ // 检查是否为JSON Optional json = jsonParameter.getJSONByRequest(request); if(!json.isPresent()) return jsonParameter.getJSONString(new FailedSONRespond()); - UserLeaveChecker LeaveChecker = json.get().toJavaObject(UserLeaveChecker.class); + UserLeaveRequest LeaveChecker = json.get().toJavaObject(UserLeaveRequest.class); // 检查类型 - if(LeaveChecker.getCheckType().equals("UsernameExistChecker")){ - // 根据学号计算用户名 - String user = usernameEncoder.encode(LeaveChecker.getUsername()) ; - // 查询用户名存在状态 - boolean existStatus = userService.checkIfUserExists(user).getKey(); - // 构造返回对象 - UserLeaveCheckerJSONRespond respond = new UserLeaveCheckerJSONRespond(); - respond.setUserExist(existStatus); - return jsonParameter.getJSONString(respond); - } - else { - // 返回失败对象 - return jsonParameter.getJSONString(new JSONBaseRespondObject()); - } + } + //列出某辅导员待审核名单 + + //列出某人 } diff --git a/src/main/java/com/codesdream/ase/model/leaves/Leave.java b/src/main/java/com/codesdream/ase/model/leaves/Leave.java index 80a00ae..5cf3b32 100644 --- a/src/main/java/com/codesdream/ase/model/leaves/Leave.java +++ b/src/main/java/com/codesdream/ase/model/leaves/Leave.java @@ -17,15 +17,25 @@ public class Leave { //审批人容器 @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) private Set userTo; + //请假原因 + @Column + private String reasonToLeave; + + //请假类型 病假,事假等 @Column(name = "type", nullable = false) private String type; //批准状态 @Column(name = "Authentication", nullable = false) - private Boolean Authentication; + private String Authentication; + + //审核备注 + @Column + private String Comment; //开始时间 @Column(nullable = false) private Date startTime; + @Column(nullable = false) private Date endTime; //申请时间 From 3a101a9a39dd103a8502d6801d913b7945b9c30a Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 02:14:28 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E4=BA=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ef36be0..41c87dc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,14 +7,14 @@ spring.thymeleaf.encoding=UTF-8 spring.jpa.generate-ddl=false spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update +spring.jpa.hibernate.ddl-auto=none spring.jooq.sql-dialect=org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.open-in-view=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true -spring.datasource.url=jdbc:mysql://${MYSQL_HOST:119.23.9.34}:3306/ase?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://${MYSQL_HOST:39.100.94.111}:3306/ase?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=codedream -spring.datasource.password=codedreampasswd +spring.datasource.password=zP1+LKi?,{Kyv)uyYgd8 server.error.whitelabel.enabled=false From e1f25720c04e11c9ad9ab55e6e9246494a10046d Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 14:22:50 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E4=BA=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=B8=BAMariaDB=EF=BC=9B=E6=B7=BB=E5=8A=A0Ma?= =?UTF-8?q?riaDB=E9=A9=B1=E5=8A=A8=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 +++++++ .../ASEUsernamePasswordAuthenticationFilter.java | 2 +- .../codesdream/ase/controller/LoginController.java | 8 ++++---- .../ase/controller/RegisterController.java | 4 ++-- .../ase/service/BaseInformationService.java | 14 +++++++------- src/main/resources/application.properties | 9 +++++---- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index b66f69d..aaa6cb5 100644 --- a/pom.xml +++ b/pom.xml @@ -138,6 +138,13 @@ 1.1.71.android + + org.mariadb.jdbc + mariadb-java-client + 2.5.4 + + + diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java index 7c78ae6..d09f9d2 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java @@ -40,7 +40,7 @@ public class ASEUsernamePasswordAuthenticationFilter extends UsernamePasswordAut String timestamp = request.getHeader("timestamp"); // 检查时间戳是否合理(60秒内) - if(!timestampExpiredChecker.checkTimestampBeforeMaxTime(timestamp, 60)){ + if(timestamp == null || !timestampExpiredChecker.checkTimestampBeforeMaxTime(timestamp, 60)){ throw new AuthenticationServiceException("Timestamp Expired."); } diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index db99311..e9c539c 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -61,11 +61,11 @@ public class LoginController { // 构造返回对象 UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setUserExist(existStatus); - return jsonParameter.getJSONString(respond); + return jsonParameter.getJSONStandardRespond200(respond); } else { // 返回失败对象 - return jsonParameter.getJSONString(new JSONStandardFailedRespond()); + return jsonParameter.getJSONStandardRespond500("Error"); } } @@ -82,11 +82,11 @@ public class LoginController { if(loginChecker.getCheckType().equals("UIDGeneratorChecker")) { UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setRespondInformation(userService.getUsernameByStudentId(loginChecker.getUsername())); - return jsonParameter.getJSONString(respond); + return jsonParameter.getJSONStandardRespond200(respond); } else { // 返回失败对象 - return jsonParameter.getJSONString(new JSONStandardFailedRespond()); + return jsonParameter.getJSONStandardRespond500("Error"); } diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index 01a4835..62ce6b3 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -16,10 +16,10 @@ import java.util.Map; @Controller public class RegisterController { @Resource - UserService userService; + private UserService userService; @Resource - BaseInformationService baseInformationService; + private BaseInformationService baseInformationService; @RequestMapping(value = "/register") String registerView(Model model){ diff --git a/src/main/java/com/codesdream/ase/service/BaseInformationService.java b/src/main/java/com/codesdream/ase/service/BaseInformationService.java index 870a816..072ec94 100644 --- a/src/main/java/com/codesdream/ase/service/BaseInformationService.java +++ b/src/main/java/com/codesdream/ase/service/BaseInformationService.java @@ -20,25 +20,25 @@ import java.util.Vector; public class BaseInformationService implements IBaseInformationService { @Resource - BaseAdministrativeDivisionRepository administrativeDivisionRepository; + private BaseAdministrativeDivisionRepository administrativeDivisionRepository; @Resource - BaseCandidateCategoryRepository candidateCategoryRepository; + private BaseCandidateCategoryRepository candidateCategoryRepository; @Resource - BaseCollegeRepository collegeRepository; + private BaseCollegeRepository collegeRepository; @Resource - BaseEthnicRepository ethnicRepository; + private BaseEthnicRepository ethnicRepository; @Resource - BaseMajorRepository majorRepository; + private BaseMajorRepository majorRepository; @Resource - BasePoliticalStatusRepository politicalStatusRepository; + private BasePoliticalStatusRepository politicalStatusRepository; @Resource - BaseStudentInfoRepository studentInfoRepository; + private BaseStudentInfoRepository studentInfoRepository; @Override public boolean checkAdministrativeDivision(String name) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 41c87dc..8693bdc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,14 +7,15 @@ spring.thymeleaf.encoding=UTF-8 spring.jpa.generate-ddl=false spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=none -spring.jooq.sql-dialect=org.hibernate.dialect.MySQL5InnoDBDialect +spring.jpa.hibernate.ddl-auto=update +spring.jooq.sql-dialect=org.hibernate.dialect.MariaDB102Dialect spring.jpa.open-in-view=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true -spring.datasource.url=jdbc:mysql://${MYSQL_HOST:39.100.94.111}:3306/ase?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.url=jdbc:mariadb://39.100.94.111:3306/ase?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=codedream -spring.datasource.password=zP1+LKi?,{Kyv)uyYgd8 +spring.datasource.password=codedreampasswd +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver server.error.whitelabel.enabled=false From d59880bb473bdc805130fdc71c98120e85210187 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 18:50:10 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0JSON=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD;=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3;=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=BE=85=E5=8A=A9=E4=BF=A1=E6=81=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=9A=84=E4=B8=80=E4=BA=9B=E6=8E=A5=E5=8F=A3;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/datamanager/JSONParameter.java | 38 ------- .../datamanager/QuickJSONRespond.java | 80 ++++++++++++++ .../json/request/UserRegisterChecker.java | 19 ++++ .../json/respond/JSONBaseRespondObject.java | 3 + .../respond/UserLoginCheckerJSONRespond.java | 3 +- .../permission/ASEAccessDeniedHandler.java | 5 +- .../ASEAuthenticationEntryPoint.java | 5 +- .../ASEAuthenticationFailureHandler.java | 13 +-- .../ASEAuthenticationSuccessHandler.java | 7 +- .../ase/controller/LoginController.java | 14 ++- .../ase/controller/RegisterController.java | 103 ++++++++++-------- 11 files changed, 184 insertions(+), 106 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java create mode 100644 src/main/java/com/codesdream/ase/component/json/request/UserRegisterChecker.java diff --git a/src/main/java/com/codesdream/ase/component/datamanager/JSONParameter.java b/src/main/java/com/codesdream/ase/component/datamanager/JSONParameter.java index 3fd6706..dbce1a6 100644 --- a/src/main/java/com/codesdream/ase/component/datamanager/JSONParameter.java +++ b/src/main/java/com/codesdream/ase/component/datamanager/JSONParameter.java @@ -58,44 +58,6 @@ public class JSONParameter { return JSON.toJSONString(object); } - // 根据对象构造获得标准的JSON响应字符串返回 - public String getJSONStandardRespond(Integer status, String msg, Object dataObject){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(status, msg); - respondObject.setData(dataObject); - return getJSONString(respondObject); - } - - // 获得标准的JSON响应字符串返回(404状态) - public String getJSONStandardRespond404(String msg){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(404, msg); - return getJSONString(respondObject); - } - - // 获得标准的JSON响应字符串返回(500状态) - public String getJSONStandardRespond500(String msg){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(500, msg); - return getJSONString(respondObject); - } - - // 获得标准的JSON响应字符串返回(200状态) - public String getJSONStandardRespond200(Object dataObject){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(200, "ok"); - respondObject.setData(dataObject); - return getJSONString(respondObject); - } - - // 获得标准的JSON响应字符串返回(403状态) - public String getJSONStandardRespond403(){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(403, "Forbidden"); - return getJSONString(respondObject); - } - - // 获得标准的JSON响应字符串返回(401状态) - public String getJSONStandardRespond401(){ - JSONBaseRespondObject respondObject = new JSONBaseRespondObject(401, "Unauthorized"); - return getJSONString(respondObject); - } - // 由JSON对象获得对应的Java对象 public T getJavaObject(JSONObject json, Class type){ return json.toJavaObject(type); diff --git a/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java b/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java new file mode 100644 index 0000000..ab2d6ab --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java @@ -0,0 +1,80 @@ +package com.codesdream.ase.component.datamanager; + +import com.codesdream.ase.component.json.respond.EmptyDataObjectRespond; +import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + + +@Component +public class QuickJSONRespond { + @Resource + private JSONParameter jsonParameter; + + // 根据对象构造获得标准的JSON响应字符串返回 + public String getJSONStandardRespond(Integer status, String msg, String info, Object dataObject){ + JSONBaseRespondObject respondObject = new JSONBaseRespondObject(status, msg); + if(info != null) respondObject.setInfo(info); + else respondObject.setInfo(null); + + respondObject.setData(dataObject); + return jsonParameter.getJSONString(respondObject); + } + + // 获得标准的JSON响应字符串返回特定状态码的和解释息 + public String getJSONStandardRespond(Integer code, String msg, String info){ + JSONBaseRespondObject respondObject = new JSONBaseRespondObject(code, msg); + if(info != null) respondObject.setInfo(info); + else respondObject.setInfo(null); + respondObject.setData(null); + return jsonParameter.getJSONString(respondObject); + } + + // 获得标准的JSON响应字符串返回(404状态) + public String getRespond404(String info){ + return getJSONStandardRespond(404, "Not Found", info); + } + + // 获得标准的JSON响应字符串返回(500状态) + public String getRespond500(String info){ + return getJSONStandardRespond(500, "Internal Server Error", info); + } + + // 获得标准的JSON响应字符串返回(200状态) + public String getRespond200(String info){ + return getJSONStandardRespond(200, "Ok", info); + } + + // 获得标准的JSON响应字符串返回(200状态) + public String getRespond200(String info, Object object){ + return getJSONStandardRespond(200, "Ok", info, object); + } + + // 获得标准的JSON响应字符串返回(403状态) + public String getRespond403(String info){ + return getJSONStandardRespond(403, "Forbidden", info); + } + + // 获得标准的JSON响应字符串返回(403状态) + public String getRespond406(String info){ + return getJSONStandardRespond(406, "Not Acceptable", info); + } + + // 获得标准的JSON响应字符串返回(501态) + public String getRespond501(String info){ + return getJSONStandardRespond(501, "Not Implemented", info) ; + } + + // 获得标准的JSON响应字符串返回(401状态) + public String getRespond401(String info){ + return getJSONStandardRespond(401, "Unauthorized", info); + } + + // 获得标准的JSON响应字符串返回(400状态) + public String getRespond400(String info){ + return getJSONStandardRespond(400, "Bad Request", info); + } + + +} diff --git a/src/main/java/com/codesdream/ase/component/json/request/UserRegisterChecker.java b/src/main/java/com/codesdream/ase/component/json/request/UserRegisterChecker.java new file mode 100644 index 0000000..491cda6 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/request/UserRegisterChecker.java @@ -0,0 +1,19 @@ +package com.codesdream.ase.component.json.request; + +import lombok.Data; + +@Data +public class UserRegisterChecker { + + // 学号 + private String studentId; + + // 密码 + private String password; + + // 密保问题 + private String userQuestion; + + // 密保答案 + private String userAnswer; +} diff --git a/src/main/java/com/codesdream/ase/component/json/respond/JSONBaseRespondObject.java b/src/main/java/com/codesdream/ase/component/json/respond/JSONBaseRespondObject.java index f180023..d1a2d2f 100644 --- a/src/main/java/com/codesdream/ase/component/json/respond/JSONBaseRespondObject.java +++ b/src/main/java/com/codesdream/ase/component/json/respond/JSONBaseRespondObject.java @@ -17,6 +17,9 @@ public class JSONBaseRespondObject extends JSONBaseObject { // 存放响应信息提示 private String msg = ""; + // 额外信息 + private String info = null; + // 状态 private Integer status = 200; diff --git a/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java b/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java index 208851a..6cbaeed 100644 --- a/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java +++ b/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java @@ -9,7 +9,8 @@ public class UserLoginCheckerJSONRespond { Boolean userExist = null; Boolean userBanned = null; Boolean loginStatus = null; - String respondInformation = ""; + String respondInformation = null; String token = null; + String uid = null; } diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java b/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java index 67955f5..48405bb 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java @@ -1,6 +1,7 @@ package com.codesdream.ase.component.permission; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.AccessDeniedException; @@ -19,7 +20,7 @@ import java.io.IOException; public class ASEAccessDeniedHandler implements AccessDeniedHandler { @Resource - private JSONParameter jsonParameter; + private QuickJSONRespond quickJSONRespond; @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) @@ -27,7 +28,7 @@ public class ASEAccessDeniedHandler implements AccessDeniedHandler { log.info("ASEAccessDeniedHandler Found!"); // 对无权限操作返回403 - response.getWriter().print(jsonParameter.getJSONStandardRespond403()); + response.getWriter().print(quickJSONRespond.getRespond403(null)); } diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java index b367794..2fe9434 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java @@ -1,6 +1,7 @@ package com.codesdream.ase.component.permission; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import lombok.extern.slf4j.Slf4j; @@ -19,13 +20,13 @@ import java.io.IOException; @Component public class ASEAuthenticationEntryPoint implements AuthenticationEntryPoint { @Resource - private JSONParameter jsonParameter; + private QuickJSONRespond quickJSONRespond; @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { // 对匿名用户返回401 - response.getWriter().print(jsonParameter.getJSONStandardRespond401()); + response.getWriter().print(quickJSONRespond.getRespond401(null)); } } diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java index 393d591..6516911 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java @@ -1,6 +1,7 @@ package com.codesdream.ase.component.permission; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; @@ -19,21 +20,15 @@ import java.io.IOException; public class ASEAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { @Resource - private JSONParameter jsonParameter; + private QuickJSONRespond quickJSONRespond; @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException { log.info("ASEAuthenticationFailureHandler Login Fail!"); - UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); - respond.setUserExist(null); - respond.setUserBanned(null); - respond.setLoginStatus(false); - respond.setRespondInformation("Authentication Failed"); - - // 填充response对象 - response.getWriter().write(jsonParameter.getJSONStandardRespond200(respond)); + // 认证失败返回406 + response.getWriter().write(quickJSONRespond.getRespond406("Authentication Failure")); } } diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java index 9abed5f..857e4b5 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java @@ -2,6 +2,7 @@ package com.codesdream.ase.component.permission; import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import com.codesdream.ase.model.permission.User; @@ -27,7 +28,7 @@ import java.util.Optional; @Component public class ASEAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { @Resource - private JSONParameter jsonParameter; + private QuickJSONRespond quickJSONRespond; @Resource private IAuthService authService; @@ -40,7 +41,6 @@ public class ASEAuthenticationSuccessHandler extends SavedRequestAwareAuthentica UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setUserExist(authentication.isAuthenticated()); respond.setLoginStatus(authentication.isAuthenticated()); - respond.setRespondInformation("Authentication Success"); // 获得 JSONTokenAuthenticationToken JSONTokenAuthenticationToken authenticationToken = (JSONTokenAuthenticationToken) authentication; @@ -55,7 +55,8 @@ public class ASEAuthenticationSuccessHandler extends SavedRequestAwareAuthentica } else respond.setToken(""); - response.getWriter().write(jsonParameter.getJSONStandardRespond200(respond)); + // 认证成功返回200 + response.getWriter().write(quickJSONRespond.getRespond200("Authentication Success", respond)); } } diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index e9c539c..eb319aa 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -2,6 +2,7 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond; import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; import com.codesdream.ase.component.permission.ASEUsernameEncoder; @@ -30,6 +31,9 @@ public class LoginController { @Resource private JSONParameter jsonParameter; + @Resource + private QuickJSONRespond quickJSONRespond; + @Resource private IUserService userService; @@ -61,11 +65,11 @@ public class LoginController { // 构造返回对象 UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setUserExist(existStatus); - return jsonParameter.getJSONStandardRespond200(respond); + return quickJSONRespond.getRespond200(null, respond); } else { // 返回失败对象 - return jsonParameter.getJSONStandardRespond500("Error"); + return quickJSONRespond.getRespond400("CheckType Mismatch"); } } @@ -81,12 +85,12 @@ public class LoginController { if(loginChecker.getCheckType().equals("UIDGeneratorChecker")) { UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); - respond.setRespondInformation(userService.getUsernameByStudentId(loginChecker.getUsername())); - return jsonParameter.getJSONStandardRespond200(respond); + respond.setUid(userService.getUsernameByStudentId(loginChecker.getUsername())); + return quickJSONRespond.getRespond200(null, respond); } else { // 返回失败对象 - return jsonParameter.getJSONStandardRespond500("Error"); + return quickJSONRespond.getRespond400("CheckType Mismatch"); } diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index 62ce6b3..acfd087 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -1,5 +1,8 @@ package com.codesdream.ase.controller; +import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.json.request.UserRegisterChecker; import com.codesdream.ase.model.information.BaseStudentInfo; import com.codesdream.ase.model.permission.User; import com.codesdream.ase.service.BaseInformationService; @@ -8,10 +11,11 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.util.Map; +import java.util.Optional; @Controller public class RegisterController { @@ -21,61 +25,68 @@ public class RegisterController { @Resource private BaseInformationService baseInformationService; + @Resource + private JSONParameter jsonParameter; + + @Resource + private QuickJSONRespond quickJSONRespond; + @RequestMapping(value = "/register") String registerView(Model model){ return "register"; } // 处理注册表单 - @PostMapping(value = "/register") - String doRegister(Model model, HttpServletRequest request){ - Map parameterMap= request.getParameterMap(); + @PostMapping(value = "/register/do_register") + @ResponseBody + String doRegister(HttpServletRequest request){ - // 进行处理前的检查 - if(parameterMap.containsKey("student-id") - && parameterMap.containsKey("password") - && parameterMap.containsKey("retry-password") - && parameterMap.containsKey("user-question") - && parameterMap.containsKey("user-answer") - ) { - // 获得提交学号 - String student_id = parameterMap.get("student-id")[0].toString(); - // 获得密保问题 - String user_question = parameterMap.get("user-question")[0].toString(); - // 获得密保答案 - String user_answer = parameterMap.get("user-answer")[0].toString(); - - // 检查用户的基本信息是否录入系统 - if(!baseInformationService.checkStudentInfo(student_id)) - throw new RuntimeException("Student ID Not Found In Base Information Service"); - - // 查找对应的基本信息 - BaseStudentInfo studentInfo = baseInformationService.findStudentInfoByStudentId(student_id); - - // 根据基本信息生成对应用户 - User user = userService.getUserByStudentInfo(studentInfo); - - // 填充密保问题 - user.getUserAuth().setUserQuestion(user_question); - user.getUserAuth().setUserAnswer(user_answer); - user.getUserAuth().setMail(""); - - String password = parameterMap.get("password")[0].toString(); - String retry_password = parameterMap.get("retry-password")[0].toString(); - - if (password.equals(retry_password)) { - user.setPassword(password); - userService.save(user); - // 返回登录界面 - return "login"; - } - else{ - throw new RuntimeException("Retry Password Not Correct"); - } + Optional registerCheckerOptional = + jsonParameter.getJavaObjectByRequest(request, UserRegisterChecker.class); + // 检查JSON是否完整 + if(!registerCheckerOptional.isPresent()){ + return quickJSONRespond.getRespond400("Illegal JSON Format"); } - return "register"; + // 检查数据是否完整 + UserRegisterChecker registerChecker = registerCheckerOptional.get(); + if(registerChecker.getPassword() == null + || registerChecker.getStudentId() == null + || registerChecker.getUserAnswer() == null + || registerChecker.getUserQuestion() == null){ + return quickJSONRespond.getRespond400("Incomplete Data"); + } + + // 获得提交学号 + String student_id = registerChecker.getStudentId(); + // 获得密保问题 + String user_question = registerChecker.getUserQuestion(); + // 获得密保答案 + String user_answer = registerChecker.getUserAnswer(); + + // 检查用户的基本信息是否录入系统 + if(!baseInformationService.checkStudentInfo(student_id)) + return quickJSONRespond.getRespond500("StudentID Already Used"); + + // 查找对应的基本信息 + BaseStudentInfo studentInfo = baseInformationService.findStudentInfoByStudentId(student_id); + + // 根据基本信息生成对应用户 + User user = userService.getUserByStudentInfo(studentInfo); + + // 填充密保问题 + user.getUserAuth().setUserQuestion(user_question); + user.getUserAuth().setUserAnswer(user_answer); + user.getUserAuth().setMail(""); + + String password = registerChecker.getPassword(); + + user.setPassword(password); + userService.save(user); + + // 成功注册 + return quickJSONRespond.getRespond200("Register Success"); } } From 3dc1c08ac371052e92d7de2bdf949a64b6c00858 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 18:57:19 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E5=B7=B2=E6=B3=A8=E5=86=8C=E5=AD=A6?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/codesdream/ase/controller/RegisterController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index acfd087..77b126b 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -67,7 +67,12 @@ public class RegisterController { // 检查用户的基本信息是否录入系统 if(!baseInformationService.checkStudentInfo(student_id)) + return quickJSONRespond.getRespond500("StudentID Base Information Not Found"); + + // 检查学号是否已被注册 + if(userService.checkIfUserExists(userService.getUsernameByStudentId(student_id)).getKey()){ return quickJSONRespond.getRespond500("StudentID Already Used"); + } // 查找对应的基本信息 BaseStudentInfo studentInfo = baseInformationService.findStudentInfoByStudentId(student_id); From d6b443c754cd501892e0d2f9f55c20f8e198993d Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 19:39:37 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E8=B0=83=E6=95=B4;=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E7=99=BB=E5=BD=95=E6=A3=80=E6=9F=A5=E6=B5=81=E7=A8=8B?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../json/respond/ErrorInfoJSONRespond.java | 12 +++++++ .../ASEAuthenticationEntryPoint.java | 3 +- .../ASEAuthenticationFailureHandler.java | 14 +++++++- .../ASESecurityAuthenticationProvider.java | 4 +-- ...EUsernamePasswordAuthenticationFilter.java | 20 +++++++---- .../ase/controller/ASEControllerAdvice.java | 20 +++++++---- .../ase/controller/ASEErrorController.java | 35 ++++++++++++++++++- .../ase/service/ASEUserDetailsService.java | 15 +++++--- 8 files changed, 101 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/json/respond/ErrorInfoJSONRespond.java diff --git a/src/main/java/com/codesdream/ase/component/json/respond/ErrorInfoJSONRespond.java b/src/main/java/com/codesdream/ase/component/json/respond/ErrorInfoJSONRespond.java new file mode 100644 index 0000000..4495e20 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/respond/ErrorInfoJSONRespond.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.component.json.respond; + +import lombok.Data; + +import java.util.Date; + +@Data +public class ErrorInfoJSONRespond { + String exception = null; + String exceptionMessage = null; + Date date = null; +} diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java index 2fe9434..b3f5962 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java @@ -24,7 +24,8 @@ public class ASEAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) - throws IOException, ServletException { + throws IOException { + // 对匿名用户返回401 response.getWriter().print(quickJSONRespond.getRespond401(null)); diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java index 6516911..ee82950 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java @@ -2,6 +2,7 @@ package com.codesdream.ase.component.permission; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; @@ -13,6 +14,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Date; // 认证失败返回 @Slf4j @@ -28,7 +30,17 @@ public class ASEAuthenticationFailureHandler extends SimpleUrlAuthenticationFail { log.info("ASEAuthenticationFailureHandler Login Fail!"); + // 填写异常信息存储对象 + ErrorInfoJSONRespond errorInfoJSONRespond = new ErrorInfoJSONRespond(); + errorInfoJSONRespond.setDate(new Date()); + errorInfoJSONRespond.setExceptionMessage(exception.getMessage()); + errorInfoJSONRespond.setException(exception.getClass().getSimpleName()); + // 认证失败返回406 - response.getWriter().write(quickJSONRespond.getRespond406("Authentication Failure")); + response.getWriter().write(quickJSONRespond.getJSONStandardRespond( + 406, + "Not Acceptable", + "Authentication Failure", + errorInfoJSONRespond)); } } diff --git a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java b/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java index 7ba70ca..61edbd5 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java @@ -43,10 +43,8 @@ public class ASESecurityAuthenticationProvider implements AuthenticationProvider // 判断用户是否存在 UserDetails userInfo = userDetailsService.loadUserByUsername(username); - log.info(String.format("SecurityAuthentication: %s %s", username, password)); - if (userInfo == null) { - throw new UsernameNotFoundException("User IS Not Existing"); + throw new UsernameNotFoundException("User Not Exist"); } // 判断密码是否正确 diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java index d09f9d2..6f6acb0 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java @@ -49,16 +49,24 @@ public class ASEUsernamePasswordAuthenticationFilter extends UsernamePasswordAut throw new AuthenticationServiceException("Authentication method not supported: NOT Ajax Method."); } - Optional checker = jsonParameter.getJavaObjectByRequest(request, UserLoginChecker.class); - if(!checker.isPresent()) throw new BadCredentialsException("Invalid AJAX JSON Request"); + Optional checkerOptional = jsonParameter.getJavaObjectByRequest(request, UserLoginChecker.class); + if(!checkerOptional.isPresent()) throw new BadCredentialsException("Invalid AJAX JSON Request"); - if (!checker.get().getCheckType().equals("UsernamePasswordChecker")) + UserLoginChecker checker = checkerOptional.get(); + + if(checker.getUsername() == null + || checker.getPassword() == null + || checker.getClientCode() == null + || checker.getCheckType() == null) + throw new AuthenticationServiceException("Request Data IS Incomplete"); + + if (!checker.getCheckType().equals("UsernamePasswordChecker")) throw new AuthenticationServiceException("Authentication not supported: NOT Username Password Type."); // 获得相应的用户名密码 - String username = checker.get().getUsername(); - String password = checker.get().getPassword(); - String clientCode = checker.get().getClientCode(); + String username = checker.getUsername(); + String password = checker.getPassword(); + String clientCode = checker.getClientCode(); if (username == null) username = ""; if (password == null) password = ""; diff --git a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java index d5166ff..332f5ba 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java +++ b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java @@ -1,23 +1,31 @@ package com.codesdream.ase.controller; import com.codesdream.ase.component.error.ErrorResponse; +import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.core.AuthenticationException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.context.request.WebRequest; import java.util.ArrayList; +import java.util.Date; import java.util.List; -@ControllerAdvice +@RestControllerAdvice public class ASEControllerAdvice { @ExceptionHandler(value = {RuntimeException.class}) - public final ResponseEntity handleRuntimeException(RuntimeException e, WebRequest webRequest){ - List details = new ArrayList<>(); - details.add(e.getLocalizedMessage()); - ErrorResponse errorResponse = new ErrorResponse("Runtime Error", details); - return new ResponseEntity<>(errorResponse, HttpStatus.INTERNAL_SERVER_ERROR); + public final Object handleRuntimeException(RuntimeException e, WebRequest webRequest){ + ErrorInfoJSONRespond errorInfoJSONRespond = new ErrorInfoJSONRespond(); + errorInfoJSONRespond.setDate(new Date()); + errorInfoJSONRespond.setExceptionMessage(e.getMessage()); + errorInfoJSONRespond.setException(e.getClass().getName()); + return errorInfoJSONRespond; } + + } diff --git a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java index 124294f..ab33dc1 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java +++ b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java @@ -1,6 +1,8 @@ package com.codesdream.ase.controller; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.error.ErrorResponse; +import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -9,8 +11,10 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.request.WebRequest; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.Date; @@ -19,7 +23,7 @@ import java.util.List; @Controller public class ASEErrorController implements ErrorController { - @RequestMapping("/error") +/* @RequestMapping("/error") public String handleError(HttpServletRequest request, Model model){ Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception"); @@ -49,7 +53,36 @@ public class ASEErrorController implements ErrorController { model.addAttribute("exception_date", new Date()); } return "error"; + }*/ + @Resource + private QuickJSONRespond quickJSONRespond; + + @RequestMapping("/error") + @ResponseBody + public String handleError(HttpServletRequest request){ + Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); + Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception"); + + // 检查返回的状态 + if (statusCode == HttpStatus.NOT_FOUND.value()) return quickJSONRespond.getRespond404(null); + ErrorInfoJSONRespond errorInfoJSONRespond = new ErrorInfoJSONRespond(); + + // 检查是否含有引发异常 + if (exception.getCause() == null) { + errorInfoJSONRespond.setException(exception.getClass().getName()); + errorInfoJSONRespond.setExceptionMessage(exception.getMessage()); + } else { + errorInfoJSONRespond.setException(exception.getCause().getClass().getName()); + errorInfoJSONRespond.setExceptionMessage(exception.getCause().getMessage()); + } + errorInfoJSONRespond.setDate(new Date()); + + return quickJSONRespond.getJSONStandardRespond( + statusCode, + "Error Controller Handle", + null, + errorInfoJSONRespond); } @Override diff --git a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java index 411bcbb..2d9a666 100644 --- a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java +++ b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java @@ -1,7 +1,9 @@ package com.codesdream.ase.service; import com.codesdream.ase.component.permission.UserAuthoritiesGenerator; +import com.codesdream.ase.exception.UserNotFoundException; import com.codesdream.ase.model.permission.User; +import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -21,9 +23,14 @@ public class ASEUserDetailsService implements UserDetailsService { @Override @Transactional - public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { - User user = userService.findUserByUsername(s); - user.setAuthorities(userAuthoritiesGenerator.grantedAuthorities(user)); - return user; + public UserDetails loadUserByUsername(String s) { + try { + User user = userService.findUserByUsername(s); + user.setAuthorities(userAuthoritiesGenerator.grantedAuthorities(user)); + return user; + } catch (UserNotFoundException e){ + throw new AuthenticationServiceException("User Not Exist"); + } + } } From 47d724163ffec5104b910597dbca4684b1d790b3 Mon Sep 17 00:00:00 2001 From: Vindicator645 <45960487+Vindicator645@users.noreply.github.com> Date: Tue, 17 Mar 2020 19:57:17 +0800 Subject: [PATCH 08/19] jason --- .../java/com/codesdream/ase/controller/LeavesController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/codesdream/ase/controller/LeavesController.java b/src/main/java/com/codesdream/ase/controller/LeavesController.java index 9ad7eb1..6b19fc6 100644 --- a/src/main/java/com/codesdream/ase/controller/LeavesController.java +++ b/src/main/java/com/codesdream/ase/controller/LeavesController.java @@ -47,11 +47,12 @@ public class LeavesController { // 检查是否为JSON Optional json = jsonParameter.getJSONByRequest(request); - if(!json.isPresent()) return jsonParameter.getJSONString(new FailedSONRespond()); + // if(!json.isPresent()) return jsonParameter.getJSONString(new FailedSONRespond()); UserLeaveRequest LeaveChecker = json.get().toJavaObject(UserLeaveRequest.class); // 检查类型 + return jsonParameter.getJSONString(request); } //列出某辅导员待审核名单 From 27ebd6205ad6b9cafde0e1d7a2d489a54d83c25b Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 17 Mar 2020 23:50:53 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/ASEJSONTokenAuthenticationFilter.java | 6 ------ .../codesdream/ase/controller/LeavesController.java | 6 ++---- .../codesdream/ase/controller/LoginController.java | 2 -- .../java/com/codesdream/ase/model/leaves/Leave.java | 11 ++++++----- .../ase/repository/leaves/LeaveRepository.java | 3 +-- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java index a518944..e8c0585 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java @@ -30,15 +30,9 @@ import java.util.Optional; @Slf4j public class ASEJSONTokenAuthenticationFilter extends OncePerRequestFilter { - @Resource - private JSONParameter jsonParameter; - @Resource private JSONRandomCodeGenerator randomCodeGenerator; - @Resource - private AJAXRequestChecker ajaxRequestChecker; - @Resource private AuthService authService; diff --git a/src/main/java/com/codesdream/ase/controller/LeavesController.java b/src/main/java/com/codesdream/ase/controller/LeavesController.java index 6b19fc6..a415cf2 100644 --- a/src/main/java/com/codesdream/ase/controller/LeavesController.java +++ b/src/main/java/com/codesdream/ase/controller/LeavesController.java @@ -3,8 +3,6 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.json.request.UserLeaveRequest; -import com.codesdream.ase.component.json.respond.FailedSONRespond; -import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; import com.codesdream.ase.component.permission.ASEUsernameEncoder; import com.codesdream.ase.service.LeavesService; import lombok.extern.slf4j.Slf4j; @@ -35,13 +33,13 @@ public class LeavesController { @Resource private ASEUsernameEncoder usernameEncoder; - @RequestMapping(value = "/") + @RequestMapping(value = "/leave") String printLeave(Model model) { return "Leave"; } //提交请假申请 - @RequestMapping(value = "/Leave/check", method = RequestMethod.POST) + @RequestMapping(value = "/leave/check", method = RequestMethod.POST) @ResponseBody String requestLeave(HttpServletRequest request){ diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index eb319aa..2c9ee57 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -37,8 +37,6 @@ public class LoginController { @Resource private IUserService userService; - @Resource - private ASEUsernameEncoder usernameEncoder; @RequestMapping(value = "/login") String printLogin(Model model) { diff --git a/src/main/java/com/codesdream/ase/model/leaves/Leave.java b/src/main/java/com/codesdream/ase/model/leaves/Leave.java index 5cf3b32..e5ef606 100644 --- a/src/main/java/com/codesdream/ase/model/leaves/Leave.java +++ b/src/main/java/com/codesdream/ase/model/leaves/Leave.java @@ -4,9 +4,10 @@ import com.codesdream.ase.model.permission.User; import lombok.Data; import java.util.*; import javax.persistence.*; + @Data @Entity -@Table(name = "leave") +@Table(name = "leaves") public class Leave { @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -23,15 +24,15 @@ public class Leave { //请假类型 病假,事假等 - @Column(name = "type", nullable = false) + @Column(nullable = false) private String type; //批准状态 - @Column(name = "Authentication", nullable = false) - private String Authentication; + @Column(nullable = false) + private String authentication; //审核备注 @Column - private String Comment; + private String comment; //开始时间 @Column(nullable = false) private Date startTime; diff --git a/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java b/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java index 5ea51c1..ee238b0 100644 --- a/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java +++ b/src/main/java/com/codesdream/ase/repository/leaves/LeaveRepository.java @@ -7,6 +7,5 @@ import java.util.Optional; public interface LeaveRepository extends CrudRepository{ - Optional findByTitle(String title) ; - Optional findByCreator(String creatorName); + } From a64d65a70e3c5533107f4c79f865a7e483c1873b Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 18 Mar 2020 18:50:35 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BC=A0=E8=BE=93=E6=94=AF=E6=8C=81;=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=8C=96=E6=94=AF=E6=8C=81;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 + .../ase/component/auth/SHA1Encoder.java | 4 +- .../ase/component/datamanager/StringFile.java | 12 + .../datamanager/StringFileGenerator.java | 92 + .../ase/controller/LoginController.java | 2 - .../ase/controller/RegisterController.java | 2 +- .../exception/StringFileConvertException.java | 12 + .../ase/model/information/BaseMajor.java | 2 +- .../information/BaseMajorRepository.java | 2 +- .../codesdream/ase/service/IUserService.java | 2 +- .../codesdream/ase/service/UserService.java | 7 +- .../resources/application-test.properties | 24 + src/main/resources/application.properties | 2 - ...tus.sql => data_base_political_status.sql} | 0 src/main/resources/import.sql | 4456 +++++++++++++++++ .../codesdream/ase/test/DataManagerTest.java | 35 + .../com/codesdream/ase/test/UserTest.java | 24 +- 17 files changed, 4664 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/datamanager/StringFile.java create mode 100644 src/main/java/com/codesdream/ase/component/datamanager/StringFileGenerator.java create mode 100644 src/main/java/com/codesdream/ase/exception/StringFileConvertException.java create mode 100644 src/main/resources/application-test.properties rename src/main/resources/{base_political_status.sql => data_base_political_status.sql} (100%) diff --git a/pom.xml b/pom.xml index aaa6cb5..a550983 100644 --- a/pom.xml +++ b/pom.xml @@ -144,6 +144,12 @@ 2.5.4 + + com.h2database + h2 + runtime + + diff --git a/src/main/java/com/codesdream/ase/component/auth/SHA1Encoder.java b/src/main/java/com/codesdream/ase/component/auth/SHA1Encoder.java index e3102d2..9216ab9 100644 --- a/src/main/java/com/codesdream/ase/component/auth/SHA1Encoder.java +++ b/src/main/java/com/codesdream/ase/component/auth/SHA1Encoder.java @@ -7,11 +7,11 @@ import org.springframework.stereotype.Component; // SHA1算法不可逆加密 主要用于JSON签名 @Component public class SHA1Encoder { - String encode(CharSequence charSequence){ + public String encode(CharSequence charSequence){ return DigestUtils.sha1Hex(charSequence.toString()); } - boolean match(CharSequence charSequence, String s){ + public boolean match (CharSequence charSequence, String s){ return s.equals(encode(charSequence)); } } diff --git a/src/main/java/com/codesdream/ase/component/datamanager/StringFile.java b/src/main/java/com/codesdream/ase/component/datamanager/StringFile.java new file mode 100644 index 0000000..7ef0f5e --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/datamanager/StringFile.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.component.datamanager; + +import lombok.Data; + +// 储存字符串标识的文件,并可以转换为json进行传输 +@Data +public class StringFile { + private String strData = null; + private String sha1Checker = null; + private Integer size = null; + private String type = "none"; +} diff --git a/src/main/java/com/codesdream/ase/component/datamanager/StringFileGenerator.java b/src/main/java/com/codesdream/ase/component/datamanager/StringFileGenerator.java new file mode 100644 index 0000000..a64fd32 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/datamanager/StringFileGenerator.java @@ -0,0 +1,92 @@ +package com.codesdream.ase.component.datamanager; + +import com.codesdream.ase.component.auth.SHA1Encoder; +import com.codesdream.ase.exception.StringFileConvertException; +import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.*; +import java.util.Base64; +import java.util.Optional; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +// 将文件处理成可发送的字符串文件对象 +@Component +public class StringFileGenerator { + + @Resource + private SHA1Encoder encoder; + + // 用过读入流创建一个字符串文件 + public Optional generateStringFile(InputStream stream){ + StringFile file = new StringFile(); + // 字符串内容计算 + file.setStrData(generateFile2String(stream)); + if(file.getStrData() == null) return Optional.empty(); + // 相关校验值计算 + file.setSha1Checker(generateSHA1Checker(file.getStrData())); + file.setSize(file.getStrData().length()); + return Optional.of(file); + } + + private byte[] readSteamAll(InputStream stream) { + try { + byte[] bytes = new byte[stream.available()]; + + //检查文件书否完全读取 + if (stream.read(bytes) != bytes.length) return null; + else return bytes; + } catch (IOException e){ + return null; + } + } + + private String generateFile2String(InputStream stream){ + ByteArrayOutputStream zipDataStream = new ByteArrayOutputStream(); + try { + GZIPOutputStream gzipOutputStream = new GZIPOutputStream(zipDataStream); + byte[] bytes = readSteamAll(stream); + if(bytes == null) return null; + gzipOutputStream.write(bytes); + gzipOutputStream.close(); + return Base64.getEncoder().encodeToString(zipDataStream.toByteArray()); + } catch (IOException e) { + return null; + } + } + + // 生成字符串文件的校验码 + private String generateSHA1Checker(String str){ + return encoder.encode(str); + } + + // 检查文件内容是否正确,包括大小与校验码 + public boolean checkStringFile(StringFile file){ + return file.getStrData().length() == file.getSize() + && encoder.match(file.getStrData(), file.getSha1Checker()); + } + + // 从字符串文件中读取真实的文件数据 + public InputStream readFileString(StringFile file){ + try { + // 字符串转换为二进制数据 + byte[] bytes = Base64.getDecoder().decode(file.getStrData()); + GZIPInputStream stream = new GZIPInputStream(new ByteArrayInputStream(bytes), bytes.length); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + + // 数据解压缩 + int readBits = 0; + byte[] rawBytes = new byte[1024]; + while ((readBits = stream.read(rawBytes)) != -1) { + outputStream.write(rawBytes, 0, readBits); + } + + stream.close(); + return new ByteArrayInputStream(outputStream.toByteArray()); + } catch (IOException e) { + throw new StringFileConvertException("Read FileString Failed"); + } + } +} diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index 2c9ee57..bc04afe 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -90,8 +90,6 @@ public class LoginController { // 返回失败对象 return quickJSONRespond.getRespond400("CheckType Mismatch"); } - - } diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index 77b126b..88b4827 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -78,7 +78,7 @@ public class RegisterController { BaseStudentInfo studentInfo = baseInformationService.findStudentInfoByStudentId(student_id); // 根据基本信息生成对应用户 - User user = userService.getUserByStudentInfo(studentInfo); + User user = userService.createUserByStudentInfo(studentInfo); // 填充密保问题 user.getUserAuth().setUserQuestion(user_question); diff --git a/src/main/java/com/codesdream/ase/exception/StringFileConvertException.java b/src/main/java/com/codesdream/ase/exception/StringFileConvertException.java new file mode 100644 index 0000000..86675c1 --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/StringFileConvertException.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.exception; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class StringFileConvertException extends RuntimeException { + public StringFileConvertException(String msg){ + super(msg); + } +} diff --git a/src/main/java/com/codesdream/ase/model/information/BaseMajor.java b/src/main/java/com/codesdream/ase/model/information/BaseMajor.java index 8de7cf5..1bc53ba 100644 --- a/src/main/java/com/codesdream/ase/model/information/BaseMajor.java +++ b/src/main/java/com/codesdream/ase/model/information/BaseMajor.java @@ -12,7 +12,7 @@ import javax.persistence.*; @Table(name = "base_major") public class BaseMajor { @Id - private int id; + private String id; private String name; } diff --git a/src/main/java/com/codesdream/ase/repository/information/BaseMajorRepository.java b/src/main/java/com/codesdream/ase/repository/information/BaseMajorRepository.java index a5d1f34..9282167 100644 --- a/src/main/java/com/codesdream/ase/repository/information/BaseMajorRepository.java +++ b/src/main/java/com/codesdream/ase/repository/information/BaseMajorRepository.java @@ -7,6 +7,6 @@ import org.springframework.stereotype.Repository; import java.util.Optional; @Repository -public interface BaseMajorRepository extends CrudRepository { +public interface BaseMajorRepository extends CrudRepository { Optional findByName(String name); } diff --git a/src/main/java/com/codesdream/ase/service/IUserService.java b/src/main/java/com/codesdream/ase/service/IUserService.java index 06281f4..ad3a01e 100644 --- a/src/main/java/com/codesdream/ase/service/IUserService.java +++ b/src/main/java/com/codesdream/ase/service/IUserService.java @@ -16,7 +16,7 @@ public interface IUserService { User getDefaultUser(); // 由学生基本信息生成对应用户 - User getUserByStudentInfo(BaseStudentInfo studentInfo); + User createUserByStudentInfo(BaseStudentInfo studentInfo); List findAll(); diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index e09ad09..bad45eb 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -97,14 +97,13 @@ public class UserService implements IUserService { if(userRepository.findByUsername(user.getUsername()).isPresent()) throw new UsernameAlreadyExistException(user.getUsername()); - // 用户信息一般性规范检查 + // 用户关键信息一般性规范检查 if(user.getUserAuth().getUserAnswer() == null || user.getUserAuth().getUserQuestion() == null || user.getUserAuth().getStudentID() == null || user.getUserDetail().getRealName() == null || user.getUserAuth().getMail() == null){ - - throw new RuntimeException("Key Information IS NULL"); + throw new RuntimeException("Some Key Information IS NULL"); } @@ -145,7 +144,7 @@ public class UserService implements IUserService { } @Override - public User getUserByStudentInfo(BaseStudentInfo studentInfo) { + public User createUserByStudentInfo(BaseStudentInfo studentInfo) { User user = getDefaultUser(); // 根据学生id生成用户名 generateRandomUsernameByStudentID(user, studentInfo.getStudentId()); diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties new file mode 100644 index 0000000..aa149bd --- /dev/null +++ b/src/main/resources/application-test.properties @@ -0,0 +1,24 @@ +server.port=8080 + +spring.thymeleaf.prefix=classpath:templates/ +spring.thymeleaf.suffix=.html +spring.thymeleaf.mode=HTML +spring.thymeleaf.encoding=UTF-8 + +spring.jpa.generate-ddl=false +spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=create-drop +spring.jooq.sql-dialect=org.hibernate.dialect.MariaDB102Dialect +spring.jpa.open-in-view=true +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true + +spring.datasource.url=jdbc:h2:mem:test +spring.datasource.username= +spring.datasource.password= +spring.datasource.driver-class-name=org.h2.Driver + + +server.error.whitelabel.enabled=false + +logging.level.root=info +logging.level.org.springframework.security=info diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8693bdc..0a91e8b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,5 +21,3 @@ server.error.whitelabel.enabled=false logging.level.root=info logging.level.org.springframework.security=info - -server.servlet.session.timeout=30m diff --git a/src/main/resources/base_political_status.sql b/src/main/resources/data_base_political_status.sql similarity index 100% rename from src/main/resources/base_political_status.sql rename to src/main/resources/data_base_political_status.sql diff --git a/src/main/resources/import.sql b/src/main/resources/import.sql index e69de29..b95a9a2 100644 --- a/src/main/resources/import.sql +++ b/src/main/resources/import.sql @@ -0,0 +1,4456 @@ +-- ---------------------------- +-- Records of base_administrative_division +-- ---------------------------- +INSERT INTO `base_administrative_division` VALUES ('000000', '未知', '0'); +INSERT INTO `base_administrative_division` VALUES ('110000', '北京市', '0'); +INSERT INTO `base_administrative_division` VALUES ('110100', '北京市市辖区', '110000'); +INSERT INTO `base_administrative_division` VALUES ('110101', '北京市东城区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110102', '北京市西城区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110105', '北京市朝阳区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110106', '北京市丰台区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110107', '北京市石景山区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110108', '北京市海淀区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110109', '北京市门头沟区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110111', '北京市房山区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110112', '北京市通州区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110113', '北京市顺义区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110114', '北京市昌平区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110115', '北京市大兴区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110116', '北京市怀柔区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110117', '北京市平谷区', '110100'); +INSERT INTO `base_administrative_division` VALUES ('110200', '北京市县', '110000'); +INSERT INTO `base_administrative_division` VALUES ('110228', '北京市密云县', '110200'); +INSERT INTO `base_administrative_division` VALUES ('110229', '北京市延庆县', '110200'); +INSERT INTO `base_administrative_division` VALUES ('120000', '天津市', '0'); +INSERT INTO `base_administrative_division` VALUES ('120100', '天津市市辖区', '120000'); +INSERT INTO `base_administrative_division` VALUES ('120101', '天津市和平区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120102', '天津市河东区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120103', '天津市河西区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120104', '天津市南开区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120105', '天津市河北区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120106', '天津市红桥区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120110', '天津市东丽区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120111', '天津市西青区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120112', '天津市津南区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120113', '天津市北辰区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120114', '天津市武清区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120115', '天津市宝坻区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120116', '天津市滨海新区', '120100'); +INSERT INTO `base_administrative_division` VALUES ('120200', '天津市县', '120000'); +INSERT INTO `base_administrative_division` VALUES ('120221', '天津市宁河县', '120200'); +INSERT INTO `base_administrative_division` VALUES ('120223', '天津市静海县', '120200'); +INSERT INTO `base_administrative_division` VALUES ('120225', '天津市蓟县', '120200'); +INSERT INTO `base_administrative_division` VALUES ('130000', '河北省', '0'); +INSERT INTO `base_administrative_division` VALUES ('130100', '河北省石家庄市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130101', '河北省石家庄市市辖区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130102', '河北省石家庄市长安区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130103', '河北省石家庄市桥东区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130104', '河北省石家庄市桥西区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130105', '河北省石家庄市新华区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130107', '河北省石家庄市井陉矿区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130108', '河北省石家庄市裕华区', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130121', '河北省井陉县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130123', '河北省正定县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130124', '河北省栾城县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130125', '河北省行唐县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130126', '河北省灵寿县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130127', '河北省高邑县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130128', '河北省深泽县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130129', '河北省赞皇县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130130', '河北省无极县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130131', '河北省平山县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130132', '河北省元氏县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130133', '河北省赵县', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130181', '河北省辛集市', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130182', '河北省藁城市', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130183', '河北省晋州市', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130184', '河北省新乐市', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130185', '河北省鹿泉市', '130100'); +INSERT INTO `base_administrative_division` VALUES ('130200', '河北省唐山市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130201', '河北省唐山市市辖区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130202', '河北省唐山市路南区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130203', '河北省唐山市路北区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130204', '河北省唐山市古冶区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130205', '河北省唐山市开平区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130207', '河北省唐山市丰南区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130208', '河北省唐山市丰润区', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130223', '河北省滦县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130224', '河北省滦南县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130225', '河北省乐亭县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130227', '河北省迁西县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130229', '河北省玉田县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130230', '河北省唐海县', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130281', '河北省遵化市', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130283', '河北省迁安市', '130200'); +INSERT INTO `base_administrative_division` VALUES ('130300', '河北省秦皇岛市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130301', '河北省秦皇岛市市辖区', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130302', '河北省秦皇岛市海港区', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130303', '河北省秦皇岛市山海关区', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130304', '河北省秦皇岛市北戴河区', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130321', '河北省青龙满族自治县', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130322', '河北省昌黎县', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130323', '河北省抚宁县', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130324', '河北省卢龙县', '130300'); +INSERT INTO `base_administrative_division` VALUES ('130400', '河北省邯郸市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130401', '河北省邯郸市市辖区', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130402', '河北省邯郸市邯山区', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130403', '河北省邯郸市丛台区', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130404', '河北省邯郸市复兴区', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130406', '河北省邯郸市峰峰矿区', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130421', '河北省邯郸县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130423', '河北省临漳县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130424', '河北省成安县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130425', '河北省大名县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130426', '河北省涉县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130427', '河北省磁县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130428', '河北省肥乡县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130429', '河北省永年县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130430', '河北省邱县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130431', '河北省鸡泽县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130432', '河北省广平县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130433', '河北省馆陶县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130434', '河北省魏县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130435', '河北省曲周县', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130481', '河北省武安市', '130400'); +INSERT INTO `base_administrative_division` VALUES ('130500', '河北省邢台市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130501', '河北省邢台市市辖区', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130502', '河北省邢台市桥东区', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130503', '河北省邢台市桥西区', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130521', '河北省邢台县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130522', '河北省临城县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130523', '河北省内丘县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130524', '河北省柏乡县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130525', '河北省隆尧县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130526', '河北省任县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130527', '河北省南和县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130528', '河北省宁晋县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130529', '河北省巨鹿县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130530', '河北省新河县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130531', '河北省广宗县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130532', '河北省平乡县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130533', '河北省威县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130534', '河北省清河县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130535', '河北省临西县', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130581', '河北省南宫市', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130582', '河北省沙河市', '130500'); +INSERT INTO `base_administrative_division` VALUES ('130600', '河北省保定市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130601', '河北省保定市市辖区', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130602', '河北省保定市新市区', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130603', '河北省保定市北市区', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130604', '河北省保定市南市区', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130621', '河北省满城县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130622', '河北省清苑县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130623', '河北省涞水县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130624', '河北省阜平县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130625', '河北省徐水县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130626', '河北省定兴县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130627', '河北省唐县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130628', '河北省高阳县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130629', '河北省容城县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130630', '河北省涞源县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130631', '河北省望都县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130632', '河北省安新县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130633', '河北省易县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130634', '河北省曲阳县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130635', '河北省蠡县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130636', '河北省顺平县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130637', '河北省博野县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130638', '河北省雄县', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130681', '河北省涿州市', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130682', '河北省定州市', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130683', '河北省安国市', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130684', '河北省高碑店市', '130600'); +INSERT INTO `base_administrative_division` VALUES ('130700', '河北省张家口市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130701', '河北省张家口市市辖区', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130702', '河北省张家口市桥东区', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130703', '河北省张家口市桥西区', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130705', '河北省张家口市宣化区', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130706', '河北省张家口市下花园区', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130721', '河北省宣化县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130722', '河北省张北县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130723', '河北省康保县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130724', '河北省沽源县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130725', '河北省尚义县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130726', '河北省蔚县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130727', '河北省阳原县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130728', '河北省怀安县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130729', '河北省万全县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130730', '河北省怀来县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130731', '河北省涿鹿县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130732', '河北省赤城县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130733', '河北省崇礼县', '130700'); +INSERT INTO `base_administrative_division` VALUES ('130800', '河北省承德市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130801', '河北省承德市市辖区', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130802', '河北省承德市双桥区', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130803', '河北省承德市双滦区', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130804', '河北省承德市鹰手营子矿区', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130821', '河北省承德县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130822', '河北省兴隆县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130823', '河北省平泉县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130824', '河北省滦平县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130825', '河北省隆化县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130826', '河北省丰宁满族自治县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130827', '河北省宽城满族自治县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130828', '河北省围场满族蒙古族自治县', '130800'); +INSERT INTO `base_administrative_division` VALUES ('130900', '河北省沧州市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('130901', '河北省沧州市市辖区', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130902', '河北省沧州市新华区', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130903', '河北省沧州市运河区', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130921', '河北省沧县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130922', '河北省青县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130923', '河北省东光县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130924', '河北省海兴县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130925', '河北省盐山县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130926', '河北省肃宁县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130927', '河北省南皮县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130928', '河北省吴桥县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130929', '河北省献县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130930', '河北省孟村回族自治县', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130981', '河北省泊头市', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130982', '河北省任丘市', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130983', '河北省黄骅市', '130900'); +INSERT INTO `base_administrative_division` VALUES ('130984', '河北省河间市', '130900'); +INSERT INTO `base_administrative_division` VALUES ('131000', '河北省廊坊市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('131001', '河北省廊坊市市辖区', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131002', '河北省廊坊市安次区', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131003', '河北省廊坊市广阳区', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131022', '河北省固安县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131023', '河北省永清县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131024', '河北省香河县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131025', '河北省大城县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131026', '河北省文安县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131028', '河北省大厂回族自治县', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131081', '河北省霸州市', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131082', '河北省三河市', '131000'); +INSERT INTO `base_administrative_division` VALUES ('131100', '河北省衡水市', '130000'); +INSERT INTO `base_administrative_division` VALUES ('131101', '河北省衡水市市辖区', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131102', '河北省衡水市桃城区', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131121', '河北省枣强县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131122', '河北省武邑县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131123', '河北省武强县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131124', '河北省饶阳县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131125', '河北省安平县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131126', '河北省故城县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131127', '河北省景县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131128', '河北省阜城县', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131181', '河北省冀州市', '131100'); +INSERT INTO `base_administrative_division` VALUES ('131182', '河北省深州市', '131100'); +INSERT INTO `base_administrative_division` VALUES ('140000', '山西省', '0'); +INSERT INTO `base_administrative_division` VALUES ('140100', '山西省太原市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140101', '山西省太原市市辖区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140105', '山西省太原市小店区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140106', '山西省太原市迎泽区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140107', '山西省太原市杏花岭区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140108', '山西省太原市尖草坪区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140109', '山西省太原市万柏林区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140110', '山西省太原市晋源区', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140121', '山西省清徐县', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140122', '山西省阳曲县', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140123', '山西省娄烦县', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140181', '山西省古交市', '140100'); +INSERT INTO `base_administrative_division` VALUES ('140200', '山西省大同市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140201', '山西省大同市市辖区', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140202', '山西省大同市城区', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140203', '山西省大同市矿区', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140211', '山西省大同市南郊区', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140212', '山西省大同市新荣区', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140221', '山西省阳高县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140222', '山西省天镇县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140223', '山西省广灵县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140224', '山西省灵丘县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140225', '山西省浑源县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140226', '山西省左云县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140227', '山西省大同县', '140200'); +INSERT INTO `base_administrative_division` VALUES ('140300', '山西省阳泉市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140301', '山西省阳泉市市辖区', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140302', '山西省阳泉市城区', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140303', '山西省阳泉市矿区', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140311', '山西省阳泉市郊区', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140321', '山西省平定县', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140322', '山西省盂县', '140300'); +INSERT INTO `base_administrative_division` VALUES ('140400', '山西省长治市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140401', '山西省长治市市辖区', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140402', '山西省长治市城区', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140411', '山西省长治市郊区', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140421', '山西省长治县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140423', '山西省襄垣县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140424', '山西省屯留县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140425', '山西省平顺县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140426', '山西省黎城县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140427', '山西省壶关县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140428', '山西省长子县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140429', '山西省武乡县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140430', '山西省沁县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140431', '山西省沁源县', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140481', '山西省潞城市', '140400'); +INSERT INTO `base_administrative_division` VALUES ('140500', '山西省晋城市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140501', '山西省晋城市市辖区', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140502', '山西省晋城市城区', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140521', '山西省沁水县', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140522', '山西省阳城县', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140524', '山西省陵川县', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140525', '山西省泽州县', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140581', '山西省高平市', '140500'); +INSERT INTO `base_administrative_division` VALUES ('140600', '山西省朔州市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140601', '山西省朔州市市辖区', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140602', '山西省朔州市朔城区', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140603', '山西省朔州市平鲁区', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140621', '山西省山阴县', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140622', '山西省应县', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140623', '山西省右玉县', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140624', '山西省怀仁县', '140600'); +INSERT INTO `base_administrative_division` VALUES ('140700', '山西省晋中市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140701', '山西省晋中市市辖区', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140702', '山西省晋中市榆次区', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140721', '山西省榆社县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140722', '山西省左权县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140723', '山西省和顺县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140724', '山西省昔阳县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140725', '山西省寿阳县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140726', '山西省太谷县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140727', '山西省祁县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140728', '山西省平遥县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140729', '山西省灵石县', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140781', '山西省介休市', '140700'); +INSERT INTO `base_administrative_division` VALUES ('140800', '山西省运城市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140801', '山西省运城市市辖区', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140802', '山西省运城市盐湖区', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140821', '山西省临猗县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140822', '山西省万荣县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140823', '山西省闻喜县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140824', '山西省稷山县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140825', '山西省新绛县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140826', '山西省绛县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140827', '山西省垣曲县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140828', '山西省夏县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140829', '山西省平陆县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140830', '山西省芮城县', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140881', '山西省永济市', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140882', '山西省河津市', '140800'); +INSERT INTO `base_administrative_division` VALUES ('140900', '山西省忻州市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('140901', '山西省忻州市市辖区', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140902', '山西省忻州市忻府区', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140921', '山西省定襄县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140922', '山西省五台县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140923', '山西省代县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140924', '山西省繁峙县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140925', '山西省宁武县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140926', '山西省静乐县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140927', '山西省神池县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140928', '山西省五寨县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140929', '山西省岢岚县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140930', '山西省河曲县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140931', '山西省保德县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140932', '山西省偏关县', '140900'); +INSERT INTO `base_administrative_division` VALUES ('140981', '山西省原平市', '140900'); +INSERT INTO `base_administrative_division` VALUES ('141000', '山西省临汾市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('141001', '山西省临汾市市辖区', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141002', '山西省临汾市尧都区', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141021', '山西省曲沃县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141022', '山西省翼城县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141023', '山西省襄汾县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141024', '山西省洪洞县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141025', '山西省古县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141026', '山西省安泽县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141027', '山西省浮山县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141028', '山西省吉县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141029', '山西省乡宁县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141030', '山西省大宁县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141031', '山西省隰县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141032', '山西省永和县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141033', '山西省蒲县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141034', '山西省汾西县', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141081', '山西省侯马市', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141082', '山西省霍州市', '141000'); +INSERT INTO `base_administrative_division` VALUES ('141100', '山西省吕梁市', '140000'); +INSERT INTO `base_administrative_division` VALUES ('141101', '山西省吕梁市市辖区', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141102', '山西省吕梁市离石区', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141121', '山西省文水县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141122', '山西省交城县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141123', '山西省兴县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141124', '山西省临县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141125', '山西省柳林县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141126', '山西省石楼县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141127', '山西省岚县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141128', '山西省方山县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141129', '山西省中阳县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141130', '山西省交口县', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141181', '山西省孝义市', '141100'); +INSERT INTO `base_administrative_division` VALUES ('141182', '山西省汾阳市', '141100'); +INSERT INTO `base_administrative_division` VALUES ('150000', '内蒙古自治区', '0'); +INSERT INTO `base_administrative_division` VALUES ('150100', '内蒙古呼和浩特市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150101', '内蒙古呼和浩特市市辖区', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150102', '内蒙古呼和浩特市新城区', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150103', '内蒙古呼和浩特市回民区', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150104', '内蒙古呼和浩特市玉泉区', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150105', '内蒙古呼和浩特市赛罕区', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150121', '内蒙古土默特左旗', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150122', '内蒙古托克托县', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150123', '内蒙古和林格尔县', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150124', '内蒙古清水河县', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150125', '内蒙古武川县', '150100'); +INSERT INTO `base_administrative_division` VALUES ('150200', '内蒙古包头市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150201', '内蒙古包头市市辖区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150202', '内蒙古包头市东河区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150203', '内蒙古包头市昆都仑区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150204', '内蒙古包头市青山区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150205', '内蒙古包头市石拐区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150206', '内蒙古包头市白云鄂博矿区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150207', '内蒙古包头市九原区', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150221', '内蒙古土默特右旗', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150222', '内蒙古固阳县', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150223', '内蒙古达尔罕茂明安联合旗', '150200'); +INSERT INTO `base_administrative_division` VALUES ('150300', '内蒙古乌海市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150301', '内蒙古乌海市市辖区', '150300'); +INSERT INTO `base_administrative_division` VALUES ('150302', '内蒙古乌海市海勃湾区', '150300'); +INSERT INTO `base_administrative_division` VALUES ('150303', '内蒙古乌海市海南区', '150300'); +INSERT INTO `base_administrative_division` VALUES ('150304', '内蒙古乌海市乌达区', '150300'); +INSERT INTO `base_administrative_division` VALUES ('150400', '内蒙古赤峰市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150401', '内蒙古赤峰市市辖区', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150402', '内蒙古赤峰市红山区', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150403', '内蒙古赤峰市元宝山区', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150404', '内蒙古赤峰市松山区', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150421', '内蒙古阿鲁科尔沁旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150422', '内蒙古巴林左旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150423', '内蒙古巴林右旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150424', '内蒙古林西县', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150425', '内蒙古克什克腾旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150426', '内蒙古翁牛特旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150428', '内蒙古喀喇沁旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150429', '内蒙古宁城县', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150430', '内蒙古敖汉旗', '150400'); +INSERT INTO `base_administrative_division` VALUES ('150500', '内蒙古通辽市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150501', '内蒙古通辽市市辖区', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150502', '内蒙古通辽市科尔沁区', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150521', '内蒙古科尔沁左翼中旗', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150522', '内蒙古科尔沁左翼后旗', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150523', '内蒙古开鲁县', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150524', '内蒙古库伦旗', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150525', '内蒙古奈曼旗', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150526', '内蒙古扎鲁特旗', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150581', '内蒙古霍林郭勒市', '150500'); +INSERT INTO `base_administrative_division` VALUES ('150600', '内蒙古鄂尔多斯市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150601', '内蒙古鄂尔多斯市市辖区', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150602', '内蒙古鄂尔多斯市东胜区', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150621', '内蒙古达拉特旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150622', '内蒙古准格尔旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150623', '内蒙古鄂托克前旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150624', '内蒙古鄂托克旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150625', '内蒙古杭锦旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150626', '内蒙古乌审旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150627', '内蒙古伊金霍洛旗', '150600'); +INSERT INTO `base_administrative_division` VALUES ('150700', '内蒙古呼伦贝尔市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150701', '内蒙古呼伦贝尔市市辖区', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150702', '内蒙古呼伦贝尔市海拉尔区', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150721', '内蒙古阿荣旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150722', '内蒙古莫力达瓦达斡尔族自治旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150723', '内蒙古鄂伦春自治旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150724', '内蒙古鄂温克族自治旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150725', '内蒙古陈巴尔虎旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150726', '内蒙古新巴尔虎左旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150727', '内蒙古新巴尔虎右旗', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150781', '内蒙古满洲里市', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150782', '内蒙古牙克石市', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150783', '内蒙古扎兰屯市', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150784', '内蒙古额尔古纳市', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150785', '内蒙古根河市', '150700'); +INSERT INTO `base_administrative_division` VALUES ('150800', '内蒙古巴彦淖尔市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150801', '内蒙古巴彦淖尔市市辖区', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150802', '内蒙古巴彦淖尔市临河区', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150821', '内蒙古五原县', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150822', '内蒙古磴口县', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150823', '内蒙古乌拉特前旗', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150824', '内蒙古乌拉特中旗', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150825', '内蒙古乌拉特后旗', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150826', '内蒙古杭锦后旗', '150800'); +INSERT INTO `base_administrative_division` VALUES ('150900', '内蒙古乌兰察布市', '150000'); +INSERT INTO `base_administrative_division` VALUES ('150901', '内蒙古乌兰察布市市辖区', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150902', '内蒙古乌兰察布市集宁区', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150921', '内蒙古卓资县', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150922', '内蒙古化德县', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150923', '内蒙古商都县', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150924', '内蒙古兴和县', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150925', '内蒙古凉城县', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150926', '内蒙古察哈尔右翼前旗', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150927', '内蒙古察哈尔右翼中旗', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150928', '内蒙古察哈尔右翼后旗', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150929', '内蒙古四子王旗', '150900'); +INSERT INTO `base_administrative_division` VALUES ('150981', '内蒙古丰镇市', '150900'); +INSERT INTO `base_administrative_division` VALUES ('152200', '内蒙古兴安盟', '150000'); +INSERT INTO `base_administrative_division` VALUES ('152201', '内蒙古乌兰浩特市', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152202', '内蒙古阿尔山市', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152221', '内蒙古科尔沁右翼前旗', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152222', '内蒙古科尔沁右翼中旗', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152223', '内蒙古扎赉特旗', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152224', '内蒙古突泉县', '152200'); +INSERT INTO `base_administrative_division` VALUES ('152500', '内蒙古锡林郭勒盟', '150000'); +INSERT INTO `base_administrative_division` VALUES ('152501', '内蒙古二连浩特市', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152502', '内蒙古锡林浩特市', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152522', '内蒙古阿巴嘎旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152523', '内蒙古苏尼特左旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152524', '内蒙古苏尼特右旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152525', '内蒙古东乌珠穆沁旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152526', '内蒙古西乌珠穆沁旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152527', '内蒙古太仆寺旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152528', '内蒙古镶黄旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152529', '内蒙古正镶白旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152530', '内蒙古正蓝旗', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152531', '内蒙古多伦县', '152500'); +INSERT INTO `base_administrative_division` VALUES ('152900', '内蒙古阿拉善盟', '150000'); +INSERT INTO `base_administrative_division` VALUES ('152921', '内蒙古阿拉善左旗', '152900'); +INSERT INTO `base_administrative_division` VALUES ('152922', '内蒙古阿拉善右旗', '152900'); +INSERT INTO `base_administrative_division` VALUES ('152923', '内蒙古额济纳旗', '152900'); +INSERT INTO `base_administrative_division` VALUES ('210000', '辽宁省', '0'); +INSERT INTO `base_administrative_division` VALUES ('210100', '辽宁省沈阳市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210101', '辽宁省沈阳市市辖区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210102', '辽宁省沈阳市和平区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210103', '辽宁省沈阳市沈河区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210104', '辽宁省沈阳市大东区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210105', '辽宁省沈阳市皇姑区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210106', '辽宁省沈阳市铁西区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210111', '辽宁省沈阳市苏家屯区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210112', '辽宁省沈阳市东陵区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210113', '辽宁省沈阳市沈北新区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210114', '辽宁省沈阳市于洪区', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210122', '辽宁省辽中县', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210123', '辽宁省康平县', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210124', '辽宁省法库县', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210181', '辽宁省新民市', '210100'); +INSERT INTO `base_administrative_division` VALUES ('210200', '辽宁省大连市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210201', '辽宁省大连市市辖区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210202', '辽宁省大连市中山区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210203', '辽宁省大连市西岗区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210204', '辽宁省大连市沙河口区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210211', '辽宁省大连市甘井子区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210212', '辽宁省大连市旅顺口区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210213', '辽宁省大连市金州区', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210224', '辽宁省长海县', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210281', '辽宁省瓦房店市', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210282', '辽宁省普兰店市', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210283', '辽宁省庄河市', '210200'); +INSERT INTO `base_administrative_division` VALUES ('210300', '辽宁省鞍山市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210301', '辽宁省鞍山市市辖区', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210302', '辽宁省鞍山市铁东区', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210303', '辽宁省鞍山市铁西区', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210304', '辽宁省鞍山市立山区', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210311', '辽宁省鞍山市千山区', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210321', '辽宁省台安县', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210323', '辽宁省岫岩满族自治县', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210381', '辽宁省海城市', '210300'); +INSERT INTO `base_administrative_division` VALUES ('210400', '辽宁省抚顺市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210401', '辽宁省抚顺市市辖区', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210402', '辽宁省抚顺市新抚区', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210403', '辽宁省抚顺市东洲区', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210404', '辽宁省抚顺市望花区', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210411', '辽宁省抚顺市顺城区', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210421', '辽宁省抚顺县', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210422', '辽宁省新宾满族自治县', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210423', '辽宁省清原满族自治县', '210400'); +INSERT INTO `base_administrative_division` VALUES ('210500', '辽宁省本溪市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210501', '辽宁省本溪市市辖区', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210502', '辽宁省本溪市平山区', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210503', '辽宁省本溪市溪湖区', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210504', '辽宁省本溪市明山区', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210505', '辽宁省本溪市南芬区', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210521', '辽宁省本溪满族自治县', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210522', '辽宁省桓仁满族自治县', '210500'); +INSERT INTO `base_administrative_division` VALUES ('210600', '辽宁省丹东市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210601', '辽宁省丹东市市辖区', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210602', '辽宁省丹东市元宝区', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210603', '辽宁省丹东市振兴区', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210604', '辽宁省丹东市振安区', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210624', '辽宁省宽甸满族自治县', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210681', '辽宁省东港市', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210682', '辽宁省凤城市', '210600'); +INSERT INTO `base_administrative_division` VALUES ('210700', '辽宁省锦州市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210701', '辽宁省锦州市市辖区', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210702', '辽宁省锦州市古塔区', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210703', '辽宁省锦州市凌河区', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210711', '辽宁省锦州市太和区', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210726', '辽宁省黑山县', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210727', '辽宁省义县', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210781', '辽宁省凌海市', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210782', '辽宁省北镇市', '210700'); +INSERT INTO `base_administrative_division` VALUES ('210800', '辽宁省营口市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210801', '辽宁省营口市市辖区', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210802', '辽宁省营口市站前区', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210803', '辽宁省营口市西市区', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210804', '辽宁省营口市鲅鱼圈区', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210811', '辽宁省营口市老边区', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210881', '辽宁省盖州市', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210882', '辽宁省大石桥市', '210800'); +INSERT INTO `base_administrative_division` VALUES ('210900', '辽宁省阜新市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('210901', '辽宁省阜新市市辖区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210902', '辽宁省阜新市海州区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210903', '辽宁省阜新市新邱区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210904', '辽宁省阜新市太平区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210905', '辽宁省阜新市清河门区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210911', '辽宁省阜新市细河区', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210921', '辽宁省阜新蒙古族自治县', '210900'); +INSERT INTO `base_administrative_division` VALUES ('210922', '辽宁省彰武县', '210900'); +INSERT INTO `base_administrative_division` VALUES ('211000', '辽宁省辽阳市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('211001', '辽宁省辽阳市市辖区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211002', '辽宁省辽阳市白塔区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211003', '辽宁省辽阳市文圣区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211004', '辽宁省辽阳市宏伟区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211005', '辽宁省辽阳市弓长岭区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211011', '辽宁省辽阳市太子河区', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211021', '辽宁省辽阳县', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211081', '辽宁省灯塔市', '211000'); +INSERT INTO `base_administrative_division` VALUES ('211100', '辽宁省盘锦市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('211101', '辽宁省盘锦市市辖区', '211100'); +INSERT INTO `base_administrative_division` VALUES ('211102', '辽宁省盘锦市双台子区', '211100'); +INSERT INTO `base_administrative_division` VALUES ('211103', '辽宁省盘锦市兴隆台区', '211100'); +INSERT INTO `base_administrative_division` VALUES ('211121', '辽宁省大洼县', '211100'); +INSERT INTO `base_administrative_division` VALUES ('211122', '辽宁省盘山县', '211100'); +INSERT INTO `base_administrative_division` VALUES ('211200', '辽宁省铁岭市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('211201', '辽宁省铁岭市市辖区', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211202', '辽宁省铁岭市银州区', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211204', '辽宁省铁岭市清河区', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211221', '辽宁省铁岭县', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211223', '辽宁省西丰县', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211224', '辽宁省昌图县', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211281', '辽宁省调兵山市', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211282', '辽宁省开原市', '211200'); +INSERT INTO `base_administrative_division` VALUES ('211300', '辽宁省朝阳市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('211301', '辽宁省朝阳市市辖区', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211302', '辽宁省朝阳市双塔区', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211303', '辽宁省朝阳市龙城区', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211321', '辽宁省朝阳县', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211322', '辽宁省建平县', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211324', '辽宁省喀喇沁左翼蒙古族自治县', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211381', '辽宁省北票市', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211382', '辽宁省凌源市', '211300'); +INSERT INTO `base_administrative_division` VALUES ('211400', '辽宁省葫芦岛市', '210000'); +INSERT INTO `base_administrative_division` VALUES ('211401', '辽宁省葫芦岛市市辖区', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211402', '辽宁省葫芦岛市连山区', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211403', '辽宁省葫芦岛市龙港区', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211404', '辽宁省葫芦岛市南票区', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211421', '辽宁省绥中县', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211422', '辽宁省建昌县', '211400'); +INSERT INTO `base_administrative_division` VALUES ('211481', '辽宁省兴城市', '211400'); +INSERT INTO `base_administrative_division` VALUES ('220000', '吉林省', '0'); +INSERT INTO `base_administrative_division` VALUES ('220100', '吉林省长春市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220101', '吉林省长春市市辖区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220102', '吉林省长春市南关区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220103', '吉林省长春市宽城区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220104', '吉林省长春市朝阳区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220105', '吉林省长春市二道区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220106', '吉林省长春市绿园区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220112', '吉林省长春市双阳区', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220122', '吉林省农安县', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220181', '吉林省九台市', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220182', '吉林省榆树市', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220183', '吉林省德惠市', '220100'); +INSERT INTO `base_administrative_division` VALUES ('220200', '吉林省吉林市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220201', '吉林省吉林市市辖区', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220202', '吉林省吉林市昌邑区', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220203', '吉林省吉林市龙潭区', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220204', '吉林省吉林市船营区', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220211', '吉林省吉林市丰满区', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220221', '吉林省永吉县', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220281', '吉林省蛟河市', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220282', '吉林省桦甸市', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220283', '吉林省舒兰市', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220284', '吉林省磐石市', '220200'); +INSERT INTO `base_administrative_division` VALUES ('220300', '吉林省四平市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220301', '吉林省四平市市辖区', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220302', '吉林省四平市铁西区', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220303', '吉林省四平市铁东区', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220322', '吉林省梨树县', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220323', '吉林省伊通满族自治县', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220381', '吉林省公主岭市', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220382', '吉林省双辽市', '220300'); +INSERT INTO `base_administrative_division` VALUES ('220400', '吉林省辽源市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220401', '吉林省辽源市市辖区', '220400'); +INSERT INTO `base_administrative_division` VALUES ('220402', '吉林省辽源市龙山区', '220400'); +INSERT INTO `base_administrative_division` VALUES ('220403', '吉林省辽源市西安区', '220400'); +INSERT INTO `base_administrative_division` VALUES ('220421', '吉林省东丰县', '220400'); +INSERT INTO `base_administrative_division` VALUES ('220422', '吉林省东辽县', '220400'); +INSERT INTO `base_administrative_division` VALUES ('220500', '吉林省通化市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220501', '吉林省通化市市辖区', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220502', '吉林省通化市东昌区', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220503', '吉林省通化市二道江区', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220521', '吉林省通化县', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220523', '吉林省辉南县', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220524', '吉林省柳河县', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220581', '吉林省梅河口市', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220582', '吉林省集安市', '220500'); +INSERT INTO `base_administrative_division` VALUES ('220600', '吉林省白山市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220601', '吉林省白山市市辖区', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220602', '吉林省白山市八道江区', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220605', '吉林省白山市江源区', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220621', '吉林省抚松县', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220622', '吉林省靖宇县', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220623', '吉林省长白朝鲜族自治县', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220681', '吉林省临江市', '220600'); +INSERT INTO `base_administrative_division` VALUES ('220700', '吉林省松原市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220701', '吉林省松原市市辖区', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220702', '吉林省松原市宁江区', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220721', '吉林省前郭尔罗斯蒙古族自治县', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220722', '吉林省长岭县', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220723', '吉林省乾安县', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220724', '吉林省扶余县', '220700'); +INSERT INTO `base_administrative_division` VALUES ('220800', '吉林省白城市', '220000'); +INSERT INTO `base_administrative_division` VALUES ('220801', '吉林省白城市市辖区', '220800'); +INSERT INTO `base_administrative_division` VALUES ('220802', '吉林省白城市洮北区', '220800'); +INSERT INTO `base_administrative_division` VALUES ('220821', '吉林省镇赉县', '220800'); +INSERT INTO `base_administrative_division` VALUES ('220822', '吉林省通榆县', '220800'); +INSERT INTO `base_administrative_division` VALUES ('220881', '吉林省洮南市', '220800'); +INSERT INTO `base_administrative_division` VALUES ('220882', '吉林省大安市', '220800'); +INSERT INTO `base_administrative_division` VALUES ('222400', '吉林省延边朝鲜族自治州', '220000'); +INSERT INTO `base_administrative_division` VALUES ('222401', '吉林省延吉市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222402', '吉林省图们市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222403', '吉林省敦化市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222404', '吉林省珲春市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222405', '吉林省龙井市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222406', '吉林省和龙市', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222424', '吉林省汪清县', '222400'); +INSERT INTO `base_administrative_division` VALUES ('222426', '吉林省安图县', '222400'); +INSERT INTO `base_administrative_division` VALUES ('230000', '黑龙江省', '0'); +INSERT INTO `base_administrative_division` VALUES ('230100', '黑龙江省哈尔滨市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230101', '黑龙江省哈尔滨市市辖区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230102', '黑龙江省哈尔滨市道里区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230103', '黑龙江省哈尔滨市南岗区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230104', '黑龙江省哈尔滨市道外区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230108', '黑龙江省哈尔滨市平房区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230109', '黑龙江省哈尔滨市松北区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230110', '黑龙江省哈尔滨市香坊区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230111', '黑龙江省哈尔滨市呼兰区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230112', '黑龙江省哈尔滨市阿城区', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230123', '黑龙江省依兰县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230124', '黑龙江省方正县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230125', '黑龙江省宾县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230126', '黑龙江省巴彦县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230127', '黑龙江省木兰县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230128', '黑龙江省通河县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230129', '黑龙江省延寿县', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230182', '黑龙江省双城市', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230183', '黑龙江省尚志市', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230184', '黑龙江省五常市', '230100'); +INSERT INTO `base_administrative_division` VALUES ('230200', '黑龙江省齐齐哈尔市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230201', '黑龙江省齐齐哈尔市市辖区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230202', '黑龙江省齐齐哈尔市龙沙区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230203', '黑龙江省齐齐哈尔市建华区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230204', '黑龙江省齐齐哈尔市铁锋区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230205', '黑龙江省齐齐哈尔市昂昂溪区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230206', '黑龙江省齐齐哈尔市富拉尔基区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230207', '黑龙江省齐齐哈尔市碾子山区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230208', '黑龙江省齐齐哈尔市梅里斯达斡尔族区', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230221', '黑龙江省龙江县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230223', '黑龙江省依安县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230224', '黑龙江省泰来县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230225', '黑龙江省甘南县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230227', '黑龙江省富裕县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230229', '黑龙江省克山县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230230', '黑龙江省克东县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230231', '黑龙江省拜泉县', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230281', '黑龙江省讷河市', '230200'); +INSERT INTO `base_administrative_division` VALUES ('230300', '黑龙江省鸡西市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230301', '黑龙江省鸡西市市辖区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230302', '黑龙江省鸡西市鸡冠区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230303', '黑龙江省鸡西市恒山区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230304', '黑龙江省鸡西市滴道区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230305', '黑龙江省鸡西市梨树区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230306', '黑龙江省鸡西市城子河区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230307', '黑龙江省鸡西市麻山区', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230321', '黑龙江省鸡东县', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230381', '黑龙江省虎林市', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230382', '黑龙江省密山市', '230300'); +INSERT INTO `base_administrative_division` VALUES ('230400', '黑龙江省鹤岗市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230401', '黑龙江省鹤岗市市辖区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230402', '黑龙江省鹤岗市向阳区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230403', '黑龙江省鹤岗市工农区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230404', '黑龙江省鹤岗市南山区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230405', '黑龙江省鹤岗市兴安区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230406', '黑龙江省鹤岗市东山区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230407', '黑龙江省鹤岗市兴山区', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230421', '黑龙江省萝北县', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230422', '黑龙江省绥滨县', '230400'); +INSERT INTO `base_administrative_division` VALUES ('230500', '黑龙江省双鸭山市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230501', '黑龙江省双鸭山市市辖区', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230502', '黑龙江省双鸭山市尖山区', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230503', '黑龙江省双鸭山市岭东区', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230505', '黑龙江省双鸭山市四方台区', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230506', '黑龙江省双鸭山市宝山区', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230521', '黑龙江省集贤县', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230522', '黑龙江省友谊县', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230523', '黑龙江省宝清县', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230524', '黑龙江省饶河县', '230500'); +INSERT INTO `base_administrative_division` VALUES ('230600', '黑龙江省大庆市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230601', '黑龙江省大庆市市辖区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230602', '黑龙江省大庆市萨尔图区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230603', '黑龙江省大庆市龙凤区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230604', '黑龙江省大庆市让胡路区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230605', '黑龙江省大庆市红岗区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230606', '黑龙江省大庆市大同区', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230621', '黑龙江省肇州县', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230622', '黑龙江省肇源县', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230623', '黑龙江省林甸县', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230624', '黑龙江省杜尔伯特蒙古族自治县', '230600'); +INSERT INTO `base_administrative_division` VALUES ('230700', '黑龙江省伊春市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230701', '黑龙江省伊春市市辖区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230702', '黑龙江省伊春市伊春区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230703', '黑龙江省伊春市南岔区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230704', '黑龙江省伊春市友好区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230705', '黑龙江省伊春市西林区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230706', '黑龙江省伊春市翠峦区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230707', '黑龙江省伊春市新青区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230708', '黑龙江省伊春市美溪区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230709', '黑龙江省伊春市金山屯区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230710', '黑龙江省伊春市五营区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230711', '黑龙江省伊春市乌马河区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230712', '黑龙江省伊春市汤旺河区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230713', '黑龙江省伊春市带岭区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230714', '黑龙江省伊春市乌伊岭区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230715', '黑龙江省伊春市红星区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230716', '黑龙江省伊春市上甘岭区', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230722', '黑龙江省嘉荫县', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230781', '黑龙江省铁力市', '230700'); +INSERT INTO `base_administrative_division` VALUES ('230800', '黑龙江省佳木斯市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230801', '黑龙江省佳木斯市市辖区', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230803', '黑龙江省佳木斯市向阳区', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230804', '黑龙江省佳木斯市前进区', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230805', '黑龙江省佳木斯市东风区', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230811', '黑龙江省佳木斯市郊区', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230822', '黑龙江省桦南县', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230826', '黑龙江省桦川县', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230828', '黑龙江省汤原县', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230833', '黑龙江省抚远县', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230881', '黑龙江省同江市', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230882', '黑龙江省富锦市', '230800'); +INSERT INTO `base_administrative_division` VALUES ('230900', '黑龙江省七台河市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('230901', '黑龙江省七台河市市辖区', '230900'); +INSERT INTO `base_administrative_division` VALUES ('230902', '黑龙江省七台河市新兴区', '230900'); +INSERT INTO `base_administrative_division` VALUES ('230903', '黑龙江省七台河市桃山区', '230900'); +INSERT INTO `base_administrative_division` VALUES ('230904', '黑龙江省七台河市茄子河区', '230900'); +INSERT INTO `base_administrative_division` VALUES ('230921', '黑龙江省勃利县', '230900'); +INSERT INTO `base_administrative_division` VALUES ('231000', '黑龙江省牡丹江市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('231001', '黑龙江省牡丹江市市辖区', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231002', '黑龙江省牡丹江市东安区', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231003', '黑龙江省牡丹江市阳明区', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231004', '黑龙江省牡丹江市爱民区', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231005', '黑龙江省牡丹江市西安区', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231024', '黑龙江省东宁县', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231025', '黑龙江省林口县', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231081', '黑龙江省绥芬河市', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231083', '黑龙江省海林市', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231084', '黑龙江省宁安市', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231085', '黑龙江省穆棱市', '231000'); +INSERT INTO `base_administrative_division` VALUES ('231100', '黑龙江省黑河市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('231101', '黑龙江省黑河市市辖区', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231102', '黑龙江省黑河市爱辉区', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231121', '黑龙江省嫩江县', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231123', '黑龙江省逊克县', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231124', '黑龙江省孙吴县', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231181', '黑龙江省北安市', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231182', '黑龙江省五大连池市', '231100'); +INSERT INTO `base_administrative_division` VALUES ('231200', '黑龙江省绥化市', '230000'); +INSERT INTO `base_administrative_division` VALUES ('231201', '黑龙江省绥化市市辖区', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231202', '黑龙江省绥化市北林区', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231221', '黑龙江省望奎县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231222', '黑龙江省兰西县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231223', '黑龙江省青冈县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231224', '黑龙江省庆安县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231225', '黑龙江省明水县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231226', '黑龙江省绥棱县', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231281', '黑龙江省安达市', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231282', '黑龙江省肇东市', '231200'); +INSERT INTO `base_administrative_division` VALUES ('231283', '黑龙江省海伦市', '231200'); +INSERT INTO `base_administrative_division` VALUES ('232700', '黑龙江省大兴安岭地区', '230000'); +INSERT INTO `base_administrative_division` VALUES ('232721', '黑龙江省呼玛县', '232700'); +INSERT INTO `base_administrative_division` VALUES ('232722', '黑龙江省塔河县', '232700'); +INSERT INTO `base_administrative_division` VALUES ('232723', '黑龙江省漠河县', '232700'); +INSERT INTO `base_administrative_division` VALUES ('310000', '上海市', '0'); +INSERT INTO `base_administrative_division` VALUES ('310100', '上海市市辖区', '310000'); +INSERT INTO `base_administrative_division` VALUES ('310101', '上海市黄浦区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310104', '上海市徐汇区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310105', '上海市长宁区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310106', '上海市静安区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310107', '上海市普陀区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310108', '上海市闸北区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310109', '上海市虹口区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310110', '上海市杨浦区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310112', '上海市闵行区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310113', '上海市宝山区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310114', '上海市嘉定区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310115', '上海市浦东新区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310116', '上海市金山区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310117', '上海市松江区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310118', '上海市青浦区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310120', '上海市奉贤区', '310100'); +INSERT INTO `base_administrative_division` VALUES ('310200', '上海市县', '310000'); +INSERT INTO `base_administrative_division` VALUES ('310230', '上海市崇明县', '310200'); +INSERT INTO `base_administrative_division` VALUES ('320000', '江苏省', '0'); +INSERT INTO `base_administrative_division` VALUES ('320100', '江苏省南京市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320101', '江苏省南京市市辖区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320102', '江苏省南京市玄武区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320103', '江苏省南京市白下区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320104', '江苏省南京市秦淮区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320105', '江苏省南京市建邺区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320106', '江苏省南京市鼓楼区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320107', '江苏省南京市下关区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320111', '江苏省南京市浦口区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320113', '江苏省南京市栖霞区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320114', '江苏省南京市雨花台区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320115', '江苏省南京市江宁区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320116', '江苏省南京市六合区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320117', '江苏省南京市溧水区', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320125', '江苏省高淳县', '320100'); +INSERT INTO `base_administrative_division` VALUES ('320200', '江苏省无锡市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320201', '江苏省无锡市市辖区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320202', '江苏省无锡市崇安区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320203', '江苏省无锡市南长区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320204', '江苏省无锡市北塘区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320205', '江苏省无锡市锡山区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320206', '江苏省无锡市惠山区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320211', '江苏省无锡市滨湖区', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320281', '江苏省江阴市', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320282', '江苏省宜兴市', '320200'); +INSERT INTO `base_administrative_division` VALUES ('320300', '江苏省徐州市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320301', '江苏省徐州市市辖区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320302', '江苏省徐州市鼓楼区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320303', '江苏省徐州市云龙区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320304', '江苏省徐州市九里区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320305', '江苏省徐州市贾汪区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320311', '江苏省徐州市泉山区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320312', '江苏省徐州市铜山区', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320321', '江苏省丰县', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320322', '江苏省沛县', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320324', '江苏省睢宁县', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320381', '江苏省新沂市', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320382', '江苏省邳州市', '320300'); +INSERT INTO `base_administrative_division` VALUES ('320400', '江苏省常州市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320401', '江苏省常州市市辖区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320402', '江苏省常州市天宁区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320404', '江苏省常州市钟楼区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320405', '江苏省常州市戚墅堰区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320411', '江苏省常州市新北区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320412', '江苏省常州市武进区', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320481', '江苏省溧阳市', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320482', '江苏省金坛市', '320400'); +INSERT INTO `base_administrative_division` VALUES ('320500', '江苏省苏州市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320501', '江苏省苏州市市辖区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320502', '江苏省苏州市沧浪区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320503', '江苏省苏州市平江区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320504', '江苏省苏州市金阊区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320505', '江苏省苏州市虎丘区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320506', '江苏省苏州市吴中区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320507', '江苏省苏州市相城区', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320581', '江苏省常熟市', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320582', '江苏省张家港市', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320583', '江苏省昆山市', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320584', '江苏省吴江市', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320585', '江苏省太仓市', '320500'); +INSERT INTO `base_administrative_division` VALUES ('320600', '江苏省南通市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320601', '江苏省南通市市辖区', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320602', '江苏省南通市崇川区', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320611', '江苏省南通市港闸区', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320612', '江苏省南通市通州区', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320621', '江苏省海安县', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320623', '江苏省如东县', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320681', '江苏省启东市', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320682', '江苏省如皋市', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320684', '江苏省海门市', '320600'); +INSERT INTO `base_administrative_division` VALUES ('320700', '江苏省连云港市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320701', '江苏省连云港市市辖区', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320703', '江苏省连云港市连云区', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320705', '江苏省连云港市新浦区', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320706', '江苏省连云港市海州区', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320721', '江苏省赣榆县', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320722', '江苏省东海县', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320723', '江苏省灌云县', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320724', '江苏省灌南县', '320700'); +INSERT INTO `base_administrative_division` VALUES ('320800', '江苏省淮安市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320801', '江苏省淮安市市辖区', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320802', '江苏省淮安市清河区', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320803', '江苏省淮安市楚州区', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320804', '江苏省淮安市淮阴区', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320811', '江苏省淮安市清浦区', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320826', '江苏省涟水县', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320829', '江苏省洪泽县', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320830', '江苏省盱眙县', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320831', '江苏省金湖县', '320800'); +INSERT INTO `base_administrative_division` VALUES ('320900', '江苏省盐城市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('320901', '江苏省盐城市市辖区', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320902', '江苏省盐城市亭湖区', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320903', '江苏省盐城市盐都区', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320921', '江苏省响水县', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320922', '江苏省滨海县', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320923', '江苏省阜宁县', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320924', '江苏省射阳县', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320925', '江苏省建湖县', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320981', '江苏省东台市', '320900'); +INSERT INTO `base_administrative_division` VALUES ('320982', '江苏省大丰市', '320900'); +INSERT INTO `base_administrative_division` VALUES ('321000', '江苏省扬州市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('321001', '江苏省扬州市市辖区', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321002', '江苏省扬州市广陵区', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321003', '江苏省扬州市邗江区', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321012', '江苏省扬州市江都区', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321023', '江苏省宝应县', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321081', '江苏省仪征市', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321084', '江苏省高邮市', '321000'); +INSERT INTO `base_administrative_division` VALUES ('321100', '江苏省镇江市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('321101', '江苏省镇江市市辖区', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321102', '江苏省镇江市京口区', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321111', '江苏省镇江市润州区', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321112', '江苏省镇江市丹徒区', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321181', '江苏省丹阳市', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321182', '江苏省扬中市', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321183', '江苏省句容市', '321100'); +INSERT INTO `base_administrative_division` VALUES ('321200', '江苏省泰州市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('321201', '江苏省泰州市市辖区', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321202', '江苏省泰州市海陵区', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321203', '江苏省泰州市高港区', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321281', '江苏省兴化市', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321282', '江苏省靖江市', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321283', '江苏省泰兴市', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321284', '江苏省姜堰市', '321200'); +INSERT INTO `base_administrative_division` VALUES ('321300', '江苏省宿迁市', '320000'); +INSERT INTO `base_administrative_division` VALUES ('321301', '江苏省宿迁市市辖区', '321300'); +INSERT INTO `base_administrative_division` VALUES ('321302', '江苏省宿迁市宿城区', '321300'); +INSERT INTO `base_administrative_division` VALUES ('321311', '江苏省宿迁市宿豫区', '321300'); +INSERT INTO `base_administrative_division` VALUES ('321322', '江苏省沭阳县', '321300'); +INSERT INTO `base_administrative_division` VALUES ('321323', '江苏省泗阳县', '321300'); +INSERT INTO `base_administrative_division` VALUES ('321324', '江苏省泗洪县', '321300'); +INSERT INTO `base_administrative_division` VALUES ('330000', '浙江省', '0'); +INSERT INTO `base_administrative_division` VALUES ('330100', '浙江省杭州市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330101', '浙江省杭州市市辖区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330102', '浙江省杭州市上城区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330103', '浙江省杭州市下城区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330104', '浙江省杭州市江干区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330105', '浙江省杭州市拱墅区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330106', '浙江省杭州市西湖区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330108', '浙江省杭州市滨江区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330109', '浙江省杭州市萧山区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330110', '浙江省杭州市余杭区', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330122', '浙江省桐庐县', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330127', '浙江省淳安县', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330182', '浙江省建德市', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330183', '浙江省富阳市', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330185', '浙江省临安市', '330100'); +INSERT INTO `base_administrative_division` VALUES ('330200', '浙江省宁波市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330201', '浙江省宁波市市辖区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330203', '浙江省宁波市海曙区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330204', '浙江省宁波市江东区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330205', '浙江省宁波市江北区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330206', '浙江省宁波市北仑区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330211', '浙江省宁波市镇海区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330212', '浙江省宁波市鄞州区', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330225', '浙江省象山县', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330226', '浙江省宁海县', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330281', '浙江省余姚市', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330282', '浙江省慈溪市', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330283', '浙江省奉化市', '330200'); +INSERT INTO `base_administrative_division` VALUES ('330300', '浙江省温州市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330301', '浙江省温州市市辖区', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330302', '浙江省温州市鹿城区', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330303', '浙江省温州市龙湾区', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330304', '浙江省温州市瓯海区', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330322', '浙江省洞头县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330324', '浙江省永嘉县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330326', '浙江省平阳县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330327', '浙江省苍南县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330328', '浙江省文成县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330329', '浙江省泰顺县', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330381', '浙江省瑞安市', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330382', '浙江省乐清市', '330300'); +INSERT INTO `base_administrative_division` VALUES ('330400', '浙江省嘉兴市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330401', '浙江省嘉兴市市辖区', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330402', '浙江省嘉兴市南湖区', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330411', '浙江省嘉兴市秀洲区', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330421', '浙江省嘉善县', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330424', '浙江省海盐县', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330481', '浙江省海宁市', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330482', '浙江省平湖市', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330483', '浙江省桐乡市', '330400'); +INSERT INTO `base_administrative_division` VALUES ('330500', '浙江省湖州市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330501', '浙江省湖州市市辖区', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330502', '浙江省湖州市吴兴区', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330503', '浙江省湖州市南浔区', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330521', '浙江省德清县', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330522', '浙江省长兴县', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330523', '浙江省安吉县', '330500'); +INSERT INTO `base_administrative_division` VALUES ('330600', '浙江省绍兴市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330601', '浙江省绍兴市市辖区', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330602', '浙江省绍兴市越城区', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330621', '浙江省绍兴县', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330624', '浙江省新昌县', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330681', '浙江省诸暨市', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330682', '浙江省上虞市', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330683', '浙江省嵊州市', '330600'); +INSERT INTO `base_administrative_division` VALUES ('330700', '浙江省金华市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330701', '浙江省金华市市辖区', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330702', '浙江省金华市婺城区', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330703', '浙江省金华市金东区', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330723', '浙江省武义县', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330726', '浙江省浦江县', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330727', '浙江省磐安县', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330781', '浙江省兰溪市', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330782', '浙江省义乌市', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330783', '浙江省东阳市', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330784', '浙江省永康市', '330700'); +INSERT INTO `base_administrative_division` VALUES ('330800', '浙江省衢州市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330801', '浙江省衢州市市辖区', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330802', '浙江省衢州市柯城区', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330803', '浙江省衢州市衢江区', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330822', '浙江省常山县', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330824', '浙江省开化县', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330825', '浙江省龙游县', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330881', '浙江省江山市', '330800'); +INSERT INTO `base_administrative_division` VALUES ('330900', '浙江省舟山市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('330901', '浙江省舟山市市辖区', '330900'); +INSERT INTO `base_administrative_division` VALUES ('330902', '浙江省舟山市定海区', '330900'); +INSERT INTO `base_administrative_division` VALUES ('330903', '浙江省舟山市普陀区', '330900'); +INSERT INTO `base_administrative_division` VALUES ('330921', '浙江省岱山县', '330900'); +INSERT INTO `base_administrative_division` VALUES ('330922', '浙江省嵊泗县', '330900'); +INSERT INTO `base_administrative_division` VALUES ('331000', '浙江省台州市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('331001', '浙江省台州市市辖区', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331002', '浙江省台州市椒江区', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331003', '浙江省台州市黄岩区', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331004', '浙江省台州市路桥区', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331021', '浙江省玉环县', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331022', '浙江省三门县', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331023', '浙江省天台县', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331024', '浙江省仙居县', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331081', '浙江省温岭市', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331082', '浙江省临海市', '331000'); +INSERT INTO `base_administrative_division` VALUES ('331100', '浙江省丽水市', '330000'); +INSERT INTO `base_administrative_division` VALUES ('331101', '浙江省丽水市市辖区', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331102', '浙江省丽水市莲都区', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331121', '浙江省青田县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331122', '浙江省缙云县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331123', '浙江省遂昌县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331124', '浙江省松阳县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331125', '浙江省云和县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331126', '浙江省庆元县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331127', '浙江省景宁畲族自治县', '331100'); +INSERT INTO `base_administrative_division` VALUES ('331181', '浙江省龙泉市', '331100'); +INSERT INTO `base_administrative_division` VALUES ('340000', '安徽省', '0'); +INSERT INTO `base_administrative_division` VALUES ('340100', '安徽省合肥市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340101', '安徽省合肥市市辖区', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340102', '安徽省合肥市瑶海区', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340103', '安徽省合肥市庐阳区', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340104', '安徽省合肥市蜀山区', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340111', '安徽省合肥市包河区', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340121', '安徽省长丰县', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340122', '安徽省肥东县', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340123', '安徽省肥西县', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340124', '安徽省庐江县', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340181', '安徽省巢湖市', '340100'); +INSERT INTO `base_administrative_division` VALUES ('340200', '安徽省芜湖市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340201', '安徽省芜湖市市辖区', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340202', '安徽省芜湖市镜湖区', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340203', '安徽省芜湖市弋江区', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340207', '安徽省芜湖市鸠江区', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340208', '安徽省芜湖市三山区', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340221', '安徽省芜湖县', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340222', '安徽省繁昌县', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340223', '安徽省南陵县', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340225', '安徽省无为县', '340200'); +INSERT INTO `base_administrative_division` VALUES ('340300', '安徽省蚌埠市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340301', '安徽省蚌埠市市辖区', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340302', '安徽省蚌埠市龙子湖区', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340303', '安徽省蚌埠市蚌山区', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340304', '安徽省蚌埠市禹会区', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340311', '安徽省蚌埠市淮上区', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340321', '安徽省怀远县', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340322', '安徽省五河县', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340323', '安徽省固镇县', '340300'); +INSERT INTO `base_administrative_division` VALUES ('340400', '安徽省淮南市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340401', '安徽省淮南市市辖区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340402', '安徽省淮南市大通区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340403', '安徽省淮南市田家庵区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340404', '安徽省淮南市谢家集区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340405', '安徽省淮南市八公山区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340406', '安徽省淮南市潘集区', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340421', '安徽省凤台县', '340400'); +INSERT INTO `base_administrative_division` VALUES ('340500', '安徽省马鞍山市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340501', '安徽省马鞍山市市辖区', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340502', '安徽省马鞍山市金家庄区', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340503', '安徽省马鞍山市花山区', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340504', '安徽省马鞍山市雨山区', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340521', '安徽省当涂县', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340522', '安徽省含山县', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340523', '安徽省和县', '340500'); +INSERT INTO `base_administrative_division` VALUES ('340600', '安徽省淮北市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340601', '安徽省淮北市市辖区', '340600'); +INSERT INTO `base_administrative_division` VALUES ('340602', '安徽省淮北市杜集区', '340600'); +INSERT INTO `base_administrative_division` VALUES ('340603', '安徽省淮北市相山区', '340600'); +INSERT INTO `base_administrative_division` VALUES ('340604', '安徽省淮北市烈山区', '340600'); +INSERT INTO `base_administrative_division` VALUES ('340621', '安徽省濉溪县', '340600'); +INSERT INTO `base_administrative_division` VALUES ('340700', '安徽省铜陵市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340701', '安徽省铜陵市市辖区', '340700'); +INSERT INTO `base_administrative_division` VALUES ('340702', '安徽省铜陵市铜官山区', '340700'); +INSERT INTO `base_administrative_division` VALUES ('340703', '安徽省铜陵市狮子山区', '340700'); +INSERT INTO `base_administrative_division` VALUES ('340711', '安徽省铜陵市郊区', '340700'); +INSERT INTO `base_administrative_division` VALUES ('340721', '安徽省铜陵县', '340700'); +INSERT INTO `base_administrative_division` VALUES ('340800', '安徽省安庆市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('340801', '安徽省安庆市市辖区', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340802', '安徽省安庆市迎江区', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340803', '安徽省安庆市大观区', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340811', '安徽省安庆市宜秀区', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340822', '安徽省怀宁县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340823', '安徽省枞阳县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340824', '安徽省潜山县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340825', '安徽省太湖县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340826', '安徽省宿松县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340827', '安徽省望江县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340828', '安徽省岳西县', '340800'); +INSERT INTO `base_administrative_division` VALUES ('340881', '安徽省桐城市', '340800'); +INSERT INTO `base_administrative_division` VALUES ('341000', '安徽省黄山市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341001', '安徽省黄山市市辖区', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341002', '安徽省黄山市屯溪区', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341003', '安徽省黄山市黄山区', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341004', '安徽省黄山市徽州区', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341021', '安徽省歙县', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341022', '安徽省休宁县', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341023', '安徽省黟县', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341024', '安徽省祁门县', '341000'); +INSERT INTO `base_administrative_division` VALUES ('341100', '安徽省滁州市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341101', '安徽省滁州市市辖区', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341102', '安徽省滁州市琅琊区', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341103', '安徽省滁州市南谯区', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341122', '安徽省来安县', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341124', '安徽省全椒县', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341125', '安徽省定远县', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341126', '安徽省凤阳县', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341181', '安徽省天长市', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341182', '安徽省明光市', '341100'); +INSERT INTO `base_administrative_division` VALUES ('341200', '安徽省阜阳市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341201', '安徽省阜阳市市辖区', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341202', '安徽省阜阳市颍州区', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341203', '安徽省阜阳市颍东区', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341204', '安徽省阜阳市颍泉区', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341221', '安徽省临泉县', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341222', '安徽省太和县', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341225', '安徽省阜南县', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341226', '安徽省颍上县', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341282', '安徽省界首市', '341200'); +INSERT INTO `base_administrative_division` VALUES ('341300', '安徽省宿州市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341301', '安徽省宿州市市辖区', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341302', '安徽省宿州市埇桥区', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341321', '安徽省砀山县', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341322', '安徽省萧县', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341323', '安徽省灵璧县', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341324', '安徽省泗县', '341300'); +INSERT INTO `base_administrative_division` VALUES ('341500', '安徽省六安市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341501', '安徽省六安市市辖区', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341502', '安徽省六安市金安区', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341503', '安徽省六安市裕安区', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341504', '安徽省叶集试验区', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341521', '安徽省寿县', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341522', '安徽省霍邱县', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341523', '安徽省舒城县', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341524', '安徽省金寨县', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341525', '安徽省霍山县', '341500'); +INSERT INTO `base_administrative_division` VALUES ('341600', '安徽省亳州市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341601', '安徽省亳州市市辖区', '341600'); +INSERT INTO `base_administrative_division` VALUES ('341602', '安徽省亳州市谯城区', '341600'); +INSERT INTO `base_administrative_division` VALUES ('341621', '安徽省涡阳县', '341600'); +INSERT INTO `base_administrative_division` VALUES ('341622', '安徽省蒙城县', '341600'); +INSERT INTO `base_administrative_division` VALUES ('341623', '安徽省利辛县', '341600'); +INSERT INTO `base_administrative_division` VALUES ('341700', '安徽省池州市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341701', '安徽省池州市市辖区', '341700'); +INSERT INTO `base_administrative_division` VALUES ('341702', '安徽省池州市贵池区', '341700'); +INSERT INTO `base_administrative_division` VALUES ('341721', '安徽省东至县', '341700'); +INSERT INTO `base_administrative_division` VALUES ('341722', '安徽省石台县', '341700'); +INSERT INTO `base_administrative_division` VALUES ('341723', '安徽省青阳县', '341700'); +INSERT INTO `base_administrative_division` VALUES ('341800', '安徽省宣城市', '340000'); +INSERT INTO `base_administrative_division` VALUES ('341801', '安徽省宣城市市辖区', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341802', '安徽省宣城市宣州区', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341821', '安徽省郎溪县', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341822', '安徽省广德县', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341823', '安徽省泾县', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341824', '安徽省绩溪县', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341825', '安徽省旌德县', '341800'); +INSERT INTO `base_administrative_division` VALUES ('341881', '安徽省宁国市', '341800'); +INSERT INTO `base_administrative_division` VALUES ('350000', '福建省', '0'); +INSERT INTO `base_administrative_division` VALUES ('350100', '福建省福州市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350101', '福建省福州市市辖区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350102', '福建省福州市鼓楼区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350103', '福建省福州市台江区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350104', '福建省福州市仓山区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350105', '福建省福州市马尾区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350111', '福建省福州市晋安区', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350121', '福建省闽侯县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350122', '福建省连江县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350123', '福建省罗源县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350124', '福建省闽清县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350125', '福建省永泰县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350128', '福建省平潭县', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350181', '福建省福清市', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350182', '福建省长乐市', '350100'); +INSERT INTO `base_administrative_division` VALUES ('350200', '福建省厦门市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350201', '福建省厦门市市辖区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350203', '福建省厦门市思明区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350205', '福建省厦门市海沧区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350206', '福建省厦门市湖里区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350211', '福建省厦门市集美区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350212', '福建省厦门市同安区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350213', '福建省厦门市翔安区', '350200'); +INSERT INTO `base_administrative_division` VALUES ('350300', '福建省莆田市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350301', '福建省莆田市市辖区', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350302', '福建省莆田市城厢区', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350303', '福建省莆田市涵江区', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350304', '福建省莆田市荔城区', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350305', '福建省莆田市秀屿区', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350322', '福建省仙游县', '350300'); +INSERT INTO `base_administrative_division` VALUES ('350400', '福建省三明市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350401', '福建省三明市市辖区', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350402', '福建省三明市梅列区', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350403', '福建省三明市三元区', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350421', '福建省明溪县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350423', '福建省清流县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350424', '福建省宁化县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350425', '福建省大田县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350426', '福建省尤溪县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350427', '福建省沙县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350428', '福建省将乐县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350429', '福建省泰宁县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350430', '福建省建宁县', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350481', '福建省永安市', '350400'); +INSERT INTO `base_administrative_division` VALUES ('350500', '福建省泉州市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350501', '福建省泉州市市辖区', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350502', '福建省泉州市鲤城区', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350503', '福建省泉州市丰泽区', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350504', '福建省泉州市洛江区', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350505', '福建省泉州市泉港区', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350521', '福建省惠安县', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350524', '福建省安溪县', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350525', '福建省永春县', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350526', '福建省德化县', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350527', '福建省金门县', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350581', '福建省石狮市', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350582', '福建省晋江市', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350583', '福建省南安市', '350500'); +INSERT INTO `base_administrative_division` VALUES ('350600', '福建省漳州市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350601', '福建省漳州市市辖区', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350602', '福建省漳州市芗城区', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350603', '福建省漳州市龙文区', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350622', '福建省云霄县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350623', '福建省漳浦县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350624', '福建省诏安县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350625', '福建省长泰县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350626', '福建省东山县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350627', '福建省南靖县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350628', '福建省平和县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350629', '福建省华安县', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350681', '福建省龙海市', '350600'); +INSERT INTO `base_administrative_division` VALUES ('350700', '福建省南平市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350701', '福建省南平市市辖区', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350702', '福建省南平市延平区', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350721', '福建省顺昌县', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350722', '福建省浦城县', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350723', '福建省光泽县', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350724', '福建省松溪县', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350725', '福建省政和县', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350781', '福建省邵武市', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350782', '福建省武夷山市', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350783', '福建省建瓯市', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350784', '福建省建阳市', '350700'); +INSERT INTO `base_administrative_division` VALUES ('350800', '福建省龙岩市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350801', '福建省龙岩市市辖区', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350802', '福建省龙岩市新罗区', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350821', '福建省长汀县', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350822', '福建省永定县', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350823', '福建省上杭县', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350824', '福建省武平县', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350825', '福建省连城县', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350881', '福建省漳平市', '350800'); +INSERT INTO `base_administrative_division` VALUES ('350900', '福建省宁德市', '350000'); +INSERT INTO `base_administrative_division` VALUES ('350901', '福建省宁德市市辖区', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350902', '福建省宁德市蕉城区', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350921', '福建省霞浦县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350922', '福建省古田县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350923', '福建省屏南县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350924', '福建省寿宁县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350925', '福建省周宁县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350926', '福建省柘荣县', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350981', '福建省福安市', '350900'); +INSERT INTO `base_administrative_division` VALUES ('350982', '福建省福鼎市', '350900'); +INSERT INTO `base_administrative_division` VALUES ('360000', '江西省', '0'); +INSERT INTO `base_administrative_division` VALUES ('360100', '江西省南昌市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360101', '江西省南昌市市辖区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360102', '江西省南昌市东湖区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360103', '江西省南昌市西湖区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360104', '江西省南昌市青云谱区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360105', '江西省南昌市湾里区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360111', '江西省南昌市青山湖区', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360121', '江西省南昌县', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360122', '江西省新建县', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360123', '江西省安义县', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360124', '江西省进贤县', '360100'); +INSERT INTO `base_administrative_division` VALUES ('360200', '江西省景德镇市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360201', '江西省景德镇市市辖区', '360200'); +INSERT INTO `base_administrative_division` VALUES ('360202', '江西省景德镇市昌江区', '360200'); +INSERT INTO `base_administrative_division` VALUES ('360203', '江西省景德镇市珠山区', '360200'); +INSERT INTO `base_administrative_division` VALUES ('360222', '江西省浮梁县', '360200'); +INSERT INTO `base_administrative_division` VALUES ('360281', '江西省乐平市', '360200'); +INSERT INTO `base_administrative_division` VALUES ('360300', '江西省萍乡市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360301', '江西省萍乡市市辖区', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360302', '江西省萍乡市安源区', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360313', '江西省萍乡市湘东区', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360321', '江西省莲花县', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360322', '江西省上栗县', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360323', '江西省芦溪县', '360300'); +INSERT INTO `base_administrative_division` VALUES ('360400', '江西省九江市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360401', '江西省九江市市辖区', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360402', '江西省九江市庐山区', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360403', '江西省九江市浔阳区', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360421', '江西省九江县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360423', '江西省武宁县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360424', '江西省修水县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360425', '江西省永修县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360426', '江西省德安县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360427', '江西省星子县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360428', '江西省都昌县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360429', '江西省湖口县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360430', '江西省彭泽县', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360481', '江西省瑞昌市', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360482', '江西省共青城市', '360400'); +INSERT INTO `base_administrative_division` VALUES ('360500', '江西省新余市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360501', '江西省新余市市辖区', '360500'); +INSERT INTO `base_administrative_division` VALUES ('360502', '江西省新余市渝水区', '360500'); +INSERT INTO `base_administrative_division` VALUES ('360521', '江西省分宜县', '360500'); +INSERT INTO `base_administrative_division` VALUES ('360600', '江西省鹰潭市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360601', '江西省鹰潭市市辖区', '360600'); +INSERT INTO `base_administrative_division` VALUES ('360602', '江西省鹰潭市月湖区', '360600'); +INSERT INTO `base_administrative_division` VALUES ('360622', '江西省余江县', '360600'); +INSERT INTO `base_administrative_division` VALUES ('360681', '江西省贵溪市', '360600'); +INSERT INTO `base_administrative_division` VALUES ('360700', '江西省赣州市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360701', '江西省赣州市市辖区', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360702', '江西省赣州市章贡区', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360721', '江西省赣县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360722', '江西省信丰县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360723', '江西省大余县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360724', '江西省上犹县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360725', '江西省崇义县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360726', '江西省安远县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360727', '江西省龙南县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360728', '江西省定南县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360729', '江西省全南县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360730', '江西省宁都县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360731', '江西省于都县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360732', '江西省兴国县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360733', '江西省会昌县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360734', '江西省寻乌县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360735', '江西省石城县', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360781', '江西省瑞金市', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360782', '江西省南康市', '360700'); +INSERT INTO `base_administrative_division` VALUES ('360800', '江西省吉安市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360801', '江西省吉安市市辖区', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360802', '江西省吉安市吉州区', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360803', '江西省吉安市青原区', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360821', '江西省吉安县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360822', '江西省吉水县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360823', '江西省峡江县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360824', '江西省新干县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360825', '江西省永丰县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360826', '江西省泰和县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360827', '江西省遂川县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360828', '江西省万安县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360829', '江西省安福县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360830', '江西省永新县', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360881', '江西省井冈山市', '360800'); +INSERT INTO `base_administrative_division` VALUES ('360900', '江西省宜春市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('360901', '江西省宜春市市辖区', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360902', '江西省宜春市袁州区', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360921', '江西省奉新县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360922', '江西省万载县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360923', '江西省上高县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360924', '江西省宜丰县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360925', '江西省靖安县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360926', '江西省铜鼓县', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360981', '江西省丰城市', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360982', '江西省樟树市', '360900'); +INSERT INTO `base_administrative_division` VALUES ('360983', '江西省高安市', '360900'); +INSERT INTO `base_administrative_division` VALUES ('361000', '江西省抚州市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('361001', '江西省抚州市市辖区', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361002', '江西省抚州市临川区', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361021', '江西省南城县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361022', '江西省黎川县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361023', '江西省南丰县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361024', '江西省崇仁县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361025', '江西省乐安县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361026', '江西省宜黄县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361027', '江西省金溪县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361028', '江西省资溪县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361029', '江西省东乡县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361030', '江西省广昌县', '361000'); +INSERT INTO `base_administrative_division` VALUES ('361100', '江西省上饶市', '360000'); +INSERT INTO `base_administrative_division` VALUES ('361101', '江西省上饶市市辖区', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361102', '江西省上饶市信州区', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361121', '江西省上饶县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361122', '江西省广丰县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361123', '江西省玉山县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361124', '江西省铅山县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361125', '江西省横峰县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361126', '江西省弋阳县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361127', '江西省余干县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361128', '江西省鄱阳县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361129', '江西省万年县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361130', '江西省婺源县', '361100'); +INSERT INTO `base_administrative_division` VALUES ('361181', '江西省德兴市', '361100'); +INSERT INTO `base_administrative_division` VALUES ('370000', '山东省', '0'); +INSERT INTO `base_administrative_division` VALUES ('370100', '山东省济南市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370101', '山东省济南市市辖区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370102', '山东省济南市历下区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370103', '山东省济南市市中区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370104', '山东省济南市槐荫区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370105', '山东省济南市天桥区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370112', '山东省济南市历城区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370113', '山东省济南市长清区', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370124', '山东省平阴县', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370125', '山东省济阳县', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370126', '山东省商河县', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370181', '山东省章丘市', '370100'); +INSERT INTO `base_administrative_division` VALUES ('370200', '山东省青岛市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370201', '山东省青岛市市辖区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370202', '山东省青岛市市南区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370203', '山东省青岛市市北区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370205', '山东省青岛市四方区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370211', '山东省青岛市黄岛区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370212', '山东省青岛市崂山区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370213', '山东省青岛市李沧区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370214', '山东省青岛市城阳区', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370281', '山东省胶州市', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370282', '山东省即墨市', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370283', '山东省平度市', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370284', '山东省胶南市', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370285', '山东省莱西市', '370200'); +INSERT INTO `base_administrative_division` VALUES ('370300', '山东省淄博市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370301', '山东省淄博市市辖区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370302', '山东省淄博市淄川区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370303', '山东省淄博市张店区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370304', '山东省淄博市博山区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370305', '山东省淄博市临淄区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370306', '山东省淄博市周村区', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370321', '山东省桓台县', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370322', '山东省高青县', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370323', '山东省沂源县', '370300'); +INSERT INTO `base_administrative_division` VALUES ('370400', '山东省枣庄市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370401', '山东省枣庄市市辖区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370402', '山东省枣庄市市中区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370403', '山东省枣庄市薛城区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370404', '山东省枣庄市峄城区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370405', '山东省枣庄市台儿庄区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370406', '山东省枣庄市山亭区', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370481', '山东省滕州市', '370400'); +INSERT INTO `base_administrative_division` VALUES ('370500', '山东省东营市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370501', '山东省东营市市辖区', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370502', '山东省东营市东营区', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370503', '山东省东营市河口区', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370521', '山东省垦利县', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370522', '山东省利津县', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370523', '山东省广饶县', '370500'); +INSERT INTO `base_administrative_division` VALUES ('370600', '山东省烟台市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370601', '山东省烟台市市辖区', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370602', '山东省烟台市芝罘区', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370611', '山东省烟台市福山区', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370612', '山东省烟台市牟平区', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370613', '山东省烟台市莱山区', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370634', '山东省长岛县', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370681', '山东省龙口市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370682', '山东省莱阳市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370683', '山东省莱州市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370684', '山东省蓬莱市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370685', '山东省招远市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370686', '山东省栖霞市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370687', '山东省海阳市', '370600'); +INSERT INTO `base_administrative_division` VALUES ('370700', '山东省潍坊市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370701', '山东省潍坊市市辖区', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370702', '山东省潍坊市潍城区', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370703', '山东省潍坊市寒亭区', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370704', '山东省潍坊市坊子区', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370705', '山东省潍坊市奎文区', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370724', '山东省临朐县', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370725', '山东省昌乐县', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370781', '山东省青州市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370782', '山东省诸城市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370783', '山东省寿光市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370784', '山东省安丘市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370785', '山东省高密市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370786', '山东省昌邑市', '370700'); +INSERT INTO `base_administrative_division` VALUES ('370800', '山东省济宁市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370801', '山东省济宁市市辖区', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370802', '山东省济宁市市中区', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370811', '山东省济宁市任城区', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370826', '山东省微山县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370827', '山东省鱼台县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370828', '山东省金乡县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370829', '山东省嘉祥县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370830', '山东省汶上县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370831', '山东省泗水县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370832', '山东省梁山县', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370881', '山东省曲阜市', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370882', '山东省兖州市', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370883', '山东省邹城市', '370800'); +INSERT INTO `base_administrative_division` VALUES ('370900', '山东省泰安市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('370901', '山东省泰安市市辖区', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370902', '山东省泰安市泰山区', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370903', '山东省泰安市岱岳区', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370921', '山东省宁阳县', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370923', '山东省东平县', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370982', '山东省新泰市', '370900'); +INSERT INTO `base_administrative_division` VALUES ('370983', '山东省肥城市', '370900'); +INSERT INTO `base_administrative_division` VALUES ('371000', '山东省威海市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371001', '山东省威海市市辖区', '371000'); +INSERT INTO `base_administrative_division` VALUES ('371002', '山东省威海市环翠区', '371000'); +INSERT INTO `base_administrative_division` VALUES ('371081', '山东省文登市', '371000'); +INSERT INTO `base_administrative_division` VALUES ('371082', '山东省荣成市', '371000'); +INSERT INTO `base_administrative_division` VALUES ('371083', '山东省乳山市', '371000'); +INSERT INTO `base_administrative_division` VALUES ('371100', '山东省日照市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371101', '山东省日照市市辖区', '371100'); +INSERT INTO `base_administrative_division` VALUES ('371102', '山东省日照市东港区', '371100'); +INSERT INTO `base_administrative_division` VALUES ('371103', '山东省日照市岚山区', '371100'); +INSERT INTO `base_administrative_division` VALUES ('371121', '山东省五莲县', '371100'); +INSERT INTO `base_administrative_division` VALUES ('371122', '山东省莒县', '371100'); +INSERT INTO `base_administrative_division` VALUES ('371200', '山东省莱芜市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371201', '山东省莱芜市市辖区', '371200'); +INSERT INTO `base_administrative_division` VALUES ('371202', '山东省莱芜市莱城区', '371200'); +INSERT INTO `base_administrative_division` VALUES ('371203', '山东省莱芜市钢城区', '371200'); +INSERT INTO `base_administrative_division` VALUES ('371300', '山东省临沂市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371301', '山东省临沂市市辖区', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371302', '山东省临沂市兰山区', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371311', '山东省临沂市罗庄区', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371312', '山东省临沂市河东区', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371321', '山东省沂南县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371322', '山东省郯城县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371323', '山东省沂水县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371324', '山东省苍山县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371325', '山东省费县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371326', '山东省平邑县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371327', '山东省莒南县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371328', '山东省蒙阴县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371329', '山东省临沭县', '371300'); +INSERT INTO `base_administrative_division` VALUES ('371400', '山东省德州市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371401', '山东省德州市市辖区', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371402', '山东省德州市德城区', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371421', '山东省陵县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371422', '山东省宁津县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371423', '山东省庆云县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371424', '山东省临邑县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371425', '山东省齐河县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371426', '山东省平原县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371427', '山东省夏津县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371428', '山东省武城县', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371481', '山东省乐陵市', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371482', '山东省禹城市', '371400'); +INSERT INTO `base_administrative_division` VALUES ('371500', '山东省聊城市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371501', '山东省聊城市市辖区', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371502', '山东省聊城市东昌府区', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371521', '山东省阳谷县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371522', '山东省莘县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371523', '山东省茌平县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371524', '山东省东阿县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371525', '山东省冠县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371526', '山东省高唐县', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371581', '山东省临清市', '371500'); +INSERT INTO `base_administrative_division` VALUES ('371600', '山东省滨州市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371601', '山东省滨州市市辖区', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371602', '山东省滨州市滨城区', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371621', '山东省惠民县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371622', '山东省阳信县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371623', '山东省无棣县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371624', '山东省沾化县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371625', '山东省博兴县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371626', '山东省邹平县', '371600'); +INSERT INTO `base_administrative_division` VALUES ('371700', '山东省菏泽市', '370000'); +INSERT INTO `base_administrative_division` VALUES ('371701', '山东省菏泽市市辖区', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371702', '山东省菏泽市牡丹区', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371721', '山东省曹县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371722', '山东省单县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371723', '山东省成武县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371724', '山东省巨野县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371725', '山东省郓城县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371726', '山东省鄄城县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371727', '山东省定陶县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('371728', '山东省东明县', '371700'); +INSERT INTO `base_administrative_division` VALUES ('410000', '河南省', '0'); +INSERT INTO `base_administrative_division` VALUES ('410100', '河南省郑州市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410101', '河南省郑州市市辖区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410102', '河南省郑州市中原区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410103', '河南省郑州市二七区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410104', '河南省郑州市管城回族区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410105', '河南省郑州市金水区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410106', '河南省郑州市上街区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410108', '河南省郑州市惠济区', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410122', '河南省中牟县', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410181', '河南省巩义市', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410182', '河南省荥阳市', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410183', '河南省新密市', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410184', '河南省新郑市', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410185', '河南省登封市', '410100'); +INSERT INTO `base_administrative_division` VALUES ('410200', '河南省开封市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410201', '河南省开封市市辖区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410202', '河南省开封市龙亭区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410203', '河南省开封市顺河回族区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410204', '河南省开封市鼓楼区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410205', '河南省开封市禹王台区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410211', '河南省开封市金明区', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410221', '河南省杞县', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410222', '河南省通许县', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410223', '河南省尉氏县', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410224', '河南省开封县', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410225', '河南省兰考县', '410200'); +INSERT INTO `base_administrative_division` VALUES ('410300', '河南省洛阳市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410301', '河南省洛阳市市辖区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410302', '河南省洛阳市老城区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410303', '河南省洛阳市西工区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410304', '河南省洛阳市廛河回族区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410305', '河南省洛阳市涧西区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410306', '河南省洛阳市吉利区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410307', '河南省洛阳市洛龙区', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410322', '河南省孟津县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410323', '河南省新安县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410324', '河南省栾川县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410325', '河南省嵩县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410326', '河南省汝阳县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410327', '河南省宜阳县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410328', '河南省洛宁县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410329', '河南省伊川县', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410381', '河南省偃师市', '410300'); +INSERT INTO `base_administrative_division` VALUES ('410400', '河南省平顶山市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410401', '河南省平顶山市市辖区', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410402', '河南省平顶山市新华区', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410403', '河南省平顶山市卫东区', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410404', '河南省平顶山市石龙区', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410411', '河南省平顶山市湛河区', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410421', '河南省宝丰县', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410422', '河南省叶县', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410423', '河南省鲁山县', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410425', '河南省郏县', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410481', '河南省舞钢市', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410482', '河南省汝州市', '410400'); +INSERT INTO `base_administrative_division` VALUES ('410500', '河南省安阳市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410501', '河南省安阳市市辖区', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410502', '河南省安阳市文峰区', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410503', '河南省安阳市北关区', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410505', '河南省安阳市殷都区', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410506', '河南省安阳市龙安区', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410522', '河南省安阳县', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410523', '河南省汤阴县', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410526', '河南省滑县', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410527', '河南省内黄县', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410581', '河南省林州市', '410500'); +INSERT INTO `base_administrative_division` VALUES ('410600', '河南省鹤壁市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410601', '河南省鹤壁市市辖区', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410602', '河南省鹤壁市鹤山区', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410603', '河南省鹤壁市山城区', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410611', '河南省鹤壁市淇滨区', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410621', '河南省浚县', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410622', '河南省淇县', '410600'); +INSERT INTO `base_administrative_division` VALUES ('410700', '河南省新乡市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410701', '河南省新乡市市辖区', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410702', '河南省新乡市红旗区', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410703', '河南省新乡市卫滨区', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410704', '河南省新乡市凤泉区', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410711', '河南省新乡市牧野区', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410721', '河南省新乡县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410724', '河南省获嘉县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410725', '河南省原阳县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410726', '河南省延津县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410727', '河南省封丘县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410728', '河南省长垣县', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410781', '河南省卫辉市', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410782', '河南省辉县市', '410700'); +INSERT INTO `base_administrative_division` VALUES ('410800', '河南省焦作市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410801', '河南省焦作市市辖区', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410802', '河南省焦作市解放区', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410803', '河南省焦作市中站区', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410804', '河南省焦作市马村区', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410811', '河南省焦作市山阳区', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410821', '河南省修武县', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410822', '河南省博爱县', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410823', '河南省武陟县', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410825', '河南省温县', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410882', '河南省沁阳市', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410883', '河南省孟州市', '410800'); +INSERT INTO `base_administrative_division` VALUES ('410900', '河南省濮阳市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('410901', '河南省濮阳市市辖区', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410902', '河南省濮阳市华龙区', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410922', '河南省清丰县', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410923', '河南省南乐县', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410926', '河南省范县', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410927', '河南省台前县', '410900'); +INSERT INTO `base_administrative_division` VALUES ('410928', '河南省濮阳县', '410900'); +INSERT INTO `base_administrative_division` VALUES ('411000', '河南省许昌市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411001', '河南省许昌市市辖区', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411002', '河南省许昌市魏都区', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411023', '河南省许昌县', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411024', '河南省鄢陵县', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411025', '河南省襄城县', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411081', '河南省禹州市', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411082', '河南省长葛市', '411000'); +INSERT INTO `base_administrative_division` VALUES ('411100', '河南省漯河市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411101', '河南省漯河市市辖区', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411102', '河南省漯河市源汇区', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411103', '河南省漯河市郾城区', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411104', '河南省漯河市召陵区', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411121', '河南省舞阳县', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411122', '河南省临颍县', '411100'); +INSERT INTO `base_administrative_division` VALUES ('411200', '河南省三门峡市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411201', '河南省三门峡市市辖区', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411202', '河南省三门峡市湖滨区', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411221', '河南省渑池县', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411222', '河南省陕县', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411224', '河南省卢氏县', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411281', '河南省义马市', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411282', '河南省灵宝市', '411200'); +INSERT INTO `base_administrative_division` VALUES ('411300', '河南省南阳市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411301', '河南省南阳市市辖区', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411302', '河南省南阳市宛城区', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411303', '河南省南阳市卧龙区', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411321', '河南省南召县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411322', '河南省方城县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411323', '河南省西峡县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411324', '河南省镇平县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411325', '河南省内乡县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411326', '河南省淅川县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411327', '河南省社旗县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411328', '河南省唐河县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411329', '河南省新野县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411330', '河南省桐柏县', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411381', '河南省邓州市', '411300'); +INSERT INTO `base_administrative_division` VALUES ('411400', '河南省商丘市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411401', '河南省商丘市市辖区', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411402', '河南省商丘市梁园区', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411403', '河南省商丘市睢阳区', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411421', '河南省民权县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411422', '河南省睢县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411423', '河南省宁陵县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411424', '河南省柘城县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411425', '河南省虞城县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411426', '河南省夏邑县', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411481', '河南省永城市', '411400'); +INSERT INTO `base_administrative_division` VALUES ('411500', '河南省信阳市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411501', '河南省信阳市市辖区', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411502', '河南省信阳市师河区', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411503', '河南省信阳市平桥区', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411521', '河南省罗山县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411522', '河南省光山县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411523', '河南省新县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411524', '河南省商城县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411525', '河南省固始县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411526', '河南省潢川县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411527', '河南省淮滨县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411528', '河南省息县', '411500'); +INSERT INTO `base_administrative_division` VALUES ('411600', '河南省周口市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411601', '河南省周口市市辖区', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411602', '河南省周口市川汇区', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411621', '河南省扶沟县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411622', '河南省西华县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411623', '河南省商水县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411624', '河南省沈丘县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411625', '河南省郸城县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411626', '河南省淮阳县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411627', '河南省太康县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411628', '河南省鹿邑县', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411681', '河南省项城市', '411600'); +INSERT INTO `base_administrative_division` VALUES ('411700', '河南省驻马店市', '410000'); +INSERT INTO `base_administrative_division` VALUES ('411701', '河南省驻马店市市辖区', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411702', '河南省驻马店市驿城区', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411721', '河南省西平县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411722', '河南省上蔡县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411723', '河南省平舆县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411724', '河南省正阳县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411725', '河南省确山县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411726', '河南省泌阳县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411727', '河南省汝南县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411728', '河南省遂平县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('411729', '河南省新蔡县', '411700'); +INSERT INTO `base_administrative_division` VALUES ('419000', '河南省省直辖县级行政区划', '410000'); +INSERT INTO `base_administrative_division` VALUES ('419001', '河南省济源市', '419000'); +INSERT INTO `base_administrative_division` VALUES ('420000', '湖北省', '0'); +INSERT INTO `base_administrative_division` VALUES ('420100', '湖北省武汉市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420101', '湖北省武汉市市辖区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420102', '湖北省武汉市江岸区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420103', '湖北省武汉市江汉区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420104', '湖北省武汉市硚口区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420105', '湖北省武汉市汉阳区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420106', '湖北省武汉市武昌区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420107', '湖北省武汉市青山区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420111', '湖北省武汉市洪山区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420112', '湖北省武汉市东西湖区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420113', '湖北省武汉市汉南区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420114', '湖北省武汉市蔡甸区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420115', '湖北省武汉市江夏区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420116', '湖北省武汉市黄陂区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420117', '湖北省武汉市新洲区', '420100'); +INSERT INTO `base_administrative_division` VALUES ('420200', '湖北省黄石市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420201', '湖北省黄石市市辖区', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420202', '湖北省黄石市黄石港区', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420203', '湖北省黄石市西塞山区', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420204', '湖北省黄石市下陆区', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420205', '湖北省黄石市铁山区', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420222', '湖北省阳新县', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420281', '湖北省大冶市', '420200'); +INSERT INTO `base_administrative_division` VALUES ('420300', '湖北省十堰市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420301', '湖北省十堰市市辖区', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420302', '湖北省十堰市茅箭区', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420303', '湖北省十堰市张湾区', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420321', '湖北省郧县', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420322', '湖北省郧西县', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420323', '湖北省竹山县', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420324', '湖北省竹溪县', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420325', '湖北省房县', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420381', '湖北省丹江口市', '420300'); +INSERT INTO `base_administrative_division` VALUES ('420500', '湖北省宜昌市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420501', '湖北省宜昌市市辖区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420502', '湖北省宜昌市西陵区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420503', '湖北省宜昌市伍家岗区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420504', '湖北省宜昌市点军区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420505', '湖北省宜昌市猇亭区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420506', '湖北省宜昌市夷陵区', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420525', '湖北省远安县', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420526', '湖北省兴山县', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420527', '湖北省秭归县', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420528', '湖北省长阳土家族自治县', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420529', '湖北省五峰土家族自治县', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420581', '湖北省宜都市', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420582', '湖北省当阳市', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420583', '湖北省枝江市', '420500'); +INSERT INTO `base_administrative_division` VALUES ('420600', '湖北省襄阳市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420601', '湖北省襄阳市市辖区', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420602', '湖北省襄阳市襄城区', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420606', '湖北省襄阳市樊城区', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420607', '湖北省襄阳市襄州区', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420624', '湖北省南漳县', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420625', '湖北省谷城县', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420626', '湖北省保康县', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420682', '湖北省老河口市', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420683', '湖北省枣阳市', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420684', '湖北省宜城市', '420600'); +INSERT INTO `base_administrative_division` VALUES ('420700', '湖北省鄂州市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420701', '湖北省鄂州市市辖区', '420700'); +INSERT INTO `base_administrative_division` VALUES ('420702', '湖北省鄂州市梁子湖区', '420700'); +INSERT INTO `base_administrative_division` VALUES ('420703', '湖北省鄂州市华容区', '420700'); +INSERT INTO `base_administrative_division` VALUES ('420704', '湖北省鄂州市鄂城区', '420700'); +INSERT INTO `base_administrative_division` VALUES ('420800', '湖北省荆门市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420801', '湖北省荆门市市辖区', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420802', '湖北省荆门市东宝区', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420804', '湖北省荆门市掇刀区', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420821', '湖北省京山县', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420822', '湖北省沙洋县', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420881', '湖北省钟祥市', '420800'); +INSERT INTO `base_administrative_division` VALUES ('420900', '湖北省孝感市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('420901', '湖北省孝感市市辖区', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420902', '湖北省孝感市孝南区', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420921', '湖北省孝昌县', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420922', '湖北省大悟县', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420923', '湖北省云梦县', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420981', '湖北省应城市', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420982', '湖北省安陆市', '420900'); +INSERT INTO `base_administrative_division` VALUES ('420984', '湖北省汉川市', '420900'); +INSERT INTO `base_administrative_division` VALUES ('421000', '湖北省荆州市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('421001', '湖北省荆州市市辖区', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421002', '湖北省荆州市沙市区', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421003', '湖北省荆州市荆州区', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421022', '湖北省公安县', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421023', '湖北省监利县', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421024', '湖北省江陵县', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421081', '湖北省石首市', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421083', '湖北省洪湖市', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421087', '湖北省松滋市', '421000'); +INSERT INTO `base_administrative_division` VALUES ('421100', '湖北省黄冈市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('421101', '湖北省黄冈市市辖区', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421102', '湖北省黄冈市黄州区', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421121', '湖北省团风县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421122', '湖北省红安县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421123', '湖北省罗田县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421124', '湖北省英山县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421125', '湖北省浠水县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421126', '湖北省蕲春县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421127', '湖北省黄梅县', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421181', '湖北省麻城市', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421182', '湖北省武穴市', '421100'); +INSERT INTO `base_administrative_division` VALUES ('421200', '湖北省咸宁市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('421201', '湖北省咸宁市市辖区', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421202', '湖北省咸宁市咸安区', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421221', '湖北省嘉鱼县', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421222', '湖北省通城县', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421223', '湖北省崇阳县', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421224', '湖北省通山县', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421281', '湖北省赤壁市', '421200'); +INSERT INTO `base_administrative_division` VALUES ('421300', '湖北省随州市', '420000'); +INSERT INTO `base_administrative_division` VALUES ('421301', '湖北省随州市市辖区', '421300'); +INSERT INTO `base_administrative_division` VALUES ('421302', '湖北省随州市曾都区', '421300'); +INSERT INTO `base_administrative_division` VALUES ('421381', '湖北省广水市', '421300'); +INSERT INTO `base_administrative_division` VALUES ('422800', '湖北省恩施土家族苗族自治州', '420000'); +INSERT INTO `base_administrative_division` VALUES ('422801', '湖北省恩施市', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422802', '湖北省利川市', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422822', '湖北省建始县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422823', '湖北省巴东县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422825', '湖北省宣恩县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422826', '湖北省咸丰县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422827', '湖北省来凤县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('422828', '湖北省鹤峰县', '422800'); +INSERT INTO `base_administrative_division` VALUES ('429000', '湖北省省直辖县级行政区划', '420000'); +INSERT INTO `base_administrative_division` VALUES ('429004', '湖北省仙桃市', '429000'); +INSERT INTO `base_administrative_division` VALUES ('429005', '湖北省潜江市', '429000'); +INSERT INTO `base_administrative_division` VALUES ('429006', '湖北省天门市', '429000'); +INSERT INTO `base_administrative_division` VALUES ('429021', '湖北省神农架林区', '429000'); +INSERT INTO `base_administrative_division` VALUES ('430000', '湖南省', '0'); +INSERT INTO `base_administrative_division` VALUES ('430100', '湖南省长沙市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430101', '湖南省长沙市市辖区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430102', '湖南省长沙市芙蓉区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430103', '湖南省长沙市天心区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430104', '湖南省长沙市岳麓区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430105', '湖南省长沙市开福区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430111', '湖南省长沙市雨花区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430112', '湖南省长沙市望城区', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430121', '湖南省长沙县', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430124', '湖南省宁乡县', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430181', '湖南省浏阳市', '430100'); +INSERT INTO `base_administrative_division` VALUES ('430200', '湖南省株洲市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430201', '湖南省株洲市市辖区', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430202', '湖南省株洲市荷塘区', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430203', '湖南省株洲市芦淞区', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430204', '湖南省株洲市石峰区', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430211', '湖南省株洲市天元区', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430221', '湖南省株洲县', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430223', '湖南省攸县', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430224', '湖南省茶陵县', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430225', '湖南省炎陵县', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430281', '湖南省醴陵市', '430200'); +INSERT INTO `base_administrative_division` VALUES ('430300', '湖南省湘潭市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430301', '湖南省湘潭市市辖区', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430302', '湖南省湘潭市雨湖区', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430304', '湖南省湘潭市岳塘区', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430321', '湖南省湘潭县', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430381', '湖南省湘乡市', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430382', '湖南省韶山市', '430300'); +INSERT INTO `base_administrative_division` VALUES ('430400', '湖南省衡阳市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430401', '湖南省衡阳市市辖区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430405', '湖南省衡阳市珠晖区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430406', '湖南省衡阳市雁峰区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430407', '湖南省衡阳市石鼓区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430408', '湖南省衡阳市蒸湘区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430412', '湖南省衡阳市南岳区', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430421', '湖南省衡阳县', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430422', '湖南省衡南县', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430423', '湖南省衡山县', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430424', '湖南省衡东县', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430426', '湖南省祁东县', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430481', '湖南省耒阳市', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430482', '湖南省常宁市', '430400'); +INSERT INTO `base_administrative_division` VALUES ('430500', '湖南省邵阳市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430501', '湖南省邵阳市市辖区', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430502', '湖南省邵阳市双清区', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430503', '湖南省邵阳市大祥区', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430511', '湖南省邵阳市北塔区', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430521', '湖南省邵东县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430522', '湖南省新邵县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430523', '湖南省邵阳县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430524', '湖南省隆回县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430525', '湖南省洞口县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430527', '湖南省绥宁县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430528', '湖南省新宁县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430529', '湖南省城步苗族自治县', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430581', '湖南省武冈市', '430500'); +INSERT INTO `base_administrative_division` VALUES ('430600', '湖南省岳阳市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430601', '湖南省岳阳市市辖区', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430602', '湖南省岳阳市岳阳楼区', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430603', '湖南省岳阳市云溪区', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430611', '湖南省岳阳市君山区', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430621', '湖南省岳阳县', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430623', '湖南省华容县', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430624', '湖南省湘阴县', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430626', '湖南省平江县', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430681', '湖南省汨罗市', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430682', '湖南省临湘市', '430600'); +INSERT INTO `base_administrative_division` VALUES ('430700', '湖南省常德市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430701', '湖南省常德市市辖区', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430702', '湖南省常德市武陵区', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430703', '湖南省常德市鼎城区', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430721', '湖南省安乡县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430722', '湖南省汉寿县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430723', '湖南省澧县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430724', '湖南省临澧县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430725', '湖南省桃源县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430726', '湖南省石门县', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430781', '湖南省津市市', '430700'); +INSERT INTO `base_administrative_division` VALUES ('430800', '湖南省张家界市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430801', '湖南省张家界市市辖区', '430800'); +INSERT INTO `base_administrative_division` VALUES ('430802', '湖南省张家界市永定区', '430800'); +INSERT INTO `base_administrative_division` VALUES ('430811', '湖南省张家界市武陵源区', '430800'); +INSERT INTO `base_administrative_division` VALUES ('430821', '湖南省慈利县', '430800'); +INSERT INTO `base_administrative_division` VALUES ('430822', '湖南省桑植县', '430800'); +INSERT INTO `base_administrative_division` VALUES ('430900', '湖南省益阳市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('430901', '湖南省益阳市市辖区', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430902', '湖南省益阳市资阳区', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430903', '湖南省益阳市赫山区', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430921', '湖南省南县', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430922', '湖南省桃江县', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430923', '湖南省安化县', '430900'); +INSERT INTO `base_administrative_division` VALUES ('430981', '湖南省沅江市', '430900'); +INSERT INTO `base_administrative_division` VALUES ('431000', '湖南省郴州市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('431001', '湖南省郴州市市辖区', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431002', '湖南省郴州市北湖区', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431003', '湖南省郴州市苏仙区', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431021', '湖南省桂阳县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431022', '湖南省宜章县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431023', '湖南省永兴县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431024', '湖南省嘉禾县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431025', '湖南省临武县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431026', '湖南省汝城县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431027', '湖南省桂东县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431028', '湖南省安仁县', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431081', '湖南省资兴市', '431000'); +INSERT INTO `base_administrative_division` VALUES ('431100', '湖南省永州市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('431101', '湖南省永州市市辖区', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431102', '湖南省永州市零陵区', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431103', '湖南省永州市冷水滩区', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431121', '湖南省祁阳县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431122', '湖南省东安县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431123', '湖南省双牌县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431124', '湖南省道县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431125', '湖南省江永县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431126', '湖南省宁远县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431127', '湖南省蓝山县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431128', '湖南省新田县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431129', '湖南省江华瑶族自治县', '431100'); +INSERT INTO `base_administrative_division` VALUES ('431200', '湖南省怀化市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('431201', '湖南省怀化市市辖区', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431202', '湖南省怀化市鹤城区', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431221', '湖南省中方县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431222', '湖南省沅陵县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431223', '湖南省辰溪县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431224', '湖南省溆浦县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431225', '湖南省会同县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431226', '湖南省麻阳苗族自治县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431227', '湖南省新晃侗族自治县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431228', '湖南省芷江侗族自治县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431229', '湖南省靖州苗族侗族自治县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431230', '湖南省通道侗族自治县', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431281', '湖南省洪江市', '431200'); +INSERT INTO `base_administrative_division` VALUES ('431300', '湖南省娄底市', '430000'); +INSERT INTO `base_administrative_division` VALUES ('431301', '湖南省娄底市市辖区', '431300'); +INSERT INTO `base_administrative_division` VALUES ('431302', '湖南省娄底市娄星区', '431300'); +INSERT INTO `base_administrative_division` VALUES ('431321', '湖南省双峰县', '431300'); +INSERT INTO `base_administrative_division` VALUES ('431322', '湖南省新化县', '431300'); +INSERT INTO `base_administrative_division` VALUES ('431381', '湖南省冷水江市', '431300'); +INSERT INTO `base_administrative_division` VALUES ('431382', '湖南省涟源市', '431300'); +INSERT INTO `base_administrative_division` VALUES ('433100', '湖南省湘西土家族苗族自治州', '430000'); +INSERT INTO `base_administrative_division` VALUES ('433101', '湖南省吉首市', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433122', '湖南省泸溪县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433123', '湖南省凤凰县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433124', '湖南省花垣县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433125', '湖南省保靖县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433126', '湖南省古丈县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433127', '湖南省永顺县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('433130', '湖南省龙山县', '433100'); +INSERT INTO `base_administrative_division` VALUES ('440000', '广东省', '0'); +INSERT INTO `base_administrative_division` VALUES ('440100', '广东省广州市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440101', '广东省广州市市辖区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440103', '广东省广州市荔湾区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440104', '广东省广州市越秀区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440105', '广东省广州市海珠区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440106', '广东省广州市天河区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440111', '广东省广州市白云区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440112', '广东省广州市黄埔区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440113', '广东省广州市番禺区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440114', '广东省广州市花都区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440115', '广东省广州市南沙区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440116', '广东省广州市萝岗区', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440183', '广东省增城市', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440184', '广东省从化市', '440100'); +INSERT INTO `base_administrative_division` VALUES ('440200', '广东省韶关市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440201', '广东省韶关市市辖区', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440203', '广东省韶关市武江区', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440204', '广东省韶关市浈江区', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440205', '广东省韶关市曲江区', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440222', '广东省始兴县', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440224', '广东省仁化县', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440229', '广东省翁源县', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440232', '广东省乳源瑶族自治县', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440233', '广东省新丰县', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440281', '广东省乐昌市', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440282', '广东省南雄市', '440200'); +INSERT INTO `base_administrative_division` VALUES ('440300', '广东省深圳市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440301', '广东省深圳市市辖区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440303', '广东省深圳市罗湖区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440304', '广东省深圳市福田区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440305', '广东省深圳市南山区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440306', '广东省深圳市宝安区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440307', '广东省深圳市龙岗区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440308', '广东省深圳市盐田区', '440300'); +INSERT INTO `base_administrative_division` VALUES ('440400', '广东省珠海市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440401', '广东省珠海市市辖区', '440400'); +INSERT INTO `base_administrative_division` VALUES ('440402', '广东省珠海市香洲区', '440400'); +INSERT INTO `base_administrative_division` VALUES ('440403', '广东省珠海市斗门区', '440400'); +INSERT INTO `base_administrative_division` VALUES ('440404', '广东省珠海市金湾区', '440400'); +INSERT INTO `base_administrative_division` VALUES ('440500', '广东省汕头市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440501', '广东省汕头市市辖区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440507', '广东省汕头市龙湖区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440511', '广东省汕头市金平区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440512', '广东省汕头市濠江区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440513', '广东省汕头市潮阳区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440514', '广东省汕头市潮南区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440515', '广东省汕头市澄海区', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440523', '广东省南澳县', '440500'); +INSERT INTO `base_administrative_division` VALUES ('440600', '广东省佛山市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440601', '广东省佛山市市辖区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440604', '广东省佛山市禅城区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440605', '广东省佛山市南海区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440606', '广东省佛山市顺德区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440607', '广东省佛山市三水区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440608', '广东省佛山市高明区', '440600'); +INSERT INTO `base_administrative_division` VALUES ('440700', '广东省江门市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440701', '广东省江门市市辖区', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440703', '广东省江门市蓬江区', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440704', '广东省江门市江海区', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440705', '广东省江门市新会区', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440781', '广东省台山市', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440783', '广东省开平市', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440784', '广东省鹤山市', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440785', '广东省恩平市', '440700'); +INSERT INTO `base_administrative_division` VALUES ('440800', '广东省湛江市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440801', '广东省湛江市市辖区', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440802', '广东省湛江市赤坎区', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440803', '广东省湛江市霞山区', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440804', '广东省湛江市坡头区', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440811', '广东省湛江市麻章区', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440823', '广东省遂溪县', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440825', '广东省徐闻县', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440881', '广东省廉江市', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440882', '广东省雷州市', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440883', '广东省吴川市', '440800'); +INSERT INTO `base_administrative_division` VALUES ('440900', '广东省茂名市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('440901', '广东省茂名市市辖区', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440902', '广东省茂名市茂南区', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440903', '广东省茂名市茂港区', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440923', '广东省电白县', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440981', '广东省高州市', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440982', '广东省化州市', '440900'); +INSERT INTO `base_administrative_division` VALUES ('440983', '广东省信宜市', '440900'); +INSERT INTO `base_administrative_division` VALUES ('441200', '广东省肇庆市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441201', '广东省肇庆市市辖区', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441202', '广东省肇庆市端州区', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441203', '广东省肇庆市鼎湖区', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441223', '广东省广宁县', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441224', '广东省怀集县', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441225', '广东省封开县', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441226', '广东省德庆县', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441283', '广东省高要市', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441284', '广东省四会市', '441200'); +INSERT INTO `base_administrative_division` VALUES ('441300', '广东省惠州市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441301', '广东省惠州市市辖区', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441302', '广东省惠州市惠城区', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441303', '广东省惠州市惠阳区', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441322', '广东省博罗县', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441323', '广东省惠东县', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441324', '广东省龙门县', '441300'); +INSERT INTO `base_administrative_division` VALUES ('441400', '广东省梅州市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441401', '广东省梅州市市辖区', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441402', '广东省梅州市梅江区', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441421', '广东省梅县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441422', '广东省大埔县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441423', '广东省丰顺县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441424', '广东省五华县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441426', '广东省平远县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441427', '广东省蕉岭县', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441481', '广东省兴宁市', '441400'); +INSERT INTO `base_administrative_division` VALUES ('441500', '广东省汕尾市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441501', '广东省汕尾市市辖区', '441500'); +INSERT INTO `base_administrative_division` VALUES ('441502', '广东省汕尾市城区', '441500'); +INSERT INTO `base_administrative_division` VALUES ('441521', '广东省海丰县', '441500'); +INSERT INTO `base_administrative_division` VALUES ('441523', '广东省陆河县', '441500'); +INSERT INTO `base_administrative_division` VALUES ('441581', '广东省陆丰市', '441500'); +INSERT INTO `base_administrative_division` VALUES ('441600', '广东省河源市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441601', '广东省河源市市辖区', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441602', '广东省河源市源城区', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441621', '广东省紫金县', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441622', '广东省龙川县', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441623', '广东省连平县', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441624', '广东省和平县', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441625', '广东省东源县', '441600'); +INSERT INTO `base_administrative_division` VALUES ('441700', '广东省阳江市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441701', '广东省阳江市市辖区', '441700'); +INSERT INTO `base_administrative_division` VALUES ('441702', '广东省阳江市江城区', '441700'); +INSERT INTO `base_administrative_division` VALUES ('441721', '广东省阳西县', '441700'); +INSERT INTO `base_administrative_division` VALUES ('441723', '广东省阳东县', '441700'); +INSERT INTO `base_administrative_division` VALUES ('441781', '广东省阳春市', '441700'); +INSERT INTO `base_administrative_division` VALUES ('441800', '广东省清远市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('441801', '广东省清远市市辖区', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441802', '广东省清远市清城区', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441821', '广东省佛冈县', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441823', '广东省阳山县', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441825', '广东省连山壮族瑶族自治县', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441826', '广东省连南瑶族自治县', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441827', '广东省清新县', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441881', '广东省英德市', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441882', '广东省连州市', '441800'); +INSERT INTO `base_administrative_division` VALUES ('441900', '广东省东莞市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('442000', '广东省中山市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('445100', '广东省潮州市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('445101', '广东省潮州市市辖区', '445100'); +INSERT INTO `base_administrative_division` VALUES ('445102', '广东省潮州市湘桥区', '445100'); +INSERT INTO `base_administrative_division` VALUES ('445121', '广东省潮安县', '445100'); +INSERT INTO `base_administrative_division` VALUES ('445122', '广东省饶平县', '445100'); +INSERT INTO `base_administrative_division` VALUES ('445200', '广东省揭阳市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('445201', '广东省揭阳市市辖区', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445202', '广东省揭阳市榕城区', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445221', '广东省揭东县', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445222', '广东省揭西县', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445224', '广东省惠来县', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445281', '广东省普宁市', '445200'); +INSERT INTO `base_administrative_division` VALUES ('445300', '广东省云浮市', '440000'); +INSERT INTO `base_administrative_division` VALUES ('445301', '广东省云浮市市辖区', '445300'); +INSERT INTO `base_administrative_division` VALUES ('445302', '广东省云浮市云城区', '445300'); +INSERT INTO `base_administrative_division` VALUES ('445321', '广东省新兴县', '445300'); +INSERT INTO `base_administrative_division` VALUES ('445322', '广东省郁南县', '445300'); +INSERT INTO `base_administrative_division` VALUES ('445323', '广东省云安县', '445300'); +INSERT INTO `base_administrative_division` VALUES ('445381', '广东省罗定市', '445300'); +INSERT INTO `base_administrative_division` VALUES ('450000', '广西壮族自治区', '0'); +INSERT INTO `base_administrative_division` VALUES ('450100', '广西南宁市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450101', '广西南宁市市辖区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450102', '广西南宁市兴宁区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450103', '广西南宁市青秀区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450105', '广西南宁市江南区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450107', '广西南宁市西乡塘区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450108', '广西南宁市良庆区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450109', '广西南宁市邕宁区', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450122', '广西武鸣县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450123', '广西隆安县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450124', '广西马山县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450125', '广西上林县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450126', '广西宾阳县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450127', '广西横县', '450100'); +INSERT INTO `base_administrative_division` VALUES ('450200', '广西柳州市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450201', '广西柳州市市辖区', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450202', '广西柳州市城中区', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450203', '广西柳州市鱼峰区', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450204', '广西柳州市柳南区', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450205', '广西柳州市柳北区', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450221', '广西柳江县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450222', '广西柳城县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450223', '广西鹿寨县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450224', '广西融安县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450225', '广西融水苗族自治县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450226', '广西三江侗族自治县', '450200'); +INSERT INTO `base_administrative_division` VALUES ('450300', '广西桂林市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450301', '广西桂林市市辖区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450302', '广西桂林市秀峰区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450303', '广西桂林市叠彩区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450304', '广西桂林市象山区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450305', '广西桂林市七星区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450311', '广西桂林市雁山区', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450321', '广西阳朔县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450322', '广西临桂县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450323', '广西灵川县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450324', '广西全州县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450325', '广西兴安县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450326', '广西永福县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450327', '广西灌阳县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450328', '广西龙胜各族自治县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450329', '广西资源县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450330', '广西平乐县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450331', '广西荔蒲县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450332', '广西恭城瑶族自治县', '450300'); +INSERT INTO `base_administrative_division` VALUES ('450400', '广西梧州市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450401', '广西梧州市市辖区', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450403', '广西梧州市万秀区', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450404', '广西梧州市蝶山区', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450405', '广西梧州市长洲区', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450421', '广西苍梧县', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450422', '广西藤县', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450423', '广西蒙山县', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450481', '广西岑溪市', '450400'); +INSERT INTO `base_administrative_division` VALUES ('450500', '广西北海市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450501', '广西北海市市辖区', '450500'); +INSERT INTO `base_administrative_division` VALUES ('450502', '广西北海市海城区', '450500'); +INSERT INTO `base_administrative_division` VALUES ('450503', '广西北海市银海区', '450500'); +INSERT INTO `base_administrative_division` VALUES ('450512', '广西北海市铁山港区', '450500'); +INSERT INTO `base_administrative_division` VALUES ('450521', '广西合浦县', '450500'); +INSERT INTO `base_administrative_division` VALUES ('450600', '广西防城港市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450601', '广西防城港市市辖区', '450600'); +INSERT INTO `base_administrative_division` VALUES ('450602', '广西防城港市港口区', '450600'); +INSERT INTO `base_administrative_division` VALUES ('450603', '广西防城港市防城区', '450600'); +INSERT INTO `base_administrative_division` VALUES ('450621', '广西上思县', '450600'); +INSERT INTO `base_administrative_division` VALUES ('450681', '广西东兴市', '450600'); +INSERT INTO `base_administrative_division` VALUES ('450700', '广西钦州市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450701', '广西钦州市市辖区', '450700'); +INSERT INTO `base_administrative_division` VALUES ('450702', '广西钦州市钦南区', '450700'); +INSERT INTO `base_administrative_division` VALUES ('450703', '广西钦州市钦北区', '450700'); +INSERT INTO `base_administrative_division` VALUES ('450721', '广西灵山县', '450700'); +INSERT INTO `base_administrative_division` VALUES ('450722', '广西浦北县', '450700'); +INSERT INTO `base_administrative_division` VALUES ('450800', '广西贵港市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450801', '广西贵港市市辖区', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450802', '广西贵港市港北区', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450803', '广西贵港市港南区', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450804', '广西贵港市覃塘区', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450821', '广西平南县', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450881', '广西桂平市', '450800'); +INSERT INTO `base_administrative_division` VALUES ('450900', '广西玉林市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('450901', '广西玉林市市辖区', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450902', '广西玉林市玉州区', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450921', '广西容县', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450922', '广西陆川县', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450923', '广西博白县', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450924', '广西兴业县', '450900'); +INSERT INTO `base_administrative_division` VALUES ('450981', '广西北流市', '450900'); +INSERT INTO `base_administrative_division` VALUES ('451000', '广西百色市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('451001', '广西百色市市辖区', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451002', '广西百色市右江区', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451021', '广西田阳县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451022', '广西田东县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451023', '广西平果县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451024', '广西德保县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451025', '广西靖西县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451026', '广西那坡县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451027', '广西凌云县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451028', '广西乐业县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451029', '广西田林县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451030', '广西西林县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451031', '广西隆林各族自治县', '451000'); +INSERT INTO `base_administrative_division` VALUES ('451100', '广西贺州市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('451101', '广西贺州市市辖区', '451100'); +INSERT INTO `base_administrative_division` VALUES ('451102', '广西贺州市八步区', '451100'); +INSERT INTO `base_administrative_division` VALUES ('451121', '广西昭平县', '451100'); +INSERT INTO `base_administrative_division` VALUES ('451122', '广西钟山县', '451100'); +INSERT INTO `base_administrative_division` VALUES ('451123', '广西富川瑶族自治县', '451100'); +INSERT INTO `base_administrative_division` VALUES ('451200', '广西河池市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('451201', '广西河池市市辖区', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451202', '广西河池市金城江区', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451221', '广西南丹县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451222', '广西天峨县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451223', '广西凤山县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451224', '广西东兰县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451225', '广西罗城仫佬族自治县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451226', '广西环江毛南族自治县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451227', '广西巴马瑶族自治县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451228', '广西都安瑶族自治县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451229', '广西大化瑶族自治县', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451281', '广西宜州市', '451200'); +INSERT INTO `base_administrative_division` VALUES ('451300', '广西来宾市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('451301', '广西来宾市市辖区', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451302', '广西来宾市兴宾区', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451321', '广西忻城县', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451322', '广西象州县', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451323', '广西武宣县', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451324', '广西金秀瑶族自治县', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451381', '广西合山市', '451300'); +INSERT INTO `base_administrative_division` VALUES ('451400', '广西崇左市', '450000'); +INSERT INTO `base_administrative_division` VALUES ('451401', '广西崇左市市辖区', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451402', '广西崇左市江洲区', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451421', '广西扶绥县', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451422', '广西宁明县', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451423', '广西龙州县', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451424', '广西大新县', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451425', '广西天等县', '451400'); +INSERT INTO `base_administrative_division` VALUES ('451481', '广西凭祥市', '451400'); +INSERT INTO `base_administrative_division` VALUES ('460000', '海南省', '0'); +INSERT INTO `base_administrative_division` VALUES ('460100', '海南省海口市', '460000'); +INSERT INTO `base_administrative_division` VALUES ('460101', '海南省海口市市辖区', '460100'); +INSERT INTO `base_administrative_division` VALUES ('460105', '海南省海口市秀英区', '460100'); +INSERT INTO `base_administrative_division` VALUES ('460106', '海南省海口市龙华区', '460100'); +INSERT INTO `base_administrative_division` VALUES ('460107', '海南省海口市琼山区', '460100'); +INSERT INTO `base_administrative_division` VALUES ('460108', '海南省海口市美兰区', '460100'); +INSERT INTO `base_administrative_division` VALUES ('460200', '海南省三亚市', '460000'); +INSERT INTO `base_administrative_division` VALUES ('460201', '海南省三亚市市辖区', '460200'); +INSERT INTO `base_administrative_division` VALUES ('469000', '海南省省直辖县级行政区划', '460000'); +INSERT INTO `base_administrative_division` VALUES ('469001', '海南省五指山市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469002', '海南省琼海市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469003', '海南省儋州市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469005', '海南省文昌市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469006', '海南省万宁市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469007', '海南省东方市', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469025', '海南省定安县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469026', '海南省屯昌县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469027', '海南省澄迈县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469028', '海南省临高县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469030', '海南省白沙黎族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469031', '海南省昌江黎族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469033', '海南省乐东黎族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469034', '海南省陵水黎族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469035', '海南省保亭黎族苗族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469036', '海南省琼中黎族苗族自治县', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469037', '海南省西沙群岛', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469038', '海南省南沙群岛', '469000'); +INSERT INTO `base_administrative_division` VALUES ('469039', '海南省中沙群岛的岛礁及其海域', '469000'); +INSERT INTO `base_administrative_division` VALUES ('500000', '重庆市', '0'); +INSERT INTO `base_administrative_division` VALUES ('500100', '重庆市市辖区', '500000'); +INSERT INTO `base_administrative_division` VALUES ('500101', '重庆市万州区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500102', '重庆市涪陵区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500103', '重庆市渝中区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500104', '重庆市大渡口区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500105', '重庆市江北区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500106', '重庆市沙坪坝区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500107', '重庆市九龙坡区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500108', '重庆市南岸区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500109', '重庆市北碚区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500110', '重庆市綦江区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500111', '重庆市大足区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500112', '重庆市渝北区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500113', '重庆市巴南区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500114', '重庆市黔江区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500115', '重庆市长寿区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500116', '重庆市江津区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500117', '重庆市合川区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500118', '重庆市永川区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500119', '重庆市南川区', '500100'); +INSERT INTO `base_administrative_division` VALUES ('500200', '重庆市县', '500000'); +INSERT INTO `base_administrative_division` VALUES ('500223', '重庆市潼南县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500224', '重庆市铜梁县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500226', '重庆市荣昌县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500227', '重庆市璧山县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500228', '重庆市梁平县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500229', '重庆市城口县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500230', '重庆市丰都县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500231', '重庆市垫江县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500232', '重庆市武隆县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500233', '重庆市忠县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500234', '重庆市开县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500235', '重庆市云阳县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500236', '重庆市奉节县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500237', '重庆市巫山县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500238', '重庆市巫溪县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500240', '重庆市石柱土家族自治县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500241', '重庆市秀山土家族苗族自治县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500242', '重庆市酉阳土家族苗族自治县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('500243', '重庆市彭水苗族土家族自治县', '500200'); +INSERT INTO `base_administrative_division` VALUES ('510000', '四川省', '0'); +INSERT INTO `base_administrative_division` VALUES ('510100', '四川省成都市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510101', '四川省成都市市辖区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510104', '四川省成都市锦江区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510105', '四川省成都市青羊区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510106', '四川省成都市金牛区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510107', '四川省成都市武侯区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510108', '四川省成都市成华区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510112', '四川省成都市龙泉驿区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510113', '四川省成都市青白江区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510114', '四川省成都市新都区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510115', '四川省成都市温江区', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510121', '四川省金堂县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510122', '四川省双流县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510124', '四川省郫县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510129', '四川省大邑县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510131', '四川省蒲江县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510132', '四川省新津县', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510181', '四川省都江堰市', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510182', '四川省彭州市', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510183', '四川省邛崃市', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510184', '四川省崇州市', '510100'); +INSERT INTO `base_administrative_division` VALUES ('510300', '四川省自贡市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510301', '四川省自贡市市辖区', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510302', '四川省自贡市自流井区', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510303', '四川省自贡市贡井区', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510304', '四川省自贡市大安区', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510311', '四川省自贡市沿滩区', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510321', '四川省荣县', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510322', '四川省富顺县', '510300'); +INSERT INTO `base_administrative_division` VALUES ('510400', '四川省攀枝花市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510401', '四川省攀枝花市市辖区', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510402', '四川省攀枝花市东区', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510403', '四川省攀枝花市西区', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510411', '四川省攀枝花市仁和区', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510421', '四川省米易县', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510422', '四川省盐边县', '510400'); +INSERT INTO `base_administrative_division` VALUES ('510500', '四川省泸州市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510501', '四川省泸州市市辖区', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510502', '四川省泸州市江阳区', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510503', '四川省泸州市纳溪区', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510504', '四川省泸州市龙马潭区', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510521', '四川省泸县', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510522', '四川省合江县', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510524', '四川省叙永县', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510525', '四川省古蔺县', '510500'); +INSERT INTO `base_administrative_division` VALUES ('510600', '四川省德阳市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510601', '四川省德阳市市辖区', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510603', '四川省德阳市旌阳区', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510623', '四川省中江县', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510626', '四川省罗江县', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510681', '四川省广汉市', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510682', '四川省什邡市', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510683', '四川省绵竹市', '510600'); +INSERT INTO `base_administrative_division` VALUES ('510700', '四川省绵阳市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510701', '四川省绵阳市市辖区', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510703', '四川省绵阳市涪城区', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510704', '四川省绵阳市游仙区', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510722', '四川省三台县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510723', '四川省盐亭县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510724', '四川省安县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510725', '四川省梓潼县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510726', '四川省北川羌族自治县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510727', '四川省平武县', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510781', '四川省江油市', '510700'); +INSERT INTO `base_administrative_division` VALUES ('510800', '四川省广元市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510801', '四川省广元市市辖区', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510802', '四川省广元市利州区', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510811', '四川省广元市元坝区', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510812', '四川省广元市朝天区', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510821', '四川省旺苍县', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510822', '四川省青川县', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510823', '四川省剑阁县', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510824', '四川省苍溪县', '510800'); +INSERT INTO `base_administrative_division` VALUES ('510900', '四川省遂宁市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('510901', '四川省遂宁市市辖区', '510900'); +INSERT INTO `base_administrative_division` VALUES ('510903', '四川省遂宁市船山区', '510900'); +INSERT INTO `base_administrative_division` VALUES ('510904', '四川省遂宁市安居区', '510900'); +INSERT INTO `base_administrative_division` VALUES ('510921', '四川省蓬溪县', '510900'); +INSERT INTO `base_administrative_division` VALUES ('510922', '四川省射洪县', '510900'); +INSERT INTO `base_administrative_division` VALUES ('510923', '四川省大英县', '510900'); +INSERT INTO `base_administrative_division` VALUES ('511000', '四川省内江市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511001', '四川省内江市市辖区', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511002', '四川省内江市市中区', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511011', '四川省内江市东兴区', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511024', '四川省威远县', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511025', '四川省资中县', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511028', '四川省隆昌县', '511000'); +INSERT INTO `base_administrative_division` VALUES ('511100', '四川省乐山市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511101', '四川省乐山市市辖区', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511102', '四川省乐山市市中区', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511111', '四川省乐山市沙湾区', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511112', '四川省乐山市五通桥区', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511113', '四川省乐山市金口河区', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511123', '四川省犍为县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511124', '四川省井研县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511126', '四川省夹江县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511129', '四川省沐川县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511132', '四川省峨边彝族自治县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511133', '四川省马边彝族自治县', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511181', '四川省峨眉山市', '511100'); +INSERT INTO `base_administrative_division` VALUES ('511300', '四川省南充市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511301', '四川省南充市市辖区', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511302', '四川省南充市顺庆区', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511303', '四川省南充市高坪区', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511304', '四川省南充市嘉陵区', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511321', '四川省南部县', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511322', '四川省营山县', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511323', '四川省蓬安县', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511324', '四川省仪陇县', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511325', '四川省西充县', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511381', '四川省阆中市', '511300'); +INSERT INTO `base_administrative_division` VALUES ('511400', '四川省眉山市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511401', '四川省眉山市市辖区', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511402', '四川省眉山市东坡区', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511421', '四川省仁寿县', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511422', '四川省彭山县', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511423', '四川省洪雅县', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511424', '四川省丹棱县', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511425', '四川省青神县', '511400'); +INSERT INTO `base_administrative_division` VALUES ('511500', '四川省宜宾市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511501', '四川省宜宾市市辖区', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511502', '四川省宜宾市翠屏区', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511503', '四川省宜宾市南溪区', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511521', '四川省宜宾县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511523', '四川省江安县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511524', '四川省长宁县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511525', '四川省高县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511526', '四川省珙县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511527', '四川省筠连县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511528', '四川省兴文县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511529', '四川省屏山县', '511500'); +INSERT INTO `base_administrative_division` VALUES ('511600', '四川省广安市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511601', '四川省广安市市辖区', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511602', '四川省广安市广安区', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511621', '四川省岳池县', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511622', '四川省武胜县', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511623', '四川省邻水县', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511681', '四川省华蓥市', '511600'); +INSERT INTO `base_administrative_division` VALUES ('511700', '四川省达州市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511701', '四川省达州市市辖区', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511702', '四川省达州市通川区', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511721', '四川省达县', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511722', '四川省宣汉县', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511723', '四川省开江县', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511724', '四川省大竹县', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511725', '四川省渠县', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511781', '四川省万源市', '511700'); +INSERT INTO `base_administrative_division` VALUES ('511800', '四川省雅安市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511801', '四川省雅安市市辖区', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511802', '四川省雅安市雨城区', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511821', '四川省名山县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511822', '四川省荥经县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511823', '四川省汉源县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511824', '四川省石棉县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511825', '四川省天全县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511826', '四川省芦山县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511827', '四川省宝兴县', '511800'); +INSERT INTO `base_administrative_division` VALUES ('511900', '四川省巴中市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('511901', '四川省巴中市市辖区', '511900'); +INSERT INTO `base_administrative_division` VALUES ('511902', '四川省巴中市巴州区', '511900'); +INSERT INTO `base_administrative_division` VALUES ('511921', '四川省通江县', '511900'); +INSERT INTO `base_administrative_division` VALUES ('511922', '四川省南江县', '511900'); +INSERT INTO `base_administrative_division` VALUES ('511923', '四川省平昌县', '511900'); +INSERT INTO `base_administrative_division` VALUES ('512000', '四川省资阳市', '510000'); +INSERT INTO `base_administrative_division` VALUES ('512001', '四川省资阳市市辖区', '512000'); +INSERT INTO `base_administrative_division` VALUES ('512002', '四川省资阳市雁江区', '512000'); +INSERT INTO `base_administrative_division` VALUES ('512021', '四川省安岳县', '512000'); +INSERT INTO `base_administrative_division` VALUES ('512022', '四川省乐至县', '512000'); +INSERT INTO `base_administrative_division` VALUES ('512081', '四川省简阳市', '512000'); +INSERT INTO `base_administrative_division` VALUES ('513200', '四川省阿坝藏族羌族自治州', '510000'); +INSERT INTO `base_administrative_division` VALUES ('513221', '四川省汶川县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513222', '四川省理县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513223', '四川省茂县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513224', '四川省松潘县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513225', '四川省九寨沟县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513226', '四川省金川县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513227', '四川省小金县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513228', '四川省黑水县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513229', '四川省马尔康县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513230', '四川省壤塘县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513231', '四川省阿坝县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513232', '四川省若尔盖县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513233', '四川省红原县', '513200'); +INSERT INTO `base_administrative_division` VALUES ('513300', '四川省甘孜藏族自治州', '510000'); +INSERT INTO `base_administrative_division` VALUES ('513321', '四川省康定县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513322', '四川省泸定县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513323', '四川省丹巴县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513324', '四川省九龙县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513325', '四川省雅江县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513326', '四川省道孚县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513327', '四川省炉霍县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513328', '四川省甘孜县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513329', '四川省新龙县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513330', '四川省德格县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513331', '四川省白玉县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513332', '四川省石渠县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513333', '四川省色达县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513334', '四川省理塘县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513335', '四川省巴塘县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513336', '四川省乡城县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513337', '四川省稻城县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513338', '四川省得荣县', '513300'); +INSERT INTO `base_administrative_division` VALUES ('513400', '四川省凉山彝族自治州', '510000'); +INSERT INTO `base_administrative_division` VALUES ('513401', '四川省西昌市', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513422', '四川省木里藏族自治县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513423', '四川省盐源县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513424', '四川省德昌县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513425', '四川省会理县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513426', '四川省会东县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513427', '四川省宁南县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513428', '四川省普格县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513429', '四川省布拖县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513430', '四川省金阳县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513431', '四川省昭觉县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513432', '四川省喜德县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513433', '四川省冕宁县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513434', '四川省越西县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513435', '四川省甘洛县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513436', '四川省美姑县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('513437', '四川省雷波县', '513400'); +INSERT INTO `base_administrative_division` VALUES ('520000', '贵州省', '0'); +INSERT INTO `base_administrative_division` VALUES ('520100', '贵州省贵阳市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520101', '贵州省贵阳市市辖区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520102', '贵州省贵阳市南明区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520103', '贵州省贵阳市云岩区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520111', '贵州省贵阳市花溪区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520112', '贵州省贵阳市乌当区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520113', '贵州省贵阳市白云区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520114', '贵州省贵阳市小河区', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520121', '贵州省开阳县', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520122', '贵州省息烽县', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520123', '贵州省修文县', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520181', '贵州省清镇市', '520100'); +INSERT INTO `base_administrative_division` VALUES ('520200', '贵州省六盘水市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520201', '贵州省六盘水市钟山区', '520200'); +INSERT INTO `base_administrative_division` VALUES ('520203', '贵州省六盘水市六枝特区', '520200'); +INSERT INTO `base_administrative_division` VALUES ('520221', '贵州省水城县', '520200'); +INSERT INTO `base_administrative_division` VALUES ('520222', '贵州省盘县', '520200'); +INSERT INTO `base_administrative_division` VALUES ('520300', '贵州省遵义市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520301', '贵州省遵义市市辖区', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520302', '贵州省遵义市红花岗区', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520303', '贵州省遵义市汇川区', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520321', '贵州省遵义县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520322', '贵州省桐梓县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520323', '贵州省绥阳县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520324', '贵州省正安县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520325', '贵州省道真仡佬族苗族自治县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520326', '贵州省务川仡佬族苗族自治县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520327', '贵州省凤冈县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520328', '贵州省湄潭县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520329', '贵州省余庆县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520330', '贵州省习水县', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520381', '贵州省赤水市', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520382', '贵州省仁怀市', '520300'); +INSERT INTO `base_administrative_division` VALUES ('520400', '贵州省安顺市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520401', '贵州省安顺市市辖区', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520402', '贵州省安顺市西秀区', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520421', '贵州省平坝县', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520422', '贵州省普定县', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520423', '贵州省镇宁布依族苗族自治县', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520424', '贵州省关岭布依族苗族自治县', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520425', '贵州省紫云苗族布依族自治县', '520400'); +INSERT INTO `base_administrative_division` VALUES ('520500', '贵州省毕节市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520501', '贵州省毕节市市辖区', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520502', '贵州省毕节市七星关区', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520521', '贵州省大方县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520522', '贵州省黔西县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520523', '贵州省金沙县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520524', '贵州省织金县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520525', '贵州省纳雍县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520526', '贵州省威宁彝族回族苗族自治县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520527', '贵州省赫章县', '520500'); +INSERT INTO `base_administrative_division` VALUES ('520600', '贵州省铜仁市', '520000'); +INSERT INTO `base_administrative_division` VALUES ('520601', '贵州省铜仁市市辖区', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520602', '贵州省铜仁市碧江区', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520603', '贵州省铜仁市万山区', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520621', '贵州省江口县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520622', '贵州省玉屏侗族自治县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520623', '贵州省石阡县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520624', '贵州省思南县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520625', '贵州省印江土家族苗族自治县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520626', '贵州省德江县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520627', '贵州省沿河土家族自治县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('520628', '贵州省松桃苗族自治县', '520600'); +INSERT INTO `base_administrative_division` VALUES ('522300', '贵州省黔西南布依族苗族自治州', '520000'); +INSERT INTO `base_administrative_division` VALUES ('522301', '贵州省兴义市', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522322', '贵州省兴仁县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522323', '贵州省普安县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522324', '贵州省晴隆县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522325', '贵州省贞丰县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522326', '贵州省望谟县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522327', '贵州省册亨县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522328', '贵州省安龙县', '522300'); +INSERT INTO `base_administrative_division` VALUES ('522600', '贵州省黔东南苗族侗族自治州', '520000'); +INSERT INTO `base_administrative_division` VALUES ('522601', '贵州省凯里市', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522622', '贵州省黄平县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522623', '贵州省施秉县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522624', '贵州省三穗县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522625', '贵州省镇远县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522626', '贵州省岑巩县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522627', '贵州省天柱县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522628', '贵州省锦屏县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522629', '贵州省剑河县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522630', '贵州省台江县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522631', '贵州省黎平县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522632', '贵州省榕江县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522633', '贵州省从江县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522634', '贵州省雷山县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522635', '贵州省麻江县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522636', '贵州省丹寨县', '522600'); +INSERT INTO `base_administrative_division` VALUES ('522700', '贵州省黔南布依族苗族自治州', '520000'); +INSERT INTO `base_administrative_division` VALUES ('522701', '贵州省都匀市', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522702', '贵州省福泉市', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522722', '贵州省荔波县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522723', '贵州省贵定县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522725', '贵州省瓮安县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522726', '贵州省独山县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522727', '贵州省平塘县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522728', '贵州省罗甸县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522729', '贵州省长顺县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522730', '贵州省龙里县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522731', '贵州省惠水县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('522732', '贵州省三都水族自治县', '522700'); +INSERT INTO `base_administrative_division` VALUES ('530000', '云南省', '0'); +INSERT INTO `base_administrative_division` VALUES ('530100', '云南省昆明市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530101', '云南省昆明市市辖区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530102', '云南省昆明市五华区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530103', '云南省昆明市盘龙区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530111', '云南省昆明市官渡区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530112', '云南省昆明市西山区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530113', '云南省昆明市东川区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530114', '云南省昆明市呈贡区', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530122', '云南省晋宁县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530124', '云南省富民县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530125', '云南省宜良县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530126', '云南省石林彝族自治县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530127', '云南省嵩明县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530128', '云南省禄劝彝族苗族自治县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530129', '云南省寻甸回族彝族自治县', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530181', '云南省安宁市', '530100'); +INSERT INTO `base_administrative_division` VALUES ('530300', '云南省曲靖市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530301', '云南省曲靖市市辖区', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530302', '云南省曲靖市麒麟区', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530321', '云南省马龙县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530322', '云南省陆良县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530323', '云南省师宗县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530324', '云南省罗平县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530325', '云南省富源县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530326', '云南省会泽县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530328', '云南省沾益县', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530381', '云南省宣威市', '530300'); +INSERT INTO `base_administrative_division` VALUES ('530400', '云南省玉溪市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530401', '云南省玉溪市市辖区', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530402', '云南省玉溪市红塔区', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530421', '云南省江川县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530422', '云南省澄江县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530423', '云南省通海县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530424', '云南省华宁县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530425', '云南省易门县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530426', '云南省峨山彝族自治县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530427', '云南省新平彝族傣族自治县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530428', '云南省元江哈尼族彝族傣族自治县', '530400'); +INSERT INTO `base_administrative_division` VALUES ('530500', '云南省保山市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530501', '云南省保山市市辖区', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530502', '云南省保山市隆阳区', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530521', '云南省施甸县', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530522', '云南省腾冲县', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530523', '云南省龙陵县', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530524', '云南省昌宁县', '530500'); +INSERT INTO `base_administrative_division` VALUES ('530600', '云南省昭通市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530601', '云南省昭通市市辖区', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530602', '云南省昭通市昭阳区', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530621', '云南省鲁甸县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530622', '云南省巧家县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530623', '云南省盐津县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530624', '云南省大关县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530625', '云南省永善县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530626', '云南省绥江县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530627', '云南省镇雄县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530628', '云南省彝良县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530629', '云南省威信县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530630', '云南省水富县', '530600'); +INSERT INTO `base_administrative_division` VALUES ('530700', '云南省丽江市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530701', '云南省丽江市市辖区', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530702', '云南省丽江市古城区', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530721', '云南省玉龙纳西族自治县', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530722', '云南省永胜县', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530723', '云南省华坪县', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530724', '云南省宁蒗彝族自治县', '530700'); +INSERT INTO `base_administrative_division` VALUES ('530800', '云南省普洱市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530801', '云南省普洱市市辖区', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530802', '云南省普洱市思茅区', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530821', '云南省宁洱哈尼族彝族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530822', '云南省墨江哈尼族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530823', '云南省景东彝族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530824', '云南省景谷傣族彝族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530825', '云南省镇沅彝族哈尼族拉祜族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530826', '云南省江城哈尼族彝族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530827', '云南省孟连傣族拉祜族佤族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530828', '云南省澜沧拉祜族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530829', '云南省西盟佤族自治县', '530800'); +INSERT INTO `base_administrative_division` VALUES ('530900', '云南省临沧市', '530000'); +INSERT INTO `base_administrative_division` VALUES ('530901', '云南省临沧市市辖区', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530902', '云南省临沧市临翔区', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530921', '云南省凤庆县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530922', '云南省云县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530923', '云南省永德县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530924', '云南省镇康县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530925', '云南省双江拉祜族佤族布朗族傣族自治县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530926', '云南省耿马傣族佤族自治县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('530927', '云南省沧源佤族自治县', '530900'); +INSERT INTO `base_administrative_division` VALUES ('532300', '云南省楚雄彝族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('532301', '云南省楚雄市', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532322', '云南省双柏县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532323', '云南省牟定县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532324', '云南省南华县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532325', '云南省姚安县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532326', '云南省大姚县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532327', '云南省永仁县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532328', '云南省元谋县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532329', '云南省武定县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532331', '云南省禄丰县', '532300'); +INSERT INTO `base_administrative_division` VALUES ('532500', '云南省红河哈尼族彝族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('532501', '云南省个旧市', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532502', '云南省开远市', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532503', '云南省蒙自市', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532523', '云南省屏边苗族自治县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532524', '云南省建水县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532525', '云南省石屏县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532526', '云南省弥勒县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532527', '云南省泸西县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532528', '云南省元阳县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532529', '云南省红河县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532530', '云南省金平苗族瑶族傣族自治县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532531', '云南省绿春县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532532', '云南省河口瑶族自治县', '532500'); +INSERT INTO `base_administrative_division` VALUES ('532600', '云南省文山壮族苗族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('532601', '云南省文山市', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532622', '云南省砚山县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532623', '云南省西畴县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532624', '云南省麻栗坡县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532625', '云南省马关县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532626', '云南省丘北县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532627', '云南省广南县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532628', '云南省富宁县', '532600'); +INSERT INTO `base_administrative_division` VALUES ('532800', '云南省西双版纳傣族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('532801', '云南省景洪市', '532800'); +INSERT INTO `base_administrative_division` VALUES ('532822', '云南省勐海县', '532800'); +INSERT INTO `base_administrative_division` VALUES ('532823', '云南省勐腊县', '532800'); +INSERT INTO `base_administrative_division` VALUES ('532900', '云南省大理白族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('532901', '云南省大理市', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532922', '云南省漾濞彝族自治县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532923', '云南省祥云县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532924', '云南省宾川县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532925', '云南省弥渡县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532926', '云南省南涧彝族自治县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532927', '云南省巍山彝族回族自治县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532928', '云南省永平县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532929', '云南省云龙县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532930', '云南省洱源县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532931', '云南省剑川县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('532932', '云南省鹤庆县', '532900'); +INSERT INTO `base_administrative_division` VALUES ('533100', '云南省德宏傣族景颇族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('533102', '云南省瑞丽市', '533100'); +INSERT INTO `base_administrative_division` VALUES ('533103', '云南省芒市', '533100'); +INSERT INTO `base_administrative_division` VALUES ('533122', '云南省梁河县', '533100'); +INSERT INTO `base_administrative_division` VALUES ('533123', '云南省盈江县', '533100'); +INSERT INTO `base_administrative_division` VALUES ('533124', '云南省陇川县', '533100'); +INSERT INTO `base_administrative_division` VALUES ('533300', '云南省怒江傈僳族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('533321', '云南省泸水县', '533300'); +INSERT INTO `base_administrative_division` VALUES ('533323', '云南省福贡县', '533300'); +INSERT INTO `base_administrative_division` VALUES ('533324', '云南省贡山独龙族怒族自治县', '533300'); +INSERT INTO `base_administrative_division` VALUES ('533325', '云南省兰坪白族普米族自治县', '533300'); +INSERT INTO `base_administrative_division` VALUES ('533400', '云南省迪庆藏族自治州', '530000'); +INSERT INTO `base_administrative_division` VALUES ('533421', '云南省香格里拉县', '533400'); +INSERT INTO `base_administrative_division` VALUES ('533422', '云南省德钦县', '533400'); +INSERT INTO `base_administrative_division` VALUES ('533423', '云南省维西傈僳族自治县', '533400'); +INSERT INTO `base_administrative_division` VALUES ('540000', '西藏自治区', '0'); +INSERT INTO `base_administrative_division` VALUES ('540100', '西藏拉萨市', '540000'); +INSERT INTO `base_administrative_division` VALUES ('540101', '西藏拉萨市市辖区', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540102', '西藏拉萨市城关区', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540121', '西藏林周县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540122', '西藏当雄县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540123', '西藏尼木县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540124', '西藏曲水县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540125', '西藏堆龙德庆县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540126', '西藏达孜县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('540127', '西藏墨竹工卡县', '540100'); +INSERT INTO `base_administrative_division` VALUES ('542100', '西藏昌都地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542121', '西藏昌都县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542122', '西藏江达县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542123', '西藏贡觉县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542124', '西藏类乌齐县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542125', '西藏丁青县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542126', '西藏察雅县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542127', '西藏八宿县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542128', '西藏左贡县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542129', '西藏芒康县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542132', '西藏洛隆县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542133', '西藏边坝县', '542100'); +INSERT INTO `base_administrative_division` VALUES ('542200', '西藏山南地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542221', '西藏乃东县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542222', '西藏扎囊县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542223', '西藏贡嘎县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542224', '西藏桑日县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542225', '西藏琼结县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542226', '西藏曲松县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542227', '西藏措美县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542228', '西藏洛扎县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542229', '西藏加查县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542231', '西藏隆子县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542232', '西藏错那县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542233', '西藏浪卡子县', '542200'); +INSERT INTO `base_administrative_division` VALUES ('542300', '西藏日喀则地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542301', '西藏日喀则市', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542322', '西藏南木林县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542323', '西藏江孜县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542324', '西藏定日县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542325', '西藏萨迦县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542326', '西藏拉孜县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542327', '西藏昂仁县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542328', '西藏谢通门县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542329', '西藏白朗县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542330', '西藏仁布县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542331', '西藏康马县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542332', '西藏定结县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542333', '西藏仲巴县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542334', '西藏亚东县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542335', '西藏吉隆县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542336', '西藏聂拉木县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542337', '西藏萨嘎县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542338', '西藏岗巴县', '542300'); +INSERT INTO `base_administrative_division` VALUES ('542400', '西藏那曲地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542421', '西藏那曲县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542422', '西藏嘉黎县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542423', '西藏比如县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542424', '西藏聂荣县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542425', '西藏安多县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542426', '西藏申扎县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542427', '西藏索县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542428', '西藏班戈县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542429', '西藏巴青县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542430', '西藏尼玛县', '542400'); +INSERT INTO `base_administrative_division` VALUES ('542500', '西藏阿里地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542521', '西藏普兰县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542522', '西藏札达县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542523', '西藏噶尔县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542524', '西藏日土县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542525', '西藏革吉县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542526', '西藏改则县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542527', '西藏措勤县', '542500'); +INSERT INTO `base_administrative_division` VALUES ('542600', '西藏林芝地区', '540000'); +INSERT INTO `base_administrative_division` VALUES ('542621', '西藏林芝县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542622', '西藏工布江达县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542623', '西藏米林县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542624', '西藏墨脱县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542625', '西藏波密县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542626', '西藏察隅县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('542627', '西藏朗县', '542600'); +INSERT INTO `base_administrative_division` VALUES ('610000', '陕西省', '0'); +INSERT INTO `base_administrative_division` VALUES ('610100', '陕西省西安市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610101', '陕西省西安市市辖区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610102', '陕西省西安市新城区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610103', '陕西省西安市碑林区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610104', '陕西省西安市莲湖区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610111', '陕西省西安市灞桥区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610112', '陕西省西安市未央区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610113', '陕西省西安市雁塔区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610114', '陕西省西安市阎良区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610115', '陕西省西安市临潼区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610116', '陕西省西安市长安区', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610122', '陕西省蓝田县', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610124', '陕西省周至县', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610125', '陕西省户县', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610126', '陕西省高陵县', '610100'); +INSERT INTO `base_administrative_division` VALUES ('610200', '陕西省铜川市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610201', '陕西省铜川市市辖区', '610200'); +INSERT INTO `base_administrative_division` VALUES ('610202', '陕西省铜川市王益区', '610200'); +INSERT INTO `base_administrative_division` VALUES ('610203', '陕西省铜川市印台区', '610200'); +INSERT INTO `base_administrative_division` VALUES ('610204', '陕西省铜川市耀州区', '610200'); +INSERT INTO `base_administrative_division` VALUES ('610222', '陕西省宜君县', '610200'); +INSERT INTO `base_administrative_division` VALUES ('610300', '陕西省宝鸡市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610301', '陕西省宝鸡市市辖区', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610302', '陕西省宝鸡市渭滨区', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610303', '陕西省宝鸡市金台区', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610304', '陕西省宝鸡市陈仓区', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610322', '陕西省凤翔县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610323', '陕西省岐山县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610324', '陕西省扶风县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610326', '陕西省眉县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610327', '陕西省陇县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610328', '陕西省千阳县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610329', '陕西省麟游县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610330', '陕西省凤县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610331', '陕西省太白县', '610300'); +INSERT INTO `base_administrative_division` VALUES ('610400', '陕西省咸阳市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610401', '陕西省咸阳市市辖区', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610402', '陕西省咸阳市秦都区', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610403', '陕西省杨凌示范区', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610404', '陕西省咸阳市渭城区', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610422', '陕西省三原县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610423', '陕西省泾阳县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610424', '陕西省乾县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610425', '陕西省礼泉县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610426', '陕西省永寿县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610427', '陕西省彬县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610428', '陕西省长武县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610429', '陕西省旬邑县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610430', '陕西省淳化县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610431', '陕西省武功县', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610481', '陕西省兴平市', '610400'); +INSERT INTO `base_administrative_division` VALUES ('610500', '陕西省渭南市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610501', '陕西省渭南市市辖区', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610502', '陕西省渭南市临渭区', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610521', '陕西省华县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610522', '陕西省潼关县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610523', '陕西省大荔县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610524', '陕西省合阳县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610525', '陕西省澄城县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610526', '陕西省蒲城县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610527', '陕西省白水县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610528', '陕西省富平县', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610581', '陕西省韩城市', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610582', '陕西省华阴市', '610500'); +INSERT INTO `base_administrative_division` VALUES ('610600', '陕西省延安市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610601', '陕西省延安市市辖区', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610602', '陕西省延安市宝塔区', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610621', '陕西省延长县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610622', '陕西省延川县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610623', '陕西省子长县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610624', '陕西省安塞县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610625', '陕西省志丹县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610626', '陕西省吴起县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610627', '陕西省甘泉县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610628', '陕西省富县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610629', '陕西省洛川县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610630', '陕西省宜川县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610631', '陕西省黄龙县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610632', '陕西省黄陵县', '610600'); +INSERT INTO `base_administrative_division` VALUES ('610700', '陕西省汉中市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610701', '陕西省汉中市市辖区', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610702', '陕西省汉中市汉台区', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610721', '陕西省南郑县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610722', '陕西省城固县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610723', '陕西省洋县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610724', '陕西省西乡县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610725', '陕西省勉县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610726', '陕西省宁强县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610727', '陕西省略阳县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610728', '陕西省镇巴县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610729', '陕西省留坝县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610730', '陕西省佛坪县', '610700'); +INSERT INTO `base_administrative_division` VALUES ('610800', '陕西省榆林市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610801', '陕西省榆林市市辖区', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610802', '陕西省榆林市榆阳区', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610821', '陕西省神木县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610822', '陕西省府谷县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610823', '陕西省横山县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610824', '陕西省靖边县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610825', '陕西省定边县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610826', '陕西省绥德县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610827', '陕西省米脂县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610828', '陕西省佳县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610829', '陕西省吴堡县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610830', '陕西省清涧县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610831', '陕西省子洲县', '610800'); +INSERT INTO `base_administrative_division` VALUES ('610900', '陕西省安康市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('610901', '陕西省安康市市辖区', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610902', '陕西省安康市汉滨区', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610921', '陕西省汉阴县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610922', '陕西省石泉县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610923', '陕西省宁陕县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610924', '陕西省紫阳县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610925', '陕西省岚皋县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610926', '陕西省平利县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610927', '陕西省镇坪县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610928', '陕西省旬阳县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('610929', '陕西省白河县', '610900'); +INSERT INTO `base_administrative_division` VALUES ('611000', '陕西省商洛市', '610000'); +INSERT INTO `base_administrative_division` VALUES ('611001', '陕西省商洛市市辖区', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611002', '陕西省商洛市商州区', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611021', '陕西省洛南县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611022', '陕西省丹凤县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611023', '陕西省商南县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611024', '陕西省山阳县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611025', '陕西省镇安县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('611026', '陕西省柞水县', '611000'); +INSERT INTO `base_administrative_division` VALUES ('620000', '甘肃省', '0'); +INSERT INTO `base_administrative_division` VALUES ('620100', '甘肃省兰州市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620101', '甘肃省兰州市市辖区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620102', '甘肃省兰州市城关区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620103', '甘肃省兰州市七里河区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620104', '甘肃省兰州市西固区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620105', '甘肃省兰州市安宁区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620111', '甘肃省兰州市红古区', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620121', '甘肃省永登县', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620122', '甘肃省皋兰县', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620123', '甘肃省榆中县', '620100'); +INSERT INTO `base_administrative_division` VALUES ('620200', '甘肃省嘉峪关市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620201', '甘肃省嘉峪关市市辖区', '620200'); +INSERT INTO `base_administrative_division` VALUES ('620300', '甘肃省金昌市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620301', '甘肃省金昌市市辖区', '620300'); +INSERT INTO `base_administrative_division` VALUES ('620302', '甘肃省金昌市金川区', '620300'); +INSERT INTO `base_administrative_division` VALUES ('620321', '甘肃省永昌县', '620300'); +INSERT INTO `base_administrative_division` VALUES ('620400', '甘肃省白银市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620401', '甘肃省白银市市辖区', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620402', '甘肃省白银市白银区', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620403', '甘肃省白银市平川区', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620421', '甘肃省靖远县', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620422', '甘肃省会宁县', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620423', '甘肃省景泰县', '620400'); +INSERT INTO `base_administrative_division` VALUES ('620500', '甘肃省天水市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620501', '甘肃省天水市市辖区', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620502', '甘肃省天水市秦州区', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620503', '甘肃省天水市麦积区', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620521', '甘肃省清水县', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620522', '甘肃省秦安县', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620523', '甘肃省甘谷县', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620524', '甘肃省武山县', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620525', '甘肃省张家川回族自治县', '620500'); +INSERT INTO `base_administrative_division` VALUES ('620600', '甘肃省武威市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620601', '甘肃省武威市市辖区', '620600'); +INSERT INTO `base_administrative_division` VALUES ('620602', '甘肃省武威市凉州区', '620600'); +INSERT INTO `base_administrative_division` VALUES ('620621', '甘肃省民勤县', '620600'); +INSERT INTO `base_administrative_division` VALUES ('620622', '甘肃省古浪县', '620600'); +INSERT INTO `base_administrative_division` VALUES ('620623', '甘肃省天祝藏族自治县', '620600'); +INSERT INTO `base_administrative_division` VALUES ('620700', '甘肃省张掖市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620701', '甘肃省张掖市市辖区', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620702', '甘肃省张掖市甘州区', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620721', '甘肃省肃南裕固族自治县', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620722', '甘肃省民乐县', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620723', '甘肃省临泽县', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620724', '甘肃省高台县', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620725', '甘肃省山丹县', '620700'); +INSERT INTO `base_administrative_division` VALUES ('620800', '甘肃省平凉市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620801', '甘肃省平凉市市辖区', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620802', '甘肃省平凉市崆峒区', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620821', '甘肃省泾川县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620822', '甘肃省灵台县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620823', '甘肃省崇信县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620824', '甘肃省华亭县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620825', '甘肃省庄浪县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620826', '甘肃省静宁县', '620800'); +INSERT INTO `base_administrative_division` VALUES ('620900', '甘肃省酒泉市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('620901', '甘肃省酒泉市市辖区', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620902', '甘肃省酒泉市肃州区', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620921', '甘肃省金塔县', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620922', '甘肃省瓜州县', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620923', '甘肃省肃北蒙古族自治县', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620924', '甘肃省阿克塞哈萨克族自治县', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620981', '甘肃省玉门市', '620900'); +INSERT INTO `base_administrative_division` VALUES ('620982', '甘肃省敦煌市', '620900'); +INSERT INTO `base_administrative_division` VALUES ('621000', '甘肃省庆阳市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('621001', '甘肃省庆阳市市辖区', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621002', '甘肃省庆阳市西峰区', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621021', '甘肃省庆城县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621022', '甘肃省环县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621023', '甘肃省华池县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621024', '甘肃省合水县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621025', '甘肃省正宁县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621026', '甘肃省宁县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621027', '甘肃省镇原县', '621000'); +INSERT INTO `base_administrative_division` VALUES ('621100', '甘肃省定西市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('621101', '甘肃省定西市市辖区', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621102', '甘肃省定西市安定区', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621121', '甘肃省通渭县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621122', '甘肃省陇西县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621123', '甘肃省渭源县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621124', '甘肃省临洮县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621125', '甘肃省漳县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621126', '甘肃省岷县', '621100'); +INSERT INTO `base_administrative_division` VALUES ('621200', '甘肃省陇南市', '620000'); +INSERT INTO `base_administrative_division` VALUES ('621201', '甘肃省陇南市市辖区', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621202', '甘肃省陇南市武都区', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621221', '甘肃省成县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621222', '甘肃省文县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621223', '甘肃省宕昌县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621224', '甘肃省康县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621225', '甘肃省西和县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621226', '甘肃省礼县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621227', '甘肃省徽县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('621228', '甘肃省两当县', '621200'); +INSERT INTO `base_administrative_division` VALUES ('622900', '甘肃省临夏回族自治州', '620000'); +INSERT INTO `base_administrative_division` VALUES ('622901', '甘肃省临夏市', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622921', '甘肃省临夏县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622922', '甘肃省康乐县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622923', '甘肃省永靖县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622924', '甘肃省广河县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622925', '甘肃省和政县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622926', '甘肃省东乡族自治县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('622927', '甘肃省积石山保安族东乡族撒拉族自治县', '622900'); +INSERT INTO `base_administrative_division` VALUES ('623000', '甘肃省甘南藏族自治州', '620000'); +INSERT INTO `base_administrative_division` VALUES ('623001', '甘肃省合作市', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623021', '甘肃省临潭县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623022', '甘肃省卓尼县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623023', '甘肃省舟曲县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623024', '甘肃省迭部县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623025', '甘肃省玛曲县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623026', '甘肃省碌曲县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('623027', '甘肃省夏河县', '623000'); +INSERT INTO `base_administrative_division` VALUES ('630000', '青海省', '0'); +INSERT INTO `base_administrative_division` VALUES ('630100', '青海省西宁市', '630000'); +INSERT INTO `base_administrative_division` VALUES ('630101', '青海省西宁市市辖区', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630102', '青海省西宁市城东区', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630103', '青海省西宁市城中区', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630104', '青海省西宁市城西区', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630105', '青海省西宁市城北区', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630121', '青海省大通回族土族自治县', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630122', '青海省湟中县', '630100'); +INSERT INTO `base_administrative_division` VALUES ('630123', '青海省湟源县', '630100'); +INSERT INTO `base_administrative_division` VALUES ('632100', '青海省海东地区', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632121', '青海省平安县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632122', '青海省民和回族土族自治县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632123', '青海省乐都县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632126', '青海省互助土族自治县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632127', '青海省化隆回族自治县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632128', '青海省循化撒拉族自治县', '632100'); +INSERT INTO `base_administrative_division` VALUES ('632200', '青海省海北藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632221', '青海省门源回族自治县', '632200'); +INSERT INTO `base_administrative_division` VALUES ('632222', '青海省祁连县', '632200'); +INSERT INTO `base_administrative_division` VALUES ('632223', '青海省海晏县', '632200'); +INSERT INTO `base_administrative_division` VALUES ('632224', '青海省刚察县', '632200'); +INSERT INTO `base_administrative_division` VALUES ('632300', '青海省黄南藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632321', '青海省同仁县', '632300'); +INSERT INTO `base_administrative_division` VALUES ('632322', '青海省尖扎县', '632300'); +INSERT INTO `base_administrative_division` VALUES ('632323', '青海省泽库县', '632300'); +INSERT INTO `base_administrative_division` VALUES ('632324', '青海省河南蒙古族自治县', '632300'); +INSERT INTO `base_administrative_division` VALUES ('632500', '青海省海南藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632521', '青海省共和县', '632500'); +INSERT INTO `base_administrative_division` VALUES ('632522', '青海省同德县', '632500'); +INSERT INTO `base_administrative_division` VALUES ('632523', '青海省贵德县', '632500'); +INSERT INTO `base_administrative_division` VALUES ('632524', '青海省兴海县', '632500'); +INSERT INTO `base_administrative_division` VALUES ('632525', '青海省贵南县', '632500'); +INSERT INTO `base_administrative_division` VALUES ('632600', '青海省果洛藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632621', '青海省玛沁县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632622', '青海省班玛县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632623', '青海省甘德县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632624', '青海省达日县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632625', '青海省久治县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632626', '青海省玛多县', '632600'); +INSERT INTO `base_administrative_division` VALUES ('632700', '青海省玉树藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632721', '青海省玉树县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632722', '青海省杂多县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632723', '青海省称多县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632724', '青海省治多县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632725', '青海省囊谦县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632726', '青海省曲麻莱县', '632700'); +INSERT INTO `base_administrative_division` VALUES ('632800', '青海省海西蒙古族藏族自治州', '630000'); +INSERT INTO `base_administrative_division` VALUES ('632801', '青海省格尔木市', '632800'); +INSERT INTO `base_administrative_division` VALUES ('632802', '青海省德令哈市', '632800'); +INSERT INTO `base_administrative_division` VALUES ('632821', '青海省乌兰县', '632800'); +INSERT INTO `base_administrative_division` VALUES ('632822', '青海省都兰县', '632800'); +INSERT INTO `base_administrative_division` VALUES ('632823', '青海省天峻县', '632800'); +INSERT INTO `base_administrative_division` VALUES ('640000', '宁夏回族自治区', '0'); +INSERT INTO `base_administrative_division` VALUES ('640100', '宁夏银川市', '640000'); +INSERT INTO `base_administrative_division` VALUES ('640101', '宁夏银川市市辖区', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640104', '宁夏银川市兴庆区', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640105', '宁夏银川市西夏区', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640106', '宁夏银川市金凤区', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640121', '宁夏永宁县', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640122', '宁夏贺兰县', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640181', '宁夏灵武市', '640100'); +INSERT INTO `base_administrative_division` VALUES ('640200', '宁夏石嘴山市', '640000'); +INSERT INTO `base_administrative_division` VALUES ('640201', '宁夏石嘴山市市辖区', '640200'); +INSERT INTO `base_administrative_division` VALUES ('640202', '宁夏石嘴山市大武口区', '640200'); +INSERT INTO `base_administrative_division` VALUES ('640205', '宁夏石嘴山市惠农区', '640200'); +INSERT INTO `base_administrative_division` VALUES ('640221', '宁夏平罗县', '640200'); +INSERT INTO `base_administrative_division` VALUES ('640300', '宁夏吴忠市', '640000'); +INSERT INTO `base_administrative_division` VALUES ('640301', '宁夏吴忠市市辖区', '640300'); +INSERT INTO `base_administrative_division` VALUES ('640302', '宁夏吴忠市利通区', '640300'); +INSERT INTO `base_administrative_division` VALUES ('640323', '宁夏盐池县', '640300'); +INSERT INTO `base_administrative_division` VALUES ('640324', '宁夏同心县', '640300'); +INSERT INTO `base_administrative_division` VALUES ('640381', '宁夏青铜峡市', '640300'); +INSERT INTO `base_administrative_division` VALUES ('640400', '宁夏固原市', '640000'); +INSERT INTO `base_administrative_division` VALUES ('640401', '宁夏固原市市辖区', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640402', '宁夏固原市原州区', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640422', '宁夏西吉县', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640423', '宁夏隆德县', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640424', '宁夏泾源县', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640425', '宁夏彭阳县', '640400'); +INSERT INTO `base_administrative_division` VALUES ('640500', '宁夏中卫市', '640000'); +INSERT INTO `base_administrative_division` VALUES ('640501', '宁夏中卫市市辖区', '640500'); +INSERT INTO `base_administrative_division` VALUES ('640502', '宁夏中卫市沙坡头区', '640500'); +INSERT INTO `base_administrative_division` VALUES ('640521', '宁夏中宁县', '640500'); +INSERT INTO `base_administrative_division` VALUES ('640522', '宁夏海原县', '640500'); +INSERT INTO `base_administrative_division` VALUES ('650000', '新疆维吾尔自治区', '0'); +INSERT INTO `base_administrative_division` VALUES ('650100', '新疆乌鲁木齐市', '650000'); +INSERT INTO `base_administrative_division` VALUES ('650101', '新疆乌鲁木齐市市辖区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650102', '新疆乌鲁木齐市天山区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650103', '新疆乌鲁木齐市沙依巴克区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650104', '新疆乌鲁木齐市新市区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650105', '新疆乌鲁木齐市水磨沟区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650106', '新疆乌鲁木齐市头屯河区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650107', '新疆乌鲁木齐市达坂城区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650109', '新疆乌鲁木齐市米东区', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650121', '新疆乌鲁木齐县', '650100'); +INSERT INTO `base_administrative_division` VALUES ('650200', '新疆克拉玛依市', '650000'); +INSERT INTO `base_administrative_division` VALUES ('650201', '新疆克拉玛依市市辖区', '650200'); +INSERT INTO `base_administrative_division` VALUES ('650202', '新疆克拉玛依市独山子区', '650200'); +INSERT INTO `base_administrative_division` VALUES ('650203', '新疆克拉玛依市克拉玛依区', '650200'); +INSERT INTO `base_administrative_division` VALUES ('650204', '新疆克拉玛依市白碱滩区', '650200'); +INSERT INTO `base_administrative_division` VALUES ('650205', '新疆克拉玛依市乌尔禾区', '650200'); +INSERT INTO `base_administrative_division` VALUES ('652100', '新疆克拉玛依市吐鲁番地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652101', '新疆吐鲁番市', '652100'); +INSERT INTO `base_administrative_division` VALUES ('652122', '新疆鄯善县', '652100'); +INSERT INTO `base_administrative_division` VALUES ('652123', '新疆托克逊县', '652100'); +INSERT INTO `base_administrative_division` VALUES ('652200', '新疆哈密地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652201', '新疆哈密市', '652200'); +INSERT INTO `base_administrative_division` VALUES ('652222', '新疆巴里坤哈萨克自治县', '652200'); +INSERT INTO `base_administrative_division` VALUES ('652223', '新疆伊吾县', '652200'); +INSERT INTO `base_administrative_division` VALUES ('652300', '新疆昌吉回族自治州', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652301', '新疆昌吉市', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652302', '新疆阜康市', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652323', '新疆呼图壁县', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652324', '新疆玛纳斯县', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652325', '新疆奇台县', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652327', '新疆吉木萨尔县', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652328', '新疆木垒哈萨克自治县', '652300'); +INSERT INTO `base_administrative_division` VALUES ('652700', '新疆博尔塔拉蒙古自治州', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652701', '新疆博乐市', '652700'); +INSERT INTO `base_administrative_division` VALUES ('652722', '新疆精河县', '652700'); +INSERT INTO `base_administrative_division` VALUES ('652723', '新疆温泉县', '652700'); +INSERT INTO `base_administrative_division` VALUES ('652800', '新疆巴音郭楞蒙古自治州', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652801', '新疆库尔勒市', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652822', '新疆轮台县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652823', '新疆尉犁县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652824', '新疆若羌县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652825', '新疆且末县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652826', '新疆焉耆回族自治县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652827', '新疆和静县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652828', '新疆和硕县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652829', '新疆博湖县', '652800'); +INSERT INTO `base_administrative_division` VALUES ('652900', '新疆阿克苏地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('652901', '新疆阿克苏市', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652922', '新疆温宿县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652923', '新疆库车县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652924', '新疆沙雅县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652925', '新疆新和县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652926', '新疆拜城县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652927', '新疆乌什县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652928', '新疆阿瓦提县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('652929', '新疆柯坪县', '652900'); +INSERT INTO `base_administrative_division` VALUES ('653000', '新疆克孜勒苏柯尔克孜自治州', '650000'); +INSERT INTO `base_administrative_division` VALUES ('653001', '新疆阿图什市', '653000'); +INSERT INTO `base_administrative_division` VALUES ('653022', '新疆阿克陶县', '653000'); +INSERT INTO `base_administrative_division` VALUES ('653023', '新疆阿合奇县', '653000'); +INSERT INTO `base_administrative_division` VALUES ('653024', '新疆乌恰县', '653000'); +INSERT INTO `base_administrative_division` VALUES ('653100', '新疆喀什地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('653101', '新疆喀什市', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653121', '新疆疏附县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653122', '新疆疏勒县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653123', '新疆英吉沙县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653124', '新疆泽普县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653125', '新疆莎车县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653126', '新疆叶城县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653127', '新疆麦盖提县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653128', '新疆岳普湖县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653129', '新疆伽师县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653130', '新疆巴楚县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653131', '新疆塔什库尔干塔吉克自治县', '653100'); +INSERT INTO `base_administrative_division` VALUES ('653200', '新疆和田地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('653201', '新疆和田市', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653221', '新疆和田县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653222', '新疆墨玉县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653223', '新疆皮山县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653224', '新疆洛浦县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653225', '新疆策勒县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653226', '新疆于田县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('653227', '新疆民丰县', '653200'); +INSERT INTO `base_administrative_division` VALUES ('654000', '新疆伊犁哈萨克自治州', '650000'); +INSERT INTO `base_administrative_division` VALUES ('654002', '新疆伊宁市', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654003', '新疆奎屯市', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654021', '新疆伊宁县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654022', '新疆察布查尔锡伯自治县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654023', '新疆霍城县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654024', '新疆巩留县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654025', '新疆新源县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654026', '新疆昭苏县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654027', '新疆特克斯县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654028', '新疆尼勒克县', '654000'); +INSERT INTO `base_administrative_division` VALUES ('654200', '新疆塔城地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('654201', '新疆塔城市', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654202', '新疆乌苏市', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654221', '新疆额敏县', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654223', '新疆沙湾县', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654224', '新疆托里县', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654225', '新疆裕民县', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654226', '新疆和布克赛尔蒙古自治县', '654200'); +INSERT INTO `base_administrative_division` VALUES ('654300', '新疆阿勒泰地区', '650000'); +INSERT INTO `base_administrative_division` VALUES ('654301', '新疆阿勒泰市', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654321', '新疆布尔津县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654322', '新疆富蕴县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654323', '新疆福海县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654324', '新疆哈巴河县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654325', '新疆青河县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('654326', '新疆吉木乃县', '654300'); +INSERT INTO `base_administrative_division` VALUES ('659000', '新疆省直辖县级行政区划', '650000'); +INSERT INTO `base_administrative_division` VALUES ('659001', '新疆石河子市', '659000'); +INSERT INTO `base_administrative_division` VALUES ('659002', '新疆阿拉尔市', '659000'); +INSERT INTO `base_administrative_division` VALUES ('659003', '新疆图木舒克市', '659000'); +INSERT INTO `base_administrative_division` VALUES ('659004', '新疆五家渠市', '659000'); +INSERT INTO `base_administrative_division` VALUES ('710000', '台湾省', '0'); +INSERT INTO `base_administrative_division` VALUES ('810000', '香港特别行政区', '0'); +INSERT INTO `base_administrative_division` VALUES ('820000', '澳门特别行政区', '0'); + +-- ---------------------------- +-- Records of base_college +-- ---------------------------- +INSERT INTO `base_college` VALUES ('01', '航空学院', '1'); +INSERT INTO `base_college` VALUES ('02', '航天学院', '2'); +INSERT INTO `base_college` VALUES ('03', '航海学院', '3'); +INSERT INTO `base_college` VALUES ('04', '材料学院', '4'); +INSERT INTO `base_college` VALUES ('05', '机电学院', '5'); +INSERT INTO `base_college` VALUES ('06', '力学与土木建筑学院', '6'); +INSERT INTO `base_college` VALUES ('07', '动力与能源学院', '7'); +INSERT INTO `base_college` VALUES ('08', '电子信息学院', '8'); +INSERT INTO `base_college` VALUES ('09', '自动化学院', '9'); +INSERT INTO `base_college` VALUES ('10', '计算机学院', '10'); +INSERT INTO `base_college` VALUES ('11', '理学院', '11'); +INSERT INTO `base_college` VALUES ('12', '管理学院', '12'); +INSERT INTO `base_college` VALUES ('13', '人文与经法学院', '13'); +INSERT INTO `base_college` VALUES ('14', '软件学院', '14'); +INSERT INTO `base_college` VALUES ('15', '生命学院', '15'); +INSERT INTO `base_college` VALUES ('16', '外国语学院', '16'); +INSERT INTO `base_college` VALUES ('17', '教育实验学院', '17'); +INSERT INTO `base_college` VALUES ('18', '西北工业大学伦敦玛丽女王大学工程学院', '18'); +INSERT INTO `base_college` VALUES ('19', '马克思主义学院', '19'); +INSERT INTO `base_college` VALUES ('20', '微电子学院', '20'); +INSERT INTO `base_college` VALUES ('21', '网络空间安全学院', '21'); +INSERT INTO `base_college` VALUES ('22', '民航学院', '22'); + +-- ---------------------------- +-- Records of base_ethnic +-- ---------------------------- +INSERT INTO `base_ethnic` VALUES ('00', '----'); +INSERT INTO `base_ethnic` VALUES ('01', '汉族'); +INSERT INTO `base_ethnic` VALUES ('02', '蒙古族'); +INSERT INTO `base_ethnic` VALUES ('03', '回族'); +INSERT INTO `base_ethnic` VALUES ('04', '藏族'); +INSERT INTO `base_ethnic` VALUES ('05', '维吾尔族'); +INSERT INTO `base_ethnic` VALUES ('06', '苗族'); +INSERT INTO `base_ethnic` VALUES ('07', '彝族'); +INSERT INTO `base_ethnic` VALUES ('08', '壮族'); +INSERT INTO `base_ethnic` VALUES ('09', '布依族'); +INSERT INTO `base_ethnic` VALUES ('10', '朝鲜族'); +INSERT INTO `base_ethnic` VALUES ('11', '满族'); +INSERT INTO `base_ethnic` VALUES ('12', '侗族'); +INSERT INTO `base_ethnic` VALUES ('13', '瑶族'); +INSERT INTO `base_ethnic` VALUES ('14', '白族'); +INSERT INTO `base_ethnic` VALUES ('15', '土家族'); +INSERT INTO `base_ethnic` VALUES ('16', '哈尼族'); +INSERT INTO `base_ethnic` VALUES ('17', '哈萨克族'); +INSERT INTO `base_ethnic` VALUES ('18', '傣族'); +INSERT INTO `base_ethnic` VALUES ('19', '黎族'); +INSERT INTO `base_ethnic` VALUES ('20', '傈傈族'); +INSERT INTO `base_ethnic` VALUES ('21', '佤族'); +INSERT INTO `base_ethnic` VALUES ('22', '畲族'); +INSERT INTO `base_ethnic` VALUES ('23', '高山族'); +INSERT INTO `base_ethnic` VALUES ('24', '拉祜族'); +INSERT INTO `base_ethnic` VALUES ('25', '水族'); +INSERT INTO `base_ethnic` VALUES ('26', '东乡族'); +INSERT INTO `base_ethnic` VALUES ('27', '纳西族'); +INSERT INTO `base_ethnic` VALUES ('28', '景颇族'); +INSERT INTO `base_ethnic` VALUES ('29', '柯尔克孜族'); +INSERT INTO `base_ethnic` VALUES ('30', '土族'); +INSERT INTO `base_ethnic` VALUES ('31', '达斡尔族'); +INSERT INTO `base_ethnic` VALUES ('32', '仫佬族'); +INSERT INTO `base_ethnic` VALUES ('33', '羌族'); +INSERT INTO `base_ethnic` VALUES ('34', '布朗族'); +INSERT INTO `base_ethnic` VALUES ('35', '撒拉族'); +INSERT INTO `base_ethnic` VALUES ('36', '毛难族'); +INSERT INTO `base_ethnic` VALUES ('37', '仡佬族'); +INSERT INTO `base_ethnic` VALUES ('38', '锡伯族'); +INSERT INTO `base_ethnic` VALUES ('39', '阿昌族'); +INSERT INTO `base_ethnic` VALUES ('40', '普米族'); +INSERT INTO `base_ethnic` VALUES ('41', '塔吉克族'); +INSERT INTO `base_ethnic` VALUES ('42', '怒族'); +INSERT INTO `base_ethnic` VALUES ('43', '乌孜别克族'); +INSERT INTO `base_ethnic` VALUES ('44', '俄罗斯族'); +INSERT INTO `base_ethnic` VALUES ('45', '鄂温克族'); +INSERT INTO `base_ethnic` VALUES ('46', '崩龙族'); +INSERT INTO `base_ethnic` VALUES ('47', '保安族'); +INSERT INTO `base_ethnic` VALUES ('48', '裕固族'); +INSERT INTO `base_ethnic` VALUES ('49', '京族'); +INSERT INTO `base_ethnic` VALUES ('50', '塔塔尔族'); +INSERT INTO `base_ethnic` VALUES ('51', '独龙族'); +INSERT INTO `base_ethnic` VALUES ('52', '鄂伦春族'); +INSERT INTO `base_ethnic` VALUES ('53', '赫哲族'); +INSERT INTO `base_ethnic` VALUES ('54', '门巴族'); +INSERT INTO `base_ethnic` VALUES ('55', '珞巴族'); +INSERT INTO `base_ethnic` VALUES ('56', '基诺族'); +INSERT INTO `base_ethnic` VALUES ('97', '其他'); +INSERT INTO `base_ethnic` VALUES ('98', '外国血统'); + +-- ---------------------------- +-- Records of base_major +-- ---------------------------- +INSERT INTO `base_major` VALUES ('010100', '哲学类'); +INSERT INTO `base_major` VALUES ('010101', '哲学'); +INSERT INTO `base_major` VALUES ('010102', '逻辑学'); +INSERT INTO `base_major` VALUES ('010103', '宗教学'); +INSERT INTO `base_major` VALUES ('010104', '伦理学'); +INSERT INTO `base_major` VALUES ('01010J', '哲学基地班'); +INSERT INTO `base_major` VALUES ('01SY00', '人文科学试验班类'); +INSERT INTO `base_major` VALUES ('01SY01', '人文科学试验班'); +INSERT INTO `base_major` VALUES ('020100', '经济学类'); +INSERT INTO `base_major` VALUES ('020101', '经济学'); +INSERT INTO `base_major` VALUES ('020102', '国际经济与贸易'); +INSERT INTO `base_major` VALUES ('020103', '财政学'); +INSERT INTO `base_major` VALUES ('020104', '金融学'); +INSERT INTO `base_major` VALUES ('020105', '国民经济管理'); +INSERT INTO `base_major` VALUES ('020106', '贸易经济'); +INSERT INTO `base_major` VALUES ('020107', '保险'); +INSERT INTO `base_major` VALUES ('020108', '环境经济'); +INSERT INTO `base_major` VALUES ('020109', '金融工程'); +INSERT INTO `base_major` VALUES ('02010J', '经济学基地班'); +INSERT INTO `base_major` VALUES ('020110', '税务'); +INSERT INTO `base_major` VALUES ('020111', '信用管理'); +INSERT INTO `base_major` VALUES ('020112', '网络经济学'); +INSERT INTO `base_major` VALUES ('020113', '体育经济'); +INSERT INTO `base_major` VALUES ('020114', '投资学'); +INSERT INTO `base_major` VALUES ('020115', '环境资源与发展经济学'); +INSERT INTO `base_major` VALUES ('020116', '海洋经济学'); +INSERT INTO `base_major` VALUES ('020117', '国际文化贸易'); +INSERT INTO `base_major` VALUES ('020119', '金融数学'); +INSERT INTO `base_major` VALUES ('020120', '经济与金融'); +INSERT INTO `base_major` VALUES ('020121', '能源经济'); +INSERT INTO `base_major` VALUES ('020303', '保险学'); +INSERT INTO `base_major` VALUES ('030100', '法学类'); +INSERT INTO `base_major` VALUES ('030101', '法学'); +INSERT INTO `base_major` VALUES ('030102', '知识产权法'); +INSERT INTO `base_major` VALUES ('030103', '知识产权'); +INSERT INTO `base_major` VALUES ('030120', '监狱学'); +INSERT INTO `base_major` VALUES ('030200', '马克思主义理论类'); +INSERT INTO `base_major` VALUES ('030201', '科学社会主义与国际共产主义运动'); +INSERT INTO `base_major` VALUES ('030202', '中国革命史与中国共产党党史'); +INSERT INTO `base_major` VALUES ('030300', '社会学类'); +INSERT INTO `base_major` VALUES ('030301', '社会学'); +INSERT INTO `base_major` VALUES ('030302', '社会工作'); +INSERT INTO `base_major` VALUES ('030303', '家政学'); +INSERT INTO `base_major` VALUES ('030304', '人类学'); +INSERT INTO `base_major` VALUES ('030305', '女性学'); +INSERT INTO `base_major` VALUES ('030400', '政治学类'); +INSERT INTO `base_major` VALUES ('030401', '政治学与行政学'); +INSERT INTO `base_major` VALUES ('030402', '国际政治'); +INSERT INTO `base_major` VALUES ('030403', '外交学'); +INSERT INTO `base_major` VALUES ('030404', '思想政治教育'); +INSERT INTO `base_major` VALUES ('030405', '国际文化交流'); +INSERT INTO `base_major` VALUES ('030406', '国际政治经济学'); +INSERT INTO `base_major` VALUES ('030407', '国际事务'); +INSERT INTO `base_major` VALUES ('030408', '国际事务与国际关系'); +INSERT INTO `base_major` VALUES ('030409', '欧洲事务与欧洲关系'); +INSERT INTO `base_major` VALUES ('030500', '公安学类'); +INSERT INTO `base_major` VALUES ('030501', '治安学'); +INSERT INTO `base_major` VALUES ('030502', '侦查学'); +INSERT INTO `base_major` VALUES ('030503', '边防管理'); +INSERT INTO `base_major` VALUES ('030504', '火灾勘查'); +INSERT INTO `base_major` VALUES ('030505', '禁毒学'); +INSERT INTO `base_major` VALUES ('030506', '警犬技术'); +INSERT INTO `base_major` VALUES ('030507', '经济犯罪侦查'); +INSERT INTO `base_major` VALUES ('030508', '边防指挥'); +INSERT INTO `base_major` VALUES ('030509', '消防指挥'); +INSERT INTO `base_major` VALUES ('030510', '警卫学'); +INSERT INTO `base_major` VALUES ('030511', '公安情报学'); +INSERT INTO `base_major` VALUES ('030512', '犯罪学'); +INSERT INTO `base_major` VALUES ('030513', '公安管理学'); +INSERT INTO `base_major` VALUES ('030514', '涉外警务'); +INSERT INTO `base_major` VALUES ('030515', '国内安全保卫'); +INSERT INTO `base_major` VALUES ('030516', '警务指挥与战术'); +INSERT INTO `base_major` VALUES ('03SY01', '社会科学试验班'); +INSERT INTO `base_major` VALUES ('040100', '教育学类'); +INSERT INTO `base_major` VALUES ('040101', '教育学'); +INSERT INTO `base_major` VALUES ('040102', '学前教育'); +INSERT INTO `base_major` VALUES ('040103', '特殊教育'); +INSERT INTO `base_major` VALUES ('040104', '教育技术学'); +INSERT INTO `base_major` VALUES ('040105', '小学教育'); +INSERT INTO `base_major` VALUES ('040106', '艺术教育'); +INSERT INTO `base_major` VALUES ('040107', '人文教育'); +INSERT INTO `base_major` VALUES ('040108', '科学教育'); +INSERT INTO `base_major` VALUES ('040109', '言语听觉科学'); +INSERT INTO `base_major` VALUES ('040110', '华文教育'); +INSERT INTO `base_major` VALUES ('040200', '体育学类'); +INSERT INTO `base_major` VALUES ('040201', '体育教育'); +INSERT INTO `base_major` VALUES ('040202', '运动训练'); +INSERT INTO `base_major` VALUES ('040203', '社会体育'); +INSERT INTO `base_major` VALUES ('040204', '运动人体科学'); +INSERT INTO `base_major` VALUES ('040205', '民族传统体育'); +INSERT INTO `base_major` VALUES ('040206', '运动康复与健康'); +INSERT INTO `base_major` VALUES ('040207', '休闲体育'); +INSERT INTO `base_major` VALUES ('040300', '职业技术教育类'); +INSERT INTO `base_major` VALUES ('040301', '农艺教育'); +INSERT INTO `base_major` VALUES ('040302', '园艺教育'); +INSERT INTO `base_major` VALUES ('040303', '特用作物教育'); +INSERT INTO `base_major` VALUES ('040304', '林木生产教育'); +INSERT INTO `base_major` VALUES ('040305', '特用动物教育'); +INSERT INTO `base_major` VALUES ('040306', '畜禽生产教育'); +INSERT INTO `base_major` VALUES ('040307', '水产养殖教育'); +INSERT INTO `base_major` VALUES ('040308', '应用生物教育'); +INSERT INTO `base_major` VALUES ('040309', '农业机械教育'); +INSERT INTO `base_major` VALUES ('040310', '农业建筑与环境控制教育'); +INSERT INTO `base_major` VALUES ('040311', '农产品储运与加工教育'); +INSERT INTO `base_major` VALUES ('040312', '农业经营管理教育'); +INSERT INTO `base_major` VALUES ('040313', '机械制造工艺教育'); +INSERT INTO `base_major` VALUES ('040314', '机械维修及检测技术教育'); +INSERT INTO `base_major` VALUES ('040315', '机电技术教育'); +INSERT INTO `base_major` VALUES ('040316', '电气技术教育'); +INSERT INTO `base_major` VALUES ('040317', '汽车维修工程教育'); +INSERT INTO `base_major` VALUES ('040318', '应用电子技术教育'); +INSERT INTO `base_major` VALUES ('040319', '制浆造纸工艺教育'); +INSERT INTO `base_major` VALUES ('040320', '印刷工艺教育'); +INSERT INTO `base_major` VALUES ('040321', '橡塑制品成型工艺教育'); +INSERT INTO `base_major` VALUES ('040322', '食品工艺教育'); +INSERT INTO `base_major` VALUES ('040323', '纺织工艺教育'); +INSERT INTO `base_major` VALUES ('040324', '染整工艺教育'); +INSERT INTO `base_major` VALUES ('040325', '化工工艺教育'); +INSERT INTO `base_major` VALUES ('040326', '化工分析与检测技术教育'); +INSERT INTO `base_major` VALUES ('040327', '建筑材料工程教育'); +INSERT INTO `base_major` VALUES ('040328', '建筑工程教育'); +INSERT INTO `base_major` VALUES ('040329', '服装设计与工艺教育'); +INSERT INTO `base_major` VALUES ('040330', '装潢设计与工艺教育'); +INSERT INTO `base_major` VALUES ('040331', '旅游管理与服务教育'); +INSERT INTO `base_major` VALUES ('040332', '食品营养与检验教育'); +INSERT INTO `base_major` VALUES ('040333', '烹饪与营养教育'); +INSERT INTO `base_major` VALUES ('040334', '财务会计教育'); +INSERT INTO `base_major` VALUES ('040335', '文秘教育'); +INSERT INTO `base_major` VALUES ('040336', '市场营销教育'); +INSERT INTO `base_major` VALUES ('040337', '职业技术教育管理'); +INSERT INTO `base_major` VALUES ('050100', '中国语言文学类'); +INSERT INTO `base_major` VALUES ('050101', '汉语言文学'); +INSERT INTO `base_major` VALUES ('050102', '汉语言'); +INSERT INTO `base_major` VALUES ('050103', '对外汉语'); +INSERT INTO `base_major` VALUES ('050104', '中国少数民族语言文学'); +INSERT INTO `base_major` VALUES ('050105', '古典文献'); +INSERT INTO `base_major` VALUES ('050106', '中国语言文化'); +INSERT INTO `base_major` VALUES ('050107', '应用语言学'); +INSERT INTO `base_major` VALUES ('05010J', '中国语言文学基地班'); +INSERT INTO `base_major` VALUES ('050200', '外国语言文学类'); +INSERT INTO `base_major` VALUES ('050201', '英语'); +INSERT INTO `base_major` VALUES ('050202', '俄语'); +INSERT INTO `base_major` VALUES ('050203', '德语'); +INSERT INTO `base_major` VALUES ('050204', '法语'); +INSERT INTO `base_major` VALUES ('050205', '西班牙语'); +INSERT INTO `base_major` VALUES ('050206', '阿拉伯语'); +INSERT INTO `base_major` VALUES ('050207', '日语'); +INSERT INTO `base_major` VALUES ('050208', '波斯语'); +INSERT INTO `base_major` VALUES ('050209', '朝鲜语'); +INSERT INTO `base_major` VALUES ('050210', '菲律宾语'); +INSERT INTO `base_major` VALUES ('050211', '梵语巴利语'); +INSERT INTO `base_major` VALUES ('050212', '印度尼西亚语'); +INSERT INTO `base_major` VALUES ('050213', '印地语'); +INSERT INTO `base_major` VALUES ('050214', '柬埔寨语'); +INSERT INTO `base_major` VALUES ('050215', '老挝语'); +INSERT INTO `base_major` VALUES ('050216', '缅甸语'); +INSERT INTO `base_major` VALUES ('050217', '马来语'); +INSERT INTO `base_major` VALUES ('050218', '蒙古语'); +INSERT INTO `base_major` VALUES ('050219', '僧加罗语'); +INSERT INTO `base_major` VALUES ('050220', '泰语'); +INSERT INTO `base_major` VALUES ('050221', '乌尔都语'); +INSERT INTO `base_major` VALUES ('050222', '希伯莱语'); +INSERT INTO `base_major` VALUES ('050223', '越南语'); +INSERT INTO `base_major` VALUES ('050224', '豪萨语'); +INSERT INTO `base_major` VALUES ('050225', '斯瓦希里语'); +INSERT INTO `base_major` VALUES ('050226', '阿尔巴尼亚语'); +INSERT INTO `base_major` VALUES ('050227', '保加利亚语'); +INSERT INTO `base_major` VALUES ('050228', '波兰语'); +INSERT INTO `base_major` VALUES ('050229', '捷克语'); +INSERT INTO `base_major` VALUES ('050230', '罗马尼亚语'); +INSERT INTO `base_major` VALUES ('050231', '葡萄牙语'); +INSERT INTO `base_major` VALUES ('050232', '瑞典语'); +INSERT INTO `base_major` VALUES ('050233', '塞尔维亚—克罗地亚语'); +INSERT INTO `base_major` VALUES ('050234', '土耳其语'); +INSERT INTO `base_major` VALUES ('050235', '希腊语'); +INSERT INTO `base_major` VALUES ('050236', '匈牙利语'); +INSERT INTO `base_major` VALUES ('050237', '意大利语'); +INSERT INTO `base_major` VALUES ('050238', '捷克语—斯洛伐克语'); +INSERT INTO `base_major` VALUES ('050239', '泰米尔语'); +INSERT INTO `base_major` VALUES ('050240', '普什图语'); +INSERT INTO `base_major` VALUES ('050241', '世界语'); +INSERT INTO `base_major` VALUES ('050242', '孟加拉语'); +INSERT INTO `base_major` VALUES ('050243', '尼泊尔语'); +INSERT INTO `base_major` VALUES ('050244', '塞尔维亚语—克罗地亚语'); +INSERT INTO `base_major` VALUES ('050245', '荷兰语'); +INSERT INTO `base_major` VALUES ('050246', '芬兰语'); +INSERT INTO `base_major` VALUES ('050247', '乌克兰语'); +INSERT INTO `base_major` VALUES ('050248', '韩国语'); +INSERT INTO `base_major` VALUES ('050249', '商务英语'); +INSERT INTO `base_major` VALUES ('050250', '塞尔维亚语'); +INSERT INTO `base_major` VALUES ('050251', '克罗地亚语'); +INSERT INTO `base_major` VALUES ('050252', '挪威语'); +INSERT INTO `base_major` VALUES ('050253', '丹麦语'); +INSERT INTO `base_major` VALUES ('050254', '冰岛语'); +INSERT INTO `base_major` VALUES ('050255', '翻译'); +INSERT INTO `base_major` VALUES ('050300', '新闻传播学类'); +INSERT INTO `base_major` VALUES ('050301', '新闻学'); +INSERT INTO `base_major` VALUES ('050302', '广播电视新闻学'); +INSERT INTO `base_major` VALUES ('050303', '广告学'); +INSERT INTO `base_major` VALUES ('050304', '编辑出版学'); +INSERT INTO `base_major` VALUES ('050305', '传播学'); +INSERT INTO `base_major` VALUES ('050306', '媒体创意'); +INSERT INTO `base_major` VALUES ('050307', '新媒体与信息网络'); +INSERT INTO `base_major` VALUES ('050308', '数字出版'); +INSERT INTO `base_major` VALUES ('050400', '艺术类'); +INSERT INTO `base_major` VALUES ('050401', '音乐学'); +INSERT INTO `base_major` VALUES ('050402', '作曲与作曲技术理论'); +INSERT INTO `base_major` VALUES ('050403', '音乐表演'); +INSERT INTO `base_major` VALUES ('050404', '绘画'); +INSERT INTO `base_major` VALUES ('050405', '雕塑'); +INSERT INTO `base_major` VALUES ('050406', '美术学'); +INSERT INTO `base_major` VALUES ('050407', '艺术设计学'); +INSERT INTO `base_major` VALUES ('050408', '艺术设计'); +INSERT INTO `base_major` VALUES ('050409', '舞蹈学'); +INSERT INTO `base_major` VALUES ('050410', '舞蹈编导'); +INSERT INTO `base_major` VALUES ('050411', '戏剧学'); +INSERT INTO `base_major` VALUES ('050412', '表演'); +INSERT INTO `base_major` VALUES ('050413', '导演'); +INSERT INTO `base_major` VALUES ('050414', '戏剧影视文学'); +INSERT INTO `base_major` VALUES ('050415', '戏剧影视美术设计'); +INSERT INTO `base_major` VALUES ('050416', '摄影'); +INSERT INTO `base_major` VALUES ('050417', '录音艺术'); +INSERT INTO `base_major` VALUES ('050418', '动画'); +INSERT INTO `base_major` VALUES ('050419', '播音与主持艺术'); +INSERT INTO `base_major` VALUES ('050420', '广播电视编导'); +INSERT INTO `base_major` VALUES ('050422', '艺术学'); +INSERT INTO `base_major` VALUES ('050423', '影视学'); +INSERT INTO `base_major` VALUES ('050424', '广播影视编导'); +INSERT INTO `base_major` VALUES ('050425', '书法学'); +INSERT INTO `base_major` VALUES ('050426', '照明艺术'); +INSERT INTO `base_major` VALUES ('050427', '会展艺术与技术'); +INSERT INTO `base_major` VALUES ('050428', '音乐科技与艺术'); +INSERT INTO `base_major` VALUES ('050429', '中国画'); +INSERT INTO `base_major` VALUES ('050430', '公共艺术'); +INSERT INTO `base_major` VALUES ('050431', '数字游戏设计'); +INSERT INTO `base_major` VALUES ('050432', '数字电影技术'); +INSERT INTO `base_major` VALUES ('05SY00', '文科试验班类'); +INSERT INTO `base_major` VALUES ('060100', '历史学类'); +INSERT INTO `base_major` VALUES ('060101', '历史学'); +INSERT INTO `base_major` VALUES ('060102', '世界历史'); +INSERT INTO `base_major` VALUES ('060103', '考古学'); +INSERT INTO `base_major` VALUES ('060104', '博物馆学'); +INSERT INTO `base_major` VALUES ('060105', '民族学'); +INSERT INTO `base_major` VALUES ('060106', '文物保护技术'); +INSERT INTO `base_major` VALUES ('06010J', '历史学基地班'); +INSERT INTO `base_major` VALUES ('070100', '数学类'); +INSERT INTO `base_major` VALUES ('070101', '数学与应用数学'); +INSERT INTO `base_major` VALUES ('070102', '信息与计算科学'); +INSERT INTO `base_major` VALUES ('070103', '数理基础科学'); +INSERT INTO `base_major` VALUES ('07010J', '数学基地班'); +INSERT INTO `base_major` VALUES ('070200', '物理学类'); +INSERT INTO `base_major` VALUES ('070201', '物理学'); +INSERT INTO `base_major` VALUES ('070202', '应用物理学'); +INSERT INTO `base_major` VALUES ('070203', '声学'); +INSERT INTO `base_major` VALUES ('070204', '核物理'); +INSERT INTO `base_major` VALUES ('07020J', '物理学基地班'); +INSERT INTO `base_major` VALUES ('070300', '化学类'); +INSERT INTO `base_major` VALUES ('070301', '化学'); +INSERT INTO `base_major` VALUES ('070302', '应用化学'); +INSERT INTO `base_major` VALUES ('070303', '化学生物学'); +INSERT INTO `base_major` VALUES ('070304', '分子科学与工程'); +INSERT INTO `base_major` VALUES ('07030J', '化学基地班'); +INSERT INTO `base_major` VALUES ('070400', '生物科学类'); +INSERT INTO `base_major` VALUES ('070401', '生物科学'); +INSERT INTO `base_major` VALUES ('070402', '生物技术'); +INSERT INTO `base_major` VALUES ('070403', '生物信息学'); +INSERT INTO `base_major` VALUES ('070404', '生物信息技术'); +INSERT INTO `base_major` VALUES ('070405', '生物科学与生物技术'); +INSERT INTO `base_major` VALUES ('070406', '动植物检疫'); +INSERT INTO `base_major` VALUES ('070407', '生物化学与分子生物学'); +INSERT INTO `base_major` VALUES ('070408', '医学信息学'); +INSERT INTO `base_major` VALUES ('070409', '植物生物技术'); +INSERT INTO `base_major` VALUES ('07040J', '生物学基地班'); +INSERT INTO `base_major` VALUES ('070410', '动物生物技术'); +INSERT INTO `base_major` VALUES ('070411', '生物资源科学'); +INSERT INTO `base_major` VALUES ('070412', '生物安全'); +INSERT INTO `base_major` VALUES ('070413', '生物医学英语'); +INSERT INTO `base_major` VALUES ('07041J', '生命科学与技术基地班'); +INSERT INTO `base_major` VALUES ('070500', '天文学类'); +INSERT INTO `base_major` VALUES ('070501', '天文学'); +INSERT INTO `base_major` VALUES ('070600', '地质学类'); +INSERT INTO `base_major` VALUES ('070601', '地质学'); +INSERT INTO `base_major` VALUES ('070602', '地球化学'); +INSERT INTO `base_major` VALUES ('07060J', '地质学基地班'); +INSERT INTO `base_major` VALUES ('070700', '地理科学类'); +INSERT INTO `base_major` VALUES ('070701', '地理科学'); +INSERT INTO `base_major` VALUES ('070702', '资源环境与城乡规划管理'); +INSERT INTO `base_major` VALUES ('070703', '地理信息系统'); +INSERT INTO `base_major` VALUES ('070704', '地球信息科学与技术'); +INSERT INTO `base_major` VALUES ('07070J', '地理学基地班'); +INSERT INTO `base_major` VALUES ('070800', '地球物理学类'); +INSERT INTO `base_major` VALUES ('070801', '地球物理学'); +INSERT INTO `base_major` VALUES ('070802', '地球与空间科学'); +INSERT INTO `base_major` VALUES ('070803', '空间科学与技术'); +INSERT INTO `base_major` VALUES ('070900', '大气科学类'); +INSERT INTO `base_major` VALUES ('070901', '大气科学'); +INSERT INTO `base_major` VALUES ('070902', '应用气象学'); +INSERT INTO `base_major` VALUES ('071000', '海洋科学类'); +INSERT INTO `base_major` VALUES ('071001', '海洋科学'); +INSERT INTO `base_major` VALUES ('071002', '海洋技术'); +INSERT INTO `base_major` VALUES ('071003', '海洋管理'); +INSERT INTO `base_major` VALUES ('071004', '军事海洋学'); +INSERT INTO `base_major` VALUES ('071005', '海洋生物资源与环境'); +INSERT INTO `base_major` VALUES ('071100', '力学类'); +INSERT INTO `base_major` VALUES ('071101', '理论与应用力学'); +INSERT INTO `base_major` VALUES ('071200', '电子信息科学类'); +INSERT INTO `base_major` VALUES ('071201', '电子信息科学与技术'); +INSERT INTO `base_major` VALUES ('071202', '微电子学'); +INSERT INTO `base_major` VALUES ('071203', '光信息科学与技术'); +INSERT INTO `base_major` VALUES ('071204', '科技防卫'); +INSERT INTO `base_major` VALUES ('071205', '信息安全'); +INSERT INTO `base_major` VALUES ('071206', '信息科学技术'); +INSERT INTO `base_major` VALUES ('071207', '光电子技术科学'); +INSERT INTO `base_major` VALUES ('071300', '材料科学类'); +INSERT INTO `base_major` VALUES ('071301', '材料物理'); +INSERT INTO `base_major` VALUES ('071302', '材料化学'); +INSERT INTO `base_major` VALUES ('071400', '环境科学类'); +INSERT INTO `base_major` VALUES ('071401', '环境科学'); +INSERT INTO `base_major` VALUES ('071402', '生态学'); +INSERT INTO `base_major` VALUES ('071403', '资源环境科学'); +INSERT INTO `base_major` VALUES ('071404', '地球环境科学'); +INSERT INTO `base_major` VALUES ('071500', '心理学类'); +INSERT INTO `base_major` VALUES ('071501', '心理学'); +INSERT INTO `base_major` VALUES ('071502', '应用心理学'); +INSERT INTO `base_major` VALUES ('071600', '统计学类'); +INSERT INTO `base_major` VALUES ('071601', '统计学'); +INSERT INTO `base_major` VALUES ('071700', '系统科学类'); +INSERT INTO `base_major` VALUES ('071701', '系统理论'); +INSERT INTO `base_major` VALUES ('071702', '系统科学与工程'); +INSERT INTO `base_major` VALUES ('07SY00', '理科试验班类'); +INSERT INTO `base_major` VALUES ('07SY01', '理科试验班'); +INSERT INTO `base_major` VALUES ('07SY02', '自然科学试验班'); +INSERT INTO `base_major` VALUES ('080100', '地矿类'); +INSERT INTO `base_major` VALUES ('080101', '采矿工程'); +INSERT INTO `base_major` VALUES ('080102', '石油工程'); +INSERT INTO `base_major` VALUES ('080103', '矿物加工工程'); +INSERT INTO `base_major` VALUES ('080104', '勘查技术与工程'); +INSERT INTO `base_major` VALUES ('080105', '资源勘查工程'); +INSERT INTO `base_major` VALUES ('080106', '地质工程'); +INSERT INTO `base_major` VALUES ('080107', '矿物资源工程'); +INSERT INTO `base_major` VALUES ('080108', '煤及煤层气工程'); +INSERT INTO `base_major` VALUES ('080109', '地下水科学与工程'); +INSERT INTO `base_major` VALUES ('080110', '能源与资源工程'); +INSERT INTO `base_major` VALUES ('080111', '海洋油气工程'); +INSERT INTO `base_major` VALUES ('080200', '材料类'); +INSERT INTO `base_major` VALUES ('080201', '冶金工程'); +INSERT INTO `base_major` VALUES ('080202', '金属材料工程'); +INSERT INTO `base_major` VALUES ('080203', '无机非金属材料工程'); +INSERT INTO `base_major` VALUES ('080204', '高分子材料与工程'); +INSERT INTO `base_major` VALUES ('080205', '材料科学与工程'); +INSERT INTO `base_major` VALUES ('080206', '复合材料与工程'); +INSERT INTO `base_major` VALUES ('080207', '焊接技术与工程'); +INSERT INTO `base_major` VALUES ('080208', '宝石及材料工艺学'); +INSERT INTO `base_major` VALUES ('080209', '粉体材料科学与工程'); +INSERT INTO `base_major` VALUES ('080210', '再生资源科学与技术'); +INSERT INTO `base_major` VALUES ('080211', '稀土工程'); +INSERT INTO `base_major` VALUES ('080212', '高分子材料加工工程'); +INSERT INTO `base_major` VALUES ('080213', '生物功能材料'); +INSERT INTO `base_major` VALUES ('080214', '电子封装技术'); +INSERT INTO `base_major` VALUES ('080215', '功能材料'); +INSERT INTO `base_major` VALUES ('080216', '纳米材料与技术'); +INSERT INTO `base_major` VALUES ('080217', '新能源材料与器件'); +INSERT INTO `base_major` VALUES ('080218', '资源循环科学与工程'); +INSERT INTO `base_major` VALUES ('080300', '机械类'); +INSERT INTO `base_major` VALUES ('080301', '机械设计制造及其自动化'); +INSERT INTO `base_major` VALUES ('080302', '材料成型及控制工程'); +INSERT INTO `base_major` VALUES ('080303', '工业设计'); +INSERT INTO `base_major` VALUES ('080304', '过程装备与控制工程'); +INSERT INTO `base_major` VALUES ('080305', '机械工程及自动化'); +INSERT INTO `base_major` VALUES ('080306', '车辆工程'); +INSERT INTO `base_major` VALUES ('080307', '机械电子工程'); +INSERT INTO `base_major` VALUES ('080308', '汽车服务工程'); +INSERT INTO `base_major` VALUES ('080309', '制造自动化与测控技术'); +INSERT INTO `base_major` VALUES ('080310', '微机电系统工程'); +INSERT INTO `base_major` VALUES ('080311', '制造工程'); +INSERT INTO `base_major` VALUES ('080312', '体育装备工程'); +INSERT INTO `base_major` VALUES ('080313', '工程机械'); +INSERT INTO `base_major` VALUES ('080400', '仪器仪表类'); +INSERT INTO `base_major` VALUES ('080401', '测控技术与仪器'); +INSERT INTO `base_major` VALUES ('080402', '电子信息技术及仪器'); +INSERT INTO `base_major` VALUES ('080500', '能源动力类'); +INSERT INTO `base_major` VALUES ('080501', '热能与动力工程'); +INSERT INTO `base_major` VALUES ('080502', '核工程与核技术'); +INSERT INTO `base_major` VALUES ('080503', '工程物理'); +INSERT INTO `base_major` VALUES ('080504', '能源与环境系统工程'); +INSERT INTO `base_major` VALUES ('080505', '能源工程及自动化'); +INSERT INTO `base_major` VALUES ('080506', '能源动力系统及自动化'); +INSERT INTO `base_major` VALUES ('080507', '风能与动力工程'); +INSERT INTO `base_major` VALUES ('080508', '核技术'); +INSERT INTO `base_major` VALUES ('080509', '辐射防护与环境工程'); +INSERT INTO `base_major` VALUES ('080510', '核化工与核燃料工程'); +INSERT INTO `base_major` VALUES ('080511', '核反应堆工程'); +INSERT INTO `base_major` VALUES ('080512', '新能源科学与工程'); +INSERT INTO `base_major` VALUES ('080600', '电气信息类'); +INSERT INTO `base_major` VALUES ('080601', '电气工程及其自动化'); +INSERT INTO `base_major` VALUES ('080602', '自动化'); +INSERT INTO `base_major` VALUES ('080603', '电子信息工程'); +INSERT INTO `base_major` VALUES ('080604', '通信工程'); +INSERT INTO `base_major` VALUES ('080605', '计算机科学与技术'); +INSERT INTO `base_major` VALUES ('080606', '电子科学与技术'); +INSERT INTO `base_major` VALUES ('080607', '生物医学工程'); +INSERT INTO `base_major` VALUES ('080608', '电气工程与自动化'); +INSERT INTO `base_major` VALUES ('080609', '信息工程'); +INSERT INTO `base_major` VALUES ('080610', '光源与照明'); +INSERT INTO `base_major` VALUES ('080611', '软件工程'); +INSERT INTO `base_major` VALUES ('080612', '影视艺术技术'); +INSERT INTO `base_major` VALUES ('080613', '网络工程'); +INSERT INTO `base_major` VALUES ('080614', '信息显示与光电技术'); +INSERT INTO `base_major` VALUES ('080615', '集成电路设计与集成系统'); +INSERT INTO `base_major` VALUES ('080616', '光电信息工程'); +INSERT INTO `base_major` VALUES ('080617', '广播电视工程'); +INSERT INTO `base_major` VALUES ('080618', '电气信息工程'); +INSERT INTO `base_major` VALUES ('080619', '计算机软件'); +INSERT INTO `base_major` VALUES ('080620', '电力工程与管理'); +INSERT INTO `base_major` VALUES ('080621', '微电子制造工程'); +INSERT INTO `base_major` VALUES ('080622', '假肢矫形工程'); +INSERT INTO `base_major` VALUES ('080623', '数字媒体艺术'); +INSERT INTO `base_major` VALUES ('080624', '医学信息工程'); +INSERT INTO `base_major` VALUES ('080625', '信息物理工程'); +INSERT INTO `base_major` VALUES ('080626', '医疗器械工程'); +INSERT INTO `base_major` VALUES ('080627', '智能科学与技术'); +INSERT INTO `base_major` VALUES ('080628', '数字媒体技术'); +INSERT INTO `base_major` VALUES ('080629', '医学影像工程'); +INSERT INTO `base_major` VALUES ('080630', '真空电子技术'); +INSERT INTO `base_major` VALUES ('080631', '电磁场与无线技术'); +INSERT INTO `base_major` VALUES ('080632', '电信工程及管理'); +INSERT INTO `base_major` VALUES ('080633', '电气工程与智能控制'); +INSERT INTO `base_major` VALUES ('080634', '信息与通信工程'); +INSERT INTO `base_major` VALUES ('080635', '电波传播与天线'); +INSERT INTO `base_major` VALUES ('080636', '船舶电子电气工程'); +INSERT INTO `base_major` VALUES ('080637', '电子与计算机工程'); +INSERT INTO `base_major` VALUES ('080638', '仿真科学与技术'); +INSERT INTO `base_major` VALUES ('080639', '电机电器智能化'); +INSERT INTO `base_major` VALUES ('080640', '物联网工程'); +INSERT INTO `base_major` VALUES ('080641', '传感网技术'); +INSERT INTO `base_major` VALUES ('080643', '光电子材料与器件'); +INSERT INTO `base_major` VALUES ('080644', '水声工程'); +INSERT INTO `base_major` VALUES ('080645', '智能电网信息工程'); +INSERT INTO `base_major` VALUES ('080700', '土建类'); +INSERT INTO `base_major` VALUES ('080701', '建筑学'); +INSERT INTO `base_major` VALUES ('080702', '城市规划'); +INSERT INTO `base_major` VALUES ('080703', '土木工程'); +INSERT INTO `base_major` VALUES ('080704', '建筑环境与设备工程'); +INSERT INTO `base_major` VALUES ('080705', '给水排水工程'); +INSERT INTO `base_major` VALUES ('080706', '城市地下空间工程'); +INSERT INTO `base_major` VALUES ('080707', '历史建筑保护工程'); +INSERT INTO `base_major` VALUES ('080708', '景观建筑设计'); +INSERT INTO `base_major` VALUES ('080709', '水务工程'); +INSERT INTO `base_major` VALUES ('080710', '建筑设施智能技术'); +INSERT INTO `base_major` VALUES ('080711', '给排水科学与工程'); +INSERT INTO `base_major` VALUES ('080712', '建筑电气与智能化'); +INSERT INTO `base_major` VALUES ('080713', '景观学'); +INSERT INTO `base_major` VALUES ('080714', '风景园林'); +INSERT INTO `base_major` VALUES ('080715', '总图设计与工业运输'); +INSERT INTO `base_major` VALUES ('080716', '建筑节能技术与工程'); +INSERT INTO `base_major` VALUES ('080724', '道路桥梁与渡河工程'); +INSERT INTO `base_major` VALUES ('080800', '水利类'); +INSERT INTO `base_major` VALUES ('080801', '水利水电工程'); +INSERT INTO `base_major` VALUES ('080802', '水文与水资源工程'); +INSERT INTO `base_major` VALUES ('080803', '港口航道与海岸工程'); +INSERT INTO `base_major` VALUES ('080804', '港口海岸及治河工程'); +INSERT INTO `base_major` VALUES ('080805', '水资源与海洋工程'); +INSERT INTO `base_major` VALUES ('080900', '测绘类'); +INSERT INTO `base_major` VALUES ('080901', '测绘工程'); +INSERT INTO `base_major` VALUES ('080902', '遥感科学与技术'); +INSERT INTO `base_major` VALUES ('080903', '空间信息与数字技术'); +INSERT INTO `base_major` VALUES ('081000', '环境与安全类'); +INSERT INTO `base_major` VALUES ('081001', '环境工程'); +INSERT INTO `base_major` VALUES ('081002', '安全工程'); +INSERT INTO `base_major` VALUES ('081003', '水质科学与技术'); +INSERT INTO `base_major` VALUES ('081004', '灾害防治工程'); +INSERT INTO `base_major` VALUES ('081005', '环境科学与工程'); +INSERT INTO `base_major` VALUES ('081006', '环境监察'); +INSERT INTO `base_major` VALUES ('081007', '雷电防护科学与技术'); +INSERT INTO `base_major` VALUES ('081008', '核安全工程'); +INSERT INTO `base_major` VALUES ('081009', '环保设备工程'); +INSERT INTO `base_major` VALUES ('081100', '化工与制药类'); +INSERT INTO `base_major` VALUES ('081101', '化学工程与工艺'); +INSERT INTO `base_major` VALUES ('081102', '制药工程'); +INSERT INTO `base_major` VALUES ('081103', '化工与制药'); +INSERT INTO `base_major` VALUES ('081104', '化学工程与工业生物工程'); +INSERT INTO `base_major` VALUES ('081105', '资源科学与工程'); +INSERT INTO `base_major` VALUES ('081106', '能源化学工程'); +INSERT INTO `base_major` VALUES ('081107', '生物制药'); +INSERT INTO `base_major` VALUES ('081200', '交通运输类'); +INSERT INTO `base_major` VALUES ('081201', '交通运输'); +INSERT INTO `base_major` VALUES ('081202', '交通工程'); +INSERT INTO `base_major` VALUES ('081203', '油气储运工程'); +INSERT INTO `base_major` VALUES ('081204', '飞行技术'); +INSERT INTO `base_major` VALUES ('081205', '航海技术'); +INSERT INTO `base_major` VALUES ('081206', '轮机工程'); +INSERT INTO `base_major` VALUES ('081207', '物流工程'); +INSERT INTO `base_major` VALUES ('081208', '海事管理'); +INSERT INTO `base_major` VALUES ('081209', '交通设备信息工程'); +INSERT INTO `base_major` VALUES ('081210', '交通建设与装备'); +INSERT INTO `base_major` VALUES ('081211', '救助与打捞工程'); +INSERT INTO `base_major` VALUES ('081212', '航空器适航技术'); +INSERT INTO `base_major` VALUES ('081213', '交通信息与控制工程'); +INSERT INTO `base_major` VALUES ('081300', '海洋工程类'); +INSERT INTO `base_major` VALUES ('081301', '船舶与海洋工程'); +INSERT INTO `base_major` VALUES ('081302', '海洋工程与技术'); +INSERT INTO `base_major` VALUES ('081303', '海洋资源开发技术'); +INSERT INTO `base_major` VALUES ('081400', '轻工纺织食品类'); +INSERT INTO `base_major` VALUES ('081401', '食品科学与工程'); +INSERT INTO `base_major` VALUES ('081402', '轻化工程'); +INSERT INTO `base_major` VALUES ('081403', '包装工程'); +INSERT INTO `base_major` VALUES ('081404', '印刷工程'); +INSERT INTO `base_major` VALUES ('081405', '纺织工程'); +INSERT INTO `base_major` VALUES ('081406', '服装设计与工程'); +INSERT INTO `base_major` VALUES ('081407', '食品质量与安全'); +INSERT INTO `base_major` VALUES ('081408', '酿酒工程'); +INSERT INTO `base_major` VALUES ('081409', '葡萄与葡萄酒工程'); +INSERT INTO `base_major` VALUES ('081410', '轻工生物技术'); +INSERT INTO `base_major` VALUES ('081411', '农产品质量与安全'); +INSERT INTO `base_major` VALUES ('081412', '非织造材料与工程'); +INSERT INTO `base_major` VALUES ('081413', '数字印刷'); +INSERT INTO `base_major` VALUES ('081414', '植物资源工程'); +INSERT INTO `base_major` VALUES ('081415', '粮食工程'); +INSERT INTO `base_major` VALUES ('081416', '乳品工程'); +INSERT INTO `base_major` VALUES ('081500', '航空航天类'); +INSERT INTO `base_major` VALUES ('081501', '飞行器设计与工程'); +INSERT INTO `base_major` VALUES ('081502', '飞行器动力工程'); +INSERT INTO `base_major` VALUES ('081503', '飞行器制造工程'); +INSERT INTO `base_major` VALUES ('081504', '飞行器环境与生命保障工程'); +INSERT INTO `base_major` VALUES ('081505', '航空航天工程'); +INSERT INTO `base_major` VALUES ('081506', '工程力学与航天航空工程'); +INSERT INTO `base_major` VALUES ('081507', '航天运输与控制'); +INSERT INTO `base_major` VALUES ('081508', '质量与可靠性工程'); +INSERT INTO `base_major` VALUES ('081600', '武器类'); +INSERT INTO `base_major` VALUES ('081601', '武器系统与发射工程'); +INSERT INTO `base_major` VALUES ('081602', '探测制导与控制技术'); +INSERT INTO `base_major` VALUES ('081603', '弹药工程与爆炸技术'); +INSERT INTO `base_major` VALUES ('081604', '特种能源工程与烟火技术'); +INSERT INTO `base_major` VALUES ('081605', '地面武器机动工程'); +INSERT INTO `base_major` VALUES ('081606', '信息对抗技术'); +INSERT INTO `base_major` VALUES ('081607', '武器系统与工程'); +INSERT INTO `base_major` VALUES ('081700', '工程力学类'); +INSERT INTO `base_major` VALUES ('081701', '工程力学'); +INSERT INTO `base_major` VALUES ('081702', '工程结构分析'); +INSERT INTO `base_major` VALUES ('081800', '生物工程类'); +INSERT INTO `base_major` VALUES ('081801', '生物工程'); +INSERT INTO `base_major` VALUES ('081900', '农业工程类'); +INSERT INTO `base_major` VALUES ('081901', '农业机械化及其自动化'); +INSERT INTO `base_major` VALUES ('081902', '农业电气化与自动化'); +INSERT INTO `base_major` VALUES ('081903', '农业建筑环境与能源工程'); +INSERT INTO `base_major` VALUES ('081904', '农业水利工程'); +INSERT INTO `base_major` VALUES ('081905', '农业工程'); +INSERT INTO `base_major` VALUES ('081906', '生物系统工程'); +INSERT INTO `base_major` VALUES ('082000', '林业工程类'); +INSERT INTO `base_major` VALUES ('082001', '森林工程'); +INSERT INTO `base_major` VALUES ('082002', '木材科学与工程'); +INSERT INTO `base_major` VALUES ('082003', '林产化工'); +INSERT INTO `base_major` VALUES ('082100', '公安技术类'); +INSERT INTO `base_major` VALUES ('082101', '刑事科学技术'); +INSERT INTO `base_major` VALUES ('082102', '消防工程'); +INSERT INTO `base_major` VALUES ('082103', '安全防范工程'); +INSERT INTO `base_major` VALUES ('082104', '交通管理工程'); +INSERT INTO `base_major` VALUES ('082105', '核生化消防'); +INSERT INTO `base_major` VALUES ('082106', '公安视听技术'); +INSERT INTO `base_major` VALUES ('082107', '网络安全与执法'); +INSERT INTO `base_major` VALUES ('082303', '农业电气化'); +INSERT INTO `base_major` VALUES ('082802', '城乡规划'); +INSERT INTO `base_major` VALUES ('08SY00', '工科试验班类'); +INSERT INTO `base_major` VALUES ('08SY01', '工科试验班'); +INSERT INTO `base_major` VALUES ('08SY02', '科技与创意设计试验班'); +INSERT INTO `base_major` VALUES ('090100', '植物生产类'); +INSERT INTO `base_major` VALUES ('090101', '农学'); +INSERT INTO `base_major` VALUES ('090102', '园艺'); +INSERT INTO `base_major` VALUES ('090103', '植物保护'); +INSERT INTO `base_major` VALUES ('090104', '茶学'); +INSERT INTO `base_major` VALUES ('090105', '烟草'); +INSERT INTO `base_major` VALUES ('090106', '植物科学与技术'); +INSERT INTO `base_major` VALUES ('090107', '种子科学与工程'); +INSERT INTO `base_major` VALUES ('090108', '应用生物科学'); +INSERT INTO `base_major` VALUES ('090109', '设施农业科学与工程'); +INSERT INTO `base_major` VALUES ('090200', '草业科学类'); +INSERT INTO `base_major` VALUES ('090201', '草业科学'); +INSERT INTO `base_major` VALUES ('090300', '森林资源类'); +INSERT INTO `base_major` VALUES ('090301', '林学'); +INSERT INTO `base_major` VALUES ('090302', '森林资源保护与游憩'); +INSERT INTO `base_major` VALUES ('090303', '野生动物与自然保护区管理'); +INSERT INTO `base_major` VALUES ('090400', '环境生态类'); +INSERT INTO `base_major` VALUES ('090401', '园林'); +INSERT INTO `base_major` VALUES ('090402', '水土保持与荒漠化防治'); +INSERT INTO `base_major` VALUES ('090403', '农业资源与环境'); +INSERT INTO `base_major` VALUES ('090500', '动物生产类'); +INSERT INTO `base_major` VALUES ('090501', '动物科学'); +INSERT INTO `base_major` VALUES ('090502', '蚕学'); +INSERT INTO `base_major` VALUES ('090503', '蜂学'); +INSERT INTO `base_major` VALUES ('090600', '动物医学类'); +INSERT INTO `base_major` VALUES ('090601', '动物医学'); +INSERT INTO `base_major` VALUES ('090602', '动物药学'); +INSERT INTO `base_major` VALUES ('090700', '水产类'); +INSERT INTO `base_major` VALUES ('090701', '水产养殖学'); +INSERT INTO `base_major` VALUES ('090702', '海洋渔业科学与技术'); +INSERT INTO `base_major` VALUES ('090703', '水族科学与技术'); +INSERT INTO `base_major` VALUES ('100100', '基础医学类'); +INSERT INTO `base_major` VALUES ('100101', '基础医学'); +INSERT INTO `base_major` VALUES ('100200', '预防医学类'); +INSERT INTO `base_major` VALUES ('100201', '预防医学'); +INSERT INTO `base_major` VALUES ('100202', '卫生检验'); +INSERT INTO `base_major` VALUES ('100203', '妇幼保健医学'); +INSERT INTO `base_major` VALUES ('100204', '营养学'); +INSERT INTO `base_major` VALUES ('100300', '临床医学与医学技术类'); +INSERT INTO `base_major` VALUES ('100301', '临床医学'); +INSERT INTO `base_major` VALUES ('100302', '麻醉学'); +INSERT INTO `base_major` VALUES ('100303', '医学影像学'); +INSERT INTO `base_major` VALUES ('100304', '医学检验'); +INSERT INTO `base_major` VALUES ('100305', '放射医学'); +INSERT INTO `base_major` VALUES ('100306', '眼视光学'); +INSERT INTO `base_major` VALUES ('100307', '康复治疗学'); +INSERT INTO `base_major` VALUES ('100308', '精神医学'); +INSERT INTO `base_major` VALUES ('100309', '医学技术'); +INSERT INTO `base_major` VALUES ('100310', '听力学'); +INSERT INTO `base_major` VALUES ('100311', '医学实验学'); +INSERT INTO `base_major` VALUES ('100312', '医学美容技术'); +INSERT INTO `base_major` VALUES ('100400', '口腔医学类'); +INSERT INTO `base_major` VALUES ('100401', '口腔医学'); +INSERT INTO `base_major` VALUES ('100402', '口腔修复工艺学'); +INSERT INTO `base_major` VALUES ('100500', '中医学类'); +INSERT INTO `base_major` VALUES ('100501', '中医学'); +INSERT INTO `base_major` VALUES ('100502', '针灸推拿学'); +INSERT INTO `base_major` VALUES ('100503', '蒙医学'); +INSERT INTO `base_major` VALUES ('100504', '藏医学'); +INSERT INTO `base_major` VALUES ('100505', '中西医临床医学'); +INSERT INTO `base_major` VALUES ('100506', '维医学'); +INSERT INTO `base_major` VALUES ('100600', '法医学类'); +INSERT INTO `base_major` VALUES ('100601', '法医学'); +INSERT INTO `base_major` VALUES ('100700', '护理学类'); +INSERT INTO `base_major` VALUES ('100701', '护理学'); +INSERT INTO `base_major` VALUES ('100800', '药学类'); +INSERT INTO `base_major` VALUES ('100801', '药学'); +INSERT INTO `base_major` VALUES ('100802', '中药学'); +INSERT INTO `base_major` VALUES ('100803', '药物制剂'); +INSERT INTO `base_major` VALUES ('100804', '中草药栽培与鉴定'); +INSERT INTO `base_major` VALUES ('100805', '藏药学'); +INSERT INTO `base_major` VALUES ('100806', '中药资源与开发'); +INSERT INTO `base_major` VALUES ('100807', '应用药学'); +INSERT INTO `base_major` VALUES ('100808', '临床药学'); +INSERT INTO `base_major` VALUES ('100809', '海洋药学'); +INSERT INTO `base_major` VALUES ('10080J', '基础药学基地班'); +INSERT INTO `base_major` VALUES ('100810', '药事管理'); +INSERT INTO `base_major` VALUES ('100811', '蒙药学'); +INSERT INTO `base_major` VALUES ('100812', '药物分析'); +INSERT INTO `base_major` VALUES ('100813', '药物化学'); +INSERT INTO `base_major` VALUES ('100814', '中药制药'); +INSERT INTO `base_major` VALUES ('101001', '医学检验技术'); +INSERT INTO `base_major` VALUES ('101003', '医学影像技术'); +INSERT INTO `base_major` VALUES ('101007', '卫生检验与检疫'); +INSERT INTO `base_major` VALUES ('10SY00', '医学试验班类'); +INSERT INTO `base_major` VALUES ('10SY01', '医学试验班'); +INSERT INTO `base_major` VALUES ('110100', '管理科学与工程类'); +INSERT INTO `base_major` VALUES ('110101', '管理科学'); +INSERT INTO `base_major` VALUES ('110102', '信息管理与信息系统'); +INSERT INTO `base_major` VALUES ('110103', '工业工程'); +INSERT INTO `base_major` VALUES ('110104', '工程管理'); +INSERT INTO `base_major` VALUES ('110105', '工程造价'); +INSERT INTO `base_major` VALUES ('110106', '房地产经营管理'); +INSERT INTO `base_major` VALUES ('110107', '产品质量工程'); +INSERT INTO `base_major` VALUES ('110108', '项目管理'); +INSERT INTO `base_major` VALUES ('110109', '管理科学工程'); +INSERT INTO `base_major` VALUES ('110110', '标准化工程'); +INSERT INTO `base_major` VALUES ('110200', '工商管理类'); +INSERT INTO `base_major` VALUES ('110201', '工商管理'); +INSERT INTO `base_major` VALUES ('110202', '市场营销'); +INSERT INTO `base_major` VALUES ('110203', '会计学'); +INSERT INTO `base_major` VALUES ('110204', '财务管理'); +INSERT INTO `base_major` VALUES ('110205', '人力资源管理'); +INSERT INTO `base_major` VALUES ('110206', '旅游管理'); +INSERT INTO `base_major` VALUES ('110207', '商品学'); +INSERT INTO `base_major` VALUES ('110208', '审计学'); +INSERT INTO `base_major` VALUES ('110209', '电子商务'); +INSERT INTO `base_major` VALUES ('110210', '物流管理'); +INSERT INTO `base_major` VALUES ('110211', '国际商务'); +INSERT INTO `base_major` VALUES ('110212', '物业管理'); +INSERT INTO `base_major` VALUES ('110213', '特许经营管理'); +INSERT INTO `base_major` VALUES ('110214', '连锁经营管理'); +INSERT INTO `base_major` VALUES ('110215', '资产评估'); +INSERT INTO `base_major` VALUES ('110216', '电子商务及法律'); +INSERT INTO `base_major` VALUES ('110217', '商务策划管理'); +INSERT INTO `base_major` VALUES ('110218', '酒店管理'); +INSERT INTO `base_major` VALUES ('110219', '采购管理'); +INSERT INTO `base_major` VALUES ('110300', '公共管理类'); +INSERT INTO `base_major` VALUES ('110301', '行政管理'); +INSERT INTO `base_major` VALUES ('110302', '公共事业管理'); +INSERT INTO `base_major` VALUES ('110303', '劳动与社会保障'); +INSERT INTO `base_major` VALUES ('110304', '土地资源管理'); +INSERT INTO `base_major` VALUES ('110305', '公共关系学'); +INSERT INTO `base_major` VALUES ('110306', '高等教育管理'); +INSERT INTO `base_major` VALUES ('110307', '公共政策学'); +INSERT INTO `base_major` VALUES ('110308', '城市管理'); +INSERT INTO `base_major` VALUES ('110309', '公共管理'); +INSERT INTO `base_major` VALUES ('110310', '文化产业管理'); +INSERT INTO `base_major` VALUES ('110311', '会展经济与管理'); +INSERT INTO `base_major` VALUES ('110312', '国防教育与管理'); +INSERT INTO `base_major` VALUES ('110313', '航运管理'); +INSERT INTO `base_major` VALUES ('110314', '劳动关系'); +INSERT INTO `base_major` VALUES ('110315', '公共安全管理'); +INSERT INTO `base_major` VALUES ('110316', '体育产业管理'); +INSERT INTO `base_major` VALUES ('110317', '食品经济管理'); +INSERT INTO `base_major` VALUES ('110318', '应急管理'); +INSERT INTO `base_major` VALUES ('110319', '海关管理'); +INSERT INTO `base_major` VALUES ('110400', '农业经济管理类'); +INSERT INTO `base_major` VALUES ('110401', '农林经济管理'); +INSERT INTO `base_major` VALUES ('110402', '农村区域发展'); +INSERT INTO `base_major` VALUES ('110500', '图书档案学类'); +INSERT INTO `base_major` VALUES ('110501', '图书馆学'); +INSERT INTO `base_major` VALUES ('110502', '档案学'); +INSERT INTO `base_major` VALUES ('110503', '信息资源管理'); +INSERT INTO `base_major` VALUES ('120201', '政治经济学'); +INSERT INTO `base_major` VALUES ('120301', '政治学'); +INSERT INTO `base_major` VALUES ('120302', '国际关系与安全'); +INSERT INTO `base_major` VALUES ('120303', '军事外交'); +INSERT INTO `base_major` VALUES ('120501', '中国语言文学'); +INSERT INTO `base_major` VALUES ('120502', '外国语言文学(外国军事)'); +INSERT INTO `base_major` VALUES ('120601', '军事历史'); +INSERT INTO `base_major` VALUES ('120701', '应用数学'); +INSERT INTO `base_major` VALUES ('120702', '军事气象学'); +INSERT INTO `base_major` VALUES ('120703', '军事海洋学'); +INSERT INTO `base_major` VALUES ('120704', '军事心理学'); +INSERT INTO `base_major` VALUES ('120801', '军用材料工程'); +INSERT INTO `base_major` VALUES ('120802', '机械装备类'); +INSERT INTO `base_major` VALUES ('120803', '车辆运用工程'); +INSERT INTO `base_major` VALUES ('120804', '油料储运工程'); +INSERT INTO `base_major` VALUES ('120805', '舰船动力工程'); +INSERT INTO `base_major` VALUES ('120806', '核动力工程'); +INSERT INTO `base_major` VALUES ('120807', '电力工程及其自动化'); +INSERT INTO `base_major` VALUES ('120808', '电子工程'); +INSERT INTO `base_major` VALUES ('120809', '雷达工程'); +INSERT INTO `base_major` VALUES ('120810', '导航工程'); +INSERT INTO `base_major` VALUES ('120811', '军用光电工程'); +INSERT INTO `base_major` VALUES ('120812', '航空反潜工程'); +INSERT INTO `base_major` VALUES ('120813', '侦测工程'); +INSERT INTO `base_major` VALUES ('120814', '信息研究与安全(密码学)'); +INSERT INTO `base_major` VALUES ('120815', '密码装备工程'); +INSERT INTO `base_major` VALUES ('120816', '仿真工程'); +INSERT INTO `base_major` VALUES ('120817', '指挥自动化工程'); +INSERT INTO `base_major` VALUES ('120818', '国防建筑学'); +INSERT INTO `base_major` VALUES ('120819', '土木工程'); +INSERT INTO `base_major` VALUES ('120820', '野战给水工程'); +INSERT INTO `base_major` VALUES ('120821', '国防建筑设备工程'); +INSERT INTO `base_major` VALUES ('120822', '道路桥梁与渡河濒海工程'); +INSERT INTO `base_major` VALUES ('120823', '测绘遥感类'); +INSERT INTO `base_major` VALUES ('120824', '测量工程'); +INSERT INTO `base_major` VALUES ('120825', '地图学与地理信息工程'); +INSERT INTO `base_major` VALUES ('120826', '工程物理'); +INSERT INTO `base_major` VALUES ('120827', '生化防护工程'); +INSERT INTO `base_major` VALUES ('120828', '国防工程与防护'); +INSERT INTO `base_major` VALUES ('120829', '伪装工程'); +INSERT INTO `base_major` VALUES ('120830', '舰船与海洋工程'); +INSERT INTO `base_major` VALUES ('120831', '飞行器系统与工程'); +INSERT INTO `base_major` VALUES ('120832', '空间工程'); +INSERT INTO `base_major` VALUES ('120833', '兵器工程'); +INSERT INTO `base_major` VALUES ('120834', '导弹工程'); +INSERT INTO `base_major` VALUES ('120835', '弹药工程'); +INSERT INTO `base_major` VALUES ('120836', '地雷爆破与破障工程'); +INSERT INTO `base_major` VALUES ('120837', '控制测试类'); +INSERT INTO `base_major` VALUES ('120838', '火力指挥与控制工程'); +INSERT INTO `base_major` VALUES ('120839', '测控工程'); +INSERT INTO `base_major` VALUES ('120840', '无人机运用工程'); +INSERT INTO `base_major` VALUES ('120841', '探测工程'); +INSERT INTO `base_major` VALUES ('121101', '管理工程'); +INSERT INTO `base_major` VALUES ('121102', '系统工程'); +INSERT INTO `base_major` VALUES ('121103', '经济管理类'); +INSERT INTO `base_major` VALUES ('121104', '军队财务管理'); +INSERT INTO `base_major` VALUES ('121105', '装备经济管理'); +INSERT INTO `base_major` VALUES ('121106', '军队审计'); +INSERT INTO `base_major` VALUES ('121107', '军队采办'); +INSERT INTO `base_major` VALUES ('121300', '兵种指挥类'); +INSERT INTO `base_major` VALUES ('121301', '炮兵指挥'); +INSERT INTO `base_major` VALUES ('121302', '防空兵指挥'); +INSERT INTO `base_major` VALUES ('121303', '装甲兵指挥'); +INSERT INTO `base_major` VALUES ('121304', '工程兵指挥'); +INSERT INTO `base_major` VALUES ('121305', '防化兵指挥'); +INSERT INTO `base_major` VALUES ('121400', '航空航天指挥类'); +INSERT INTO `base_major` VALUES ('121401', '航空飞行与指挥'); +INSERT INTO `base_major` VALUES ('121402', '地面领航与航空管制'); +INSERT INTO `base_major` VALUES ('121403', '航天指挥'); +INSERT INTO `base_major` VALUES ('121500', '信息作战指挥类'); +INSERT INTO `base_major` VALUES ('121501', '侦察与特种兵指挥'); +INSERT INTO `base_major` VALUES ('121502', '通信指挥'); +INSERT INTO `base_major` VALUES ('121503', '电子对抗指挥与工程'); +INSERT INTO `base_major` VALUES ('121504', '军事情报'); +INSERT INTO `base_major` VALUES ('121505', '作战信息管理'); +INSERT INTO `base_major` VALUES ('121506', '预警探测指挥'); +INSERT INTO `base_major` VALUES ('121600', '保障指挥类'); +INSERT INTO `base_major` VALUES ('121601', '军事交通指挥与工程'); +INSERT INTO `base_major` VALUES ('121602', '汽车指挥'); +INSERT INTO `base_major` VALUES ('121603', '船艇指挥'); +INSERT INTO `base_major` VALUES ('121604', '航空兵场站指挥'); +INSERT INTO `base_major` VALUES ('121605', '国防工程指挥'); +INSERT INTO `base_major` VALUES ('121606', '装备保障指挥'); +INSERT INTO `base_major` VALUES ('121607', '军需勤务指挥'); +INSERT INTO `base_major` VALUES ('121700', '武警指挥类'); +INSERT INTO `base_major` VALUES ('121701', '武警指挥'); +INSERT INTO `base_major` VALUES ('130101', '艺术史论'); +INSERT INTO `base_major` VALUES ('130201', '音乐表演'); +INSERT INTO `base_major` VALUES ('130202', '音乐学'); +INSERT INTO `base_major` VALUES ('130203', '作曲与作曲技术理论'); +INSERT INTO `base_major` VALUES ('130204', '舞蹈表演'); +INSERT INTO `base_major` VALUES ('130205', '舞蹈学'); +INSERT INTO `base_major` VALUES ('130206', '舞蹈编导'); +INSERT INTO `base_major` VALUES ('130301', '表演'); +INSERT INTO `base_major` VALUES ('130302', '戏剧学'); +INSERT INTO `base_major` VALUES ('130303', '电影学'); +INSERT INTO `base_major` VALUES ('130304', '戏剧影视文学'); +INSERT INTO `base_major` VALUES ('130305', '广播电视编导'); +INSERT INTO `base_major` VALUES ('130306', '戏剧影视导演'); +INSERT INTO `base_major` VALUES ('130307', '戏剧影视美术设计'); +INSERT INTO `base_major` VALUES ('130308', '录音艺术'); +INSERT INTO `base_major` VALUES ('130309', '播音与主持艺术'); +INSERT INTO `base_major` VALUES ('130310', '动画'); +INSERT INTO `base_major` VALUES ('130311', '影视摄影与制作'); +INSERT INTO `base_major` VALUES ('130401', '美术学'); +INSERT INTO `base_major` VALUES ('130402', '绘画'); +INSERT INTO `base_major` VALUES ('130403', '雕塑'); +INSERT INTO `base_major` VALUES ('130404', '摄影'); +INSERT INTO `base_major` VALUES ('130405', '书法学'); +INSERT INTO `base_major` VALUES ('130406', '中国画'); +INSERT INTO `base_major` VALUES ('130500', '设计学类'); +INSERT INTO `base_major` VALUES ('130501', '艺术设计学'); +INSERT INTO `base_major` VALUES ('130502', '视觉传达设计'); +INSERT INTO `base_major` VALUES ('130503', '环境设计'); +INSERT INTO `base_major` VALUES ('130504', '产品设计'); +INSERT INTO `base_major` VALUES ('130505', '服装与服饰设计'); +INSERT INTO `base_major` VALUES ('130506', '公共艺术'); +INSERT INTO `base_major` VALUES ('130507', '工艺美术'); +INSERT INTO `base_major` VALUES ('130508', '数字媒体艺术'); +INSERT INTO `base_major` VALUES ('130509', '艺术与科技'); + +INSERT INTO `base_political_status`(`id`, `name`) VALUES (0, '----'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (1, '中共党员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (2, '中共预备党员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (3, '共青团员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (4, '民革会员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (5, '民盟盟员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (6, '民建会员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (7, '民进会员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (8, '农工党党员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (9, '致公党党员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (10, '九三学社社员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (11, '台盟盟员'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (12, '无党派民主人士'); +INSERT INTO `base_political_status`(`id`, `name`) VALUES (13, '群众'); + diff --git a/src/test/java/com/codesdream/ase/test/DataManagerTest.java b/src/test/java/com/codesdream/ase/test/DataManagerTest.java index accbfde..e3065c5 100644 --- a/src/test/java/com/codesdream/ase/test/DataManagerTest.java +++ b/src/test/java/com/codesdream/ase/test/DataManagerTest.java @@ -3,22 +3,28 @@ package com.codesdream.ase.test; import com.codesdream.ase.component.ASESpringUtil; import com.codesdream.ase.component.datamanager.*; import com.codesdream.ase.repository.permission.UserRepository; +import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; +import java.io.*; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.Optional; /** * 测试DataModel相关查找器 */ +@Slf4j @RunWith(SpringRunner.class) @SpringBootTest +@ActiveProfiles("test") public class DataManagerTest { @Resource ASESpringUtil springUtil; @@ -133,6 +139,7 @@ public class DataManagerTest { Assert.assertEquals(iterator.next(), "16"); } + // Excel表格导入测试 @Test public void dataTableImportTest(){ DataTable table = springUtil.getBean(DataTable.class); @@ -144,6 +151,7 @@ public class DataManagerTest { Assert.assertEquals(iterator.next(), "18"); } + // Excel表格导出测试 @Test public void dataTableExportTest(){ DataTable table = springUtil.getBean(DataTable.class); @@ -164,5 +172,32 @@ public class DataManagerTest { table.exportTable(new DataExcelGenerator("DataTableExport.xlsx")); } + // 字符串文件测试 + @Test + public void File2StringTest() throws IOException { + FileInputStream stream = new FileInputStream("test.pdf"); + + StringFileGenerator generator = springUtil.getBean(StringFileGenerator.class); + Optional file = generator.generateStringFile(stream); + + // 检查是否转换成功 + Assert.assertTrue(file.isPresent()); + // 检查字符串文件的校验功能 + Assert.assertTrue(generator.checkStringFile(file.get())); + + // 输出转化 + FileOutputStream outputStream = new FileOutputStream("testOut.pdf"); + InputStream inputStream = generator.readFileString(file.get()); + + // 输出文件 + int read = 0; + byte[] bytes = new byte[1024]; + while ((read = inputStream.read(bytes)) != -1) { + outputStream.write(bytes, 0, read); + } + + outputStream.close(); + } + } diff --git a/src/test/java/com/codesdream/ase/test/UserTest.java b/src/test/java/com/codesdream/ase/test/UserTest.java index a30513c..9274f19 100644 --- a/src/test/java/com/codesdream/ase/test/UserTest.java +++ b/src/test/java/com/codesdream/ase/test/UserTest.java @@ -10,9 +10,12 @@ import javafx.util.Pair; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; +import javax.swing.text.html.Option; +import java.util.Optional; /** * 用户基本表单元测试 @@ -20,6 +23,7 @@ import javax.annotation.Resource; */ @RunWith(SpringRunner.class) @SpringBootTest +@ActiveProfiles("test") public class UserTest { @Resource @@ -30,12 +34,6 @@ public class UserTest { */ @Test public void UserBaseTest_1(){ - // 查找数据库中是否有重复项 - Pair checker = userService.checkIfUserExists("Tim"); - if(checker.getKey()){ - userService.delete(checker.getValue()); - } - User user = userService.getDefaultUser(); user.setUsername("Tim"); user.setPassword("123456"); @@ -44,6 +42,7 @@ public class UserTest { user.getUserAuth().setUserQuestion("Your favourite animal?"); user.getUserAuth().setUserAnswer("Cat"); user.getUserDetail().setAtSchool(true); + user.getUserDetail().setRealName("提姆"); userService.save(user); user = userService.findUserByUsername("Tim"); @@ -51,6 +50,7 @@ public class UserTest { assertEquals(user.getUsername(), "Tim"); assertEquals(user.getPassword(), "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"); + // 检查账号状态 assertTrue(user.isEnabled()); assertFalse(user.isDeleted()); @@ -65,7 +65,19 @@ public class UserTest { @Test public void UserBaseTest_2(){ + User user = userService.findUserByUsername("Tim"); + assertNotNull(user); + + user.setEnabled(false); + user.getUserAuth().setMail("saturneric@163.com"); + user.getUserDetail().setRealName("张三丰"); + + user = userService.update(user); + + assertEquals(user.getUserAuth().getMail(), "saturneric@163.com"); + assertEquals(user.getUserDetail().getRealName(), "张三丰"); + assertFalse(user.isEnabled()); } } From ae21439c2efda64252bb442ade1a080b17abe393 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Sun, 22 Mar 2020 17:57:43 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=B1=81=E5=85=8D;=E5=BC=80=E5=A7=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E5=AD=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3;=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=9E=B6=E6=9E=84;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +++---- .../ASEAccessDeniedHandler.java | 2 +- .../ASEAuthenticationEntryPoint.java | 2 +- .../ASEAuthenticationFailureHandler.java | 2 +- .../ASEAuthenticationSuccessHandler.java | 2 +- .../ASEJSONTokenAuthenticationFilter.java | 10 ++++++-- .../ASEPasswordEncoder.java | 2 +- .../ASESecurityAuthenticationProvider.java | 4 +--- .../ASEUsernameEncoder.java | 2 +- ...EUsernamePasswordAuthenticationFilter.java | 6 ++--- .../ase/configure/AppConfigure.java | 1 + .../configure/CustomWebSecurityConfig.java | 6 +---- .../ase/controller/LeavesController.java | 2 +- .../ase/controller/LoginController.java | 4 +--- .../ase/controller/PermissionContainer.java | 23 +++++++++++++++++++ .../codesdream/ase/service/UserService.java | 4 ++-- .../ase/test/PermissionServiceTest.java | 2 ++ 17 files changed, 52 insertions(+), 30 deletions(-) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEAccessDeniedHandler.java (95%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEAuthenticationEntryPoint.java (96%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEAuthenticationFailureHandler.java (97%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEAuthenticationSuccessHandler.java (97%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEJSONTokenAuthenticationFilter.java (90%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEPasswordEncoder.java (91%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASESecurityAuthenticationProvider.java (93%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEUsernameEncoder.java (89%) rename src/main/java/com/codesdream/ase/component/{permission => auth}/ASEUsernamePasswordAuthenticationFilter.java (93%) create mode 100644 src/main/java/com/codesdream/ase/controller/PermissionContainer.java diff --git a/pom.xml b/pom.xml index a550983..1307c09 100644 --- a/pom.xml +++ b/pom.xml @@ -139,10 +139,10 @@ - org.mariadb.jdbc - mariadb-java-client - 2.5.4 - + org.mariadb.jdbc + mariadb-java-client + 2.5.4 + com.h2database diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java similarity index 95% rename from src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java rename to src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java index 48405bb..3ab64a1 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.datamanager.QuickJSONRespond; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java similarity index 96% rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java index b3f5962..a72840e 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.datamanager.QuickJSONRespond; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java similarity index 97% rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java index ee82950..b3a9dae 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.datamanager.QuickJSONRespond; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java similarity index 97% rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java index 857e4b5..2a44f39 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken; import com.codesdream.ase.component.datamanager.JSONParameter; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java similarity index 90% rename from src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java rename to src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java index e8c0585..fe35cef 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.auth.AJAXRequestChecker; import com.codesdream.ase.component.auth.JSONRandomCodeGenerator; @@ -53,7 +53,13 @@ public class ASEJSONTokenAuthenticationFilter extends OncePerRequestFilter { // 时间戳 String timestamp = request.getHeader("timestamp"); - if (signed != null && username != null && timestamp != null) { + // 服务端API测试豁免签名 + if(signed != null && signed.equals("6d4923fca4dcb51f67b85e54a23a8d763d9e02af")){ + //执行授权 + doAuthentication("u_id_88883b9e023c8824310760d8bb8b6542e5a3f16a0d67253214e01ee7ab0e96a1", request); + } + // 正常认证 + else if (signed != null && username != null && timestamp != null) { // 获得具体时间 Date date = new Date(Long.parseLong(timestamp)); diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java b/src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java similarity index 91% rename from src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java rename to src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java index 2682436..95c66c4 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.security.crypto.password.PasswordEncoder; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java similarity index 93% rename from src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java rename to src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java index 61edbd5..f347be8 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java @@ -1,7 +1,5 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; -import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken; -import com.codesdream.ase.component.auth.JSONTokenUsernamePasswordAuthenticationToken; import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.*; import org.springframework.security.core.Authentication; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java b/src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java similarity index 89% rename from src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java rename to src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java index eee9acf..c4dc157 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java similarity index 93% rename from src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java rename to src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java index 6f6acb0..6cd03ad 100644 --- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.component.permission; +package com.codesdream.ase.component.auth; import com.codesdream.ase.component.auth.AJAXRequestChecker; import com.codesdream.ase.component.auth.JSONTokenUsernamePasswordAuthenticationToken; @@ -8,19 +8,17 @@ import com.codesdream.ase.component.json.request.UserLoginChecker; import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; -import org.springframework.web.bind.annotation.RequestMapping; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Optional; -// 登录验证过滤器 +// 普通登录验证过滤器 @Slf4j public class ASEUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter { diff --git a/src/main/java/com/codesdream/ase/configure/AppConfigure.java b/src/main/java/com/codesdream/ase/configure/AppConfigure.java index c59dd88..2d606c6 100644 --- a/src/main/java/com/codesdream/ase/configure/AppConfigure.java +++ b/src/main/java/com/codesdream/ase/configure/AppConfigure.java @@ -39,4 +39,5 @@ public class AppConfigure { public String getOrganization() { return "全员育人WEB端开发组"; } + } diff --git a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java index 1bb0f98..96d414a 100644 --- a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java +++ b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java @@ -1,10 +1,9 @@ package com.codesdream.ase.configure; -import com.codesdream.ase.component.permission.*; +import com.codesdream.ase.component.auth.*; import com.codesdream.ase.service.ASEUserDetailsService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; @@ -14,11 +13,8 @@ import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.session.SessionRegistry; import org.springframework.security.core.session.SessionRegistryImpl; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy; import org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy; import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; -import org.springframework.security.web.context.HttpSessionSecurityContextRepository; -import org.springframework.security.web.context.SecurityContextPersistenceFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import javax.annotation.Resource; diff --git a/src/main/java/com/codesdream/ase/controller/LeavesController.java b/src/main/java/com/codesdream/ase/controller/LeavesController.java index a415cf2..d94a638 100644 --- a/src/main/java/com/codesdream/ase/controller/LeavesController.java +++ b/src/main/java/com/codesdream/ase/controller/LeavesController.java @@ -3,7 +3,7 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.json.request.UserLeaveRequest; -import com.codesdream.ase.component.permission.ASEUsernameEncoder; +import com.codesdream.ase.component.auth.ASEUsernameEncoder; import com.codesdream.ase.service.LeavesService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index bc04afe..0935d3c 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond; -import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; -import com.codesdream.ase.component.permission.ASEUsernameEncoder; import com.codesdream.ase.component.json.request.UserLoginChecker; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import com.codesdream.ase.service.IUserService; @@ -49,7 +47,7 @@ public class LoginController { // 检查是否为JSON Optional json = jsonParameter.getJSONByRequest(request); - if(!json.isPresent()) return jsonParameter.getJSONString(new JSONStandardFailedRespond()); + if(!json.isPresent()) return quickJSONRespond.getRespond400("Invalid JSON Form"); UserLoginChecker loginChecker = json.get().toJavaObject(UserLoginChecker.class); diff --git a/src/main/java/com/codesdream/ase/controller/PermissionContainer.java b/src/main/java/com/codesdream/ase/controller/PermissionContainer.java new file mode 100644 index 0000000..92f447f --- /dev/null +++ b/src/main/java/com/codesdream/ase/controller/PermissionContainer.java @@ -0,0 +1,23 @@ +package com.codesdream.ase.controller; + +import org.springframework.security.access.annotation.Secured; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +@RestController +@RequestMapping("pmt") +public class PermissionContainer { + + @Secured({"ROLE_ADMIN","ROLE_USER"}) + @PostMapping("tag") + public String createTag(HttpServletRequest request, Authentication authentication){ + return ""; + } + + +} diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index bad45eb..9fe7045 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -1,7 +1,7 @@ package com.codesdream.ase.service; -import com.codesdream.ase.component.permission.ASEPasswordEncoder; -import com.codesdream.ase.component.permission.ASEUsernameEncoder; +import com.codesdream.ase.component.auth.ASEPasswordEncoder; +import com.codesdream.ase.component.auth.ASEUsernameEncoder; import com.codesdream.ase.component.permission.UserRolesListGenerator; import com.codesdream.ase.exception.UserInformationIllegalException; import com.codesdream.ase.exception.UserNotFoundException; diff --git a/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java b/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java index f5fb5f1..8bc8cd2 100644 --- a/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java +++ b/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java @@ -8,6 +8,7 @@ import com.codesdream.ase.service.IPermissionService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; @@ -15,6 +16,7 @@ import javax.annotation.Resource; @SpringBootTest @RunWith(SpringRunner.class) +@ActiveProfiles("test") public class PermissionServiceTest { @Resource From 720b047144ffaef8dd27042e088b188bca22daea Mon Sep 17 00:00:00 2001 From: yourtree <56780191+yourtree@users.noreply.github.com> Date: Sun, 22 Mar 2020 21:06:43 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BB=8EJSON?= =?UTF-8?q?=E5=88=B0activity=E7=9A=84=E8=BD=AC=E5=8C=96=E5=99=A8=E3=80=82?= =?UTF-8?q?=20=E8=BF=9B=E8=80=8C=E5=A1=AB=E8=A1=A5=E4=BA=86repository?= =?UTF-8?q?=E5=B1=82=E5=92=8Cservice=E5=B1=82=E7=9A=84=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E3=80=82=20=E5=A2=9E=E5=8A=A0=E4=BA=86JSON=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=A0=A1=E9=AA=8C=EF=BC=8C=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E6=8A=8A=E6=A0=87=E5=87=86=E8=A1=A8=E5=8D=95=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=94=BE=E5=9C=A8configure=E5=B1=82=E4=B8=8B=E3=80=82=20?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=88=9D=E5=A7=8B=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BE=9D=E8=B5=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index a550983..ef76283 100644 --- a/pom.xml +++ b/pom.xml @@ -150,6 +150,19 @@ runtime + + + com.google.zxing + core + 3.2.0 + + + + com.google.zxing + javase + 3.2.0 + + From 15cdca1894bc539b968c6410c302fcec02ebb054 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Mon, 23 Mar 2020 22:46:41 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=EF=BC=88=E4=BF=AE=E6=AD=A3=EF=BC=89=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BB=8EJSON=E5=88=B0activity?= =?UTF-8?q?=E7=9A=84=E8=BD=AC=E5=8C=96=E5=99=A8=E3=80=82=20=E8=BF=9B?= =?UTF-8?q?=E8=80=8C=E5=A1=AB=E8=A1=A5=E4=BA=86repository=E5=B1=82?= =?UTF-8?q?=E5=92=8Cservice=E5=B1=82=E7=9A=84=E7=BC=BA=E5=A4=B1=E3=80=82?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E4=BA=86JSON=E8=A1=A8=E5=8D=95=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=A0=A1=E9=AA=8C=EF=BC=8C=E6=8E=A8=E8=8D=90=E6=8A=8A?= =?UTF-8?q?=E6=A0=87=E5=87=86=E8=A1=A8=E5=8D=95=E6=A0=BC=E5=BC=8F=E6=94=BE?= =?UTF-8?q?=E5=9C=A8configure=E5=B1=82=E4=B8=8B=E3=80=82=20=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E5=88=9D=E5=A7=8B=E5=AD=A6=E4=B9=A0=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BE=9D=E8=B5=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/activity/ActivityConverter.java | 168 ++++++++++++++++++ .../activity/ActivityCreatorController.java | 38 ++-- .../activity/ActivityViewerController.java | 4 +- .../exception/InvalidFormFormatException.java | 2 +- .../codesdream/ase/model/activity/Period.java | 5 + .../activity/AttendanceRepository.java | 9 + .../repository/activity/PeriodRepository.java | 9 + .../ase/service/AttendanceService.java | 18 ++ .../codesdream/ase/service/PeriodService.java | 22 +++ .../ase/validator/ActivityValidator.java | 5 +- .../ase/validator/JSONFormValidator.java | 30 ++++ .../ase/validator/WebFormValidator.java | 19 -- .../ase/test/JSONFormValidatorTest.java | 61 +++++++ 13 files changed, 349 insertions(+), 41 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java create mode 100644 src/main/java/com/codesdream/ase/repository/activity/AttendanceRepository.java create mode 100644 src/main/java/com/codesdream/ase/repository/activity/PeriodRepository.java create mode 100644 src/main/java/com/codesdream/ase/service/AttendanceService.java create mode 100644 src/main/java/com/codesdream/ase/service/PeriodService.java create mode 100644 src/main/java/com/codesdream/ase/validator/JSONFormValidator.java delete mode 100644 src/main/java/com/codesdream/ase/validator/WebFormValidator.java create mode 100644 src/test/java/com/codesdream/ase/test/JSONFormValidatorTest.java diff --git a/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java new file mode 100644 index 0000000..e3f0d18 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java @@ -0,0 +1,168 @@ +package com.codesdream.ase.component.activity; + +import com.alibaba.fastjson.JSONObject; +import com.codesdream.ase.exception.DataInvalidFormatException; +import com.codesdream.ase.model.activity.Activity; +import com.codesdream.ase.model.activity.Attendance; +import com.codesdream.ase.model.activity.Period; +import com.codesdream.ase.model.permission.User; +import com.codesdream.ase.repository.activity.ActivityRepository; +import com.codesdream.ase.service.ActivityService; +import com.codesdream.ase.service.AttendanceService; +import com.codesdream.ase.service.PeriodService; +import com.codesdream.ase.service.UserService; +import javafx.util.converter.LocalDateTimeStringConverter; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; + +//将合法的JSON对象转化为Activity对象 +@Component +public class ActivityConverter { + + @Resource + ActivityService activityService; + + @Resource + UserService userService; + + @Resource + PeriodService periodService; + + @Resource + AttendanceService attendanceService; + + public Activity convertToActivity(Optional json) { + if (!json.isPresent()) { + throw new NullPointerException(); + } + Activity activity = new Activity(); + JSONObject jsonObject = json.get(); + + String username = (String) jsonObject.get("creator"); + User creator = userService.findUserByUsername(username); + activity.setCreator(creator); + + List participateGroupFromJson = (List) jsonObject.get("participate-group"); + Set participateGroup = new HashSet<>(); + for (String name : participateGroupFromJson) { + User user = userService.findUserByUsername(name); + participateGroup.add(user); + } + activity.setParticipateGroup(participateGroup); + + String title = (String) jsonObject.get("title"); + activity.setTitle(title); + + String chiefManagerName = (String) jsonObject.get("chief-manager"); + User chiefManager = userService.findUserByUsername(chiefManagerName); + activity.setChiefManager(chiefManager); + + List assistManagerFromJSON = (List) jsonObject.get("assist-manager"); + Set assistManager = new HashSet<>(); + for (String name : assistManagerFromJSON) { + User user = userService.findUserByUsername(name); + assistManager.add(user); + } + activity.setAssistManagers(assistManager); + + String type = (String) jsonObject.get("type"); + activity.setType(type); + + String startTimeFromJSON = (String) jsonObject.get("start-time"); + String endTimeFromJSON = (String) jsonObject.get("end-time"); + LocalDateTime startTime = LocalDateTime.parse(startTimeFromJSON, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + LocalDateTime endTime = LocalDateTime.parse(endTimeFromJSON, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + Period period = new Period(startTime, endTime); + period.setEnabled(false); + period = periodService.save(period); + activity.setPlanPeriod(period); + + String cycle = (String) jsonObject.get("cycle"); + activity.setCycle(cycle); + + String description = (String) jsonObject.get("description"); + activity.setDescription(description); + + List signGroupFromJSON = (List) jsonObject.get("sign-group"); + Set signGroup = new HashSet<>(); + for (String name : signGroupFromJSON) { + User user = userService.findUserByUsername(name); + signGroup.add(user); + } + activity.setSignGroup(signGroup); + + List informGroupFromJSON = (List) jsonObject.get("inform-group"); + Set informGroup = new HashSet<>(); + for (String name : informGroupFromJSON) { + User user = userService.findUserByUsername(name); + informGroup.add(user); + } + activity.setInformGroup(informGroup); + + List visibleGroupFromJSON = (List) jsonObject.get("visible-group"); + Set visibleGroup = new HashSet<>(); + for (String name : visibleGroupFromJSON) { + User user = userService.findUserByUsername(name); + visibleGroup.add(user); + } + activity.setVisibleGroup(informGroup); + + String remindTimeFromJSON = (String) jsonObject.get("remind-time"); + String numStr = remindTimeFromJSON.substring(0, remindTimeFromJSON.length() - 1); + int num = Integer.parseInt(numStr); + char unit = remindTimeFromJSON.charAt(remindTimeFromJSON.length() - 1); + switch (unit) { + case 'w': { + activity.setRemindTime(activity.getPlanPeriod().getStartTime().minusWeeks(num)); + break; + } + case 'd': { + activity.setRemindTime(activity.getPlanPeriod().getStartTime().minusDays(num)); + break; + } + case 'm': { + activity.setRemindTime(activity.getPlanPeriod().getStartTime().minusMinutes(num)); + break; + } + case 'h': { + activity.setRemindTime(activity.getPlanPeriod().getStartTime().minusHours(num)); + break; + } + case 's': { + activity.setRemindTime(activity.getPlanPeriod().getStartTime().minusSeconds(num)); + } + } + + Set periods = new HashSet<>(); + String[] attendanceTimes = (String[]) jsonObject.get("attendance"); + boolean attendanceOnLine = (boolean) jsonObject.get("attendance-online"); + if ((attendanceTimes.length & 1) == 1) { + throw new DataInvalidFormatException(); + } + for (int i = 0; i < attendanceTimes.length; i += 2) { + LocalDateTime start = LocalDateTime.parse(attendanceTimes[i], DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + LocalDateTime end = LocalDateTime.parse(attendanceTimes[i + 1], DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + Period period1 = new Period(start, end); + periods.add(period1); + } + Attendance attendance = new Attendance(); + attendance.setClockInPeriods(periods); + attendance.setOnline(attendanceOnLine); + /** + * 二维码模块未完成 + */ + attendance = attendanceService.save(attendance); + activity.setAttendance(attendance); + + activity.setOn(false); + activity.setOff(false); + + return activity; + + } +} diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java index 25f1d4b..ad6e384 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java @@ -1,14 +1,13 @@ package com.codesdream.ase.controller.activity; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.ASESpringUtil; +import com.codesdream.ase.component.activity.ActivityConverter; import com.codesdream.ase.component.activity.NullValueAttributes; import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; +import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond; import com.codesdream.ase.configure.ActivityFormConfigure; import com.codesdream.ase.exception.InvalidFormFormatException; -import com.codesdream.ase.exception.UserNotFoundException; import com.codesdream.ase.model.activity.Activity; import com.codesdream.ase.model.activity.UserActivity; import com.codesdream.ase.model.permission.User; @@ -17,7 +16,7 @@ import com.codesdream.ase.repository.permission.UserRepository; import com.codesdream.ase.service.ActivityService; import com.codesdream.ase.validator.ActivityValidator; import com.codesdream.ase.validator.NullValueValidator; -import com.codesdream.ase.validator.WebFormValidator; +import com.codesdream.ase.validator.JSONFormValidator; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PostMapping; @@ -48,7 +47,7 @@ public class ActivityCreatorController { ActivityFormConfigure activityFormConfigure; @Resource - WebFormValidator webFormValidator; + JSONFormValidator jsonFormValidator; @Resource NullValueValidator nullValueValidator; @@ -65,6 +64,9 @@ public class ActivityCreatorController { @Resource UserActivityRepository userActivityRepository; + @Resource + ActivityConverter activityConverter; + private final String url = "/forget/activity"; @RequestMapping(value = url + "/activity_creator") @@ -73,24 +75,22 @@ public class ActivityCreatorController { @PostMapping(value = url + "/activity_creator") @ResponseBody - String activityCreator(@RequestBody JSONObject jsonParam, Model model, HttpServletRequest request) throws InvalidFormFormatException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { + String activityCreator(HttpServletRequest request) throws InvalidFormFormatException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { JSONObject error = new JSONObject(); - - Map parameterMap = request.getParameterMap(); aseSpringUtil = new ASESpringUtil(); + Optional json = jsonParameter.getJSONByRequest(request); + if (!json.isPresent()) return jsonParameter.getJSONString(new JSONStandardFailedRespond()); + //WebFormValidator webFormValidator = aseSpringUtil.getBean(WebFormValidator.class); - if(!webFormValidator.check(activityFormConfigure.getStdActivityForm(), parameterMap)) { - error.put("error", "Invalid form format"); + List formatCheckResult = jsonFormValidator.check(activityFormConfigure.getStdActivityForm(), json.get()); + if (!formatCheckResult.isEmpty()) { + error.put("error", formatCheckResult); return error.toJSONString(); } // 需要检查JSON是否合法 - Optional jsonObject = jsonParameter.getJSONByRequest(request); - if(!jsonObject.isPresent()){ - error.put("error", "Invalid type."); - return error.toJSONString(); - } - Activity activity = jsonObject.get().toJavaObject(Activity.class); + + Activity activity = activityConverter.convertToActivity(json); //NullValueValidator nullValueValidator = aseSpringUtil.getBean(NullValueValidator.class); List nullValues = nullValueValidator.checkNullValues(activity); @@ -116,7 +116,7 @@ public class ActivityCreatorController { if(nullValueAttributes.getNullValueAttributes().isEmpty()){ //ActivityValidator activityValidator = aseSpringUtil.getBean(ActivityValidator.class); - String[] errorParameters = activityValidator.check(parameterMap); + String[] errorParameters = activityValidator.check(json); if(errorParameters != null){ JSONObject invalidParameters = new JSONObject(); invalidParameters.put("invalid_parameters", errorParameters); @@ -127,7 +127,7 @@ public class ActivityCreatorController { //UserRepository userRepository = aseSpringUtil.getBean(UserRepository.class); //activityService = aseSpringUtil.getBean(ActivityService.class); activity = activityService.createActivity(activity); - String username = parameterMap.get("creator")[0]; + String username = json.get().get("creator").toString(); Optional user = userRepository.findByUsername(username); //UserActivityRepository userActivityRepository = aseSpringUtil.getBean(UserActivityRepository.class); UserActivity userActivity = userActivityRepository.findByUser(user.get()); @@ -135,7 +135,7 @@ public class ActivityCreatorController { userActivityRepository.save(userActivity); } } - //否则返回一个JSON对象给前端,此处应该是JSP页面,动态标红 + //否则返回一个JSON对象给前端 else{ JSONObject nullParameters = new JSONObject(); nullParameters.put("null_values",nullValueAttributes.getNullValueAttributes()); diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java index e6df04e..7068097 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java @@ -17,13 +17,15 @@ import java.security.Principal; @Controller public class ActivityViewerController { + private final String url = "/forget/activity"; + @Resource ActivityService activityService; @Resource ActivityRepository activityRepository; - @RequestMapping(value = "/my/participated", method = RequestMethod.GET) + @RequestMapping(value = url + "/my/participated", method = RequestMethod.GET) String showParticipated(Model model, HttpServletRequest request){ Principal principal = request.getUserPrincipal(); String username = principal.getName(); diff --git a/src/main/java/com/codesdream/ase/exception/InvalidFormFormatException.java b/src/main/java/com/codesdream/ase/exception/InvalidFormFormatException.java index f688f5e..be25439 100644 --- a/src/main/java/com/codesdream/ase/exception/InvalidFormFormatException.java +++ b/src/main/java/com/codesdream/ase/exception/InvalidFormFormatException.java @@ -9,7 +9,7 @@ import javax.persistence.criteria.CriteriaBuilder; @Data public class InvalidFormFormatException extends Throwable { - private String message = ""; + private String message = "Invalid form format"; public InvalidFormFormatException(){ super(); diff --git a/src/main/java/com/codesdream/ase/model/activity/Period.java b/src/main/java/com/codesdream/ase/model/activity/Period.java index 38c12ec..8064ffc 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Period.java +++ b/src/main/java/com/codesdream/ase/model/activity/Period.java @@ -29,4 +29,9 @@ public class Period { @Column(name = "enabled")//, nullable = false) private boolean enabled; + public Period(LocalDateTime startTime, LocalDateTime endTime) { + this.startTime = startTime; + this.endTime = endTime; + } + } diff --git a/src/main/java/com/codesdream/ase/repository/activity/AttendanceRepository.java b/src/main/java/com/codesdream/ase/repository/activity/AttendanceRepository.java new file mode 100644 index 0000000..31776a3 --- /dev/null +++ b/src/main/java/com/codesdream/ase/repository/activity/AttendanceRepository.java @@ -0,0 +1,9 @@ +package com.codesdream.ase.repository.activity; + +import com.codesdream.ase.model.activity.Attendance; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AttendanceRepository extends CrudRepository { +} diff --git a/src/main/java/com/codesdream/ase/repository/activity/PeriodRepository.java b/src/main/java/com/codesdream/ase/repository/activity/PeriodRepository.java new file mode 100644 index 0000000..24a45ad --- /dev/null +++ b/src/main/java/com/codesdream/ase/repository/activity/PeriodRepository.java @@ -0,0 +1,9 @@ +package com.codesdream.ase.repository.activity; + +import com.codesdream.ase.model.activity.Period; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface PeriodRepository extends CrudRepository { +} diff --git a/src/main/java/com/codesdream/ase/service/AttendanceService.java b/src/main/java/com/codesdream/ase/service/AttendanceService.java new file mode 100644 index 0000000..5484358 --- /dev/null +++ b/src/main/java/com/codesdream/ase/service/AttendanceService.java @@ -0,0 +1,18 @@ +package com.codesdream.ase.service; + +import com.codesdream.ase.model.activity.Attendance; +import com.codesdream.ase.repository.activity.AttendanceRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class AttendanceService { + + @Resource + AttendanceRepository attendanceRepository; + + public Attendance save(Attendance attendance) { + return attendanceRepository.save(attendance); + } +} diff --git a/src/main/java/com/codesdream/ase/service/PeriodService.java b/src/main/java/com/codesdream/ase/service/PeriodService.java new file mode 100644 index 0000000..879de10 --- /dev/null +++ b/src/main/java/com/codesdream/ase/service/PeriodService.java @@ -0,0 +1,22 @@ +package com.codesdream.ase.service; + +import com.codesdream.ase.model.activity.Period; +import com.codesdream.ase.repository.activity.PeriodRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class PeriodService { + + @Resource + PeriodRepository periodRepository; + + public Period save(Period period) { + return periodRepository.save(period); + } + + public void delete(Period period) { + periodRepository.delete(period); + } +} diff --git a/src/main/java/com/codesdream/ase/validator/ActivityValidator.java b/src/main/java/com/codesdream/ase/validator/ActivityValidator.java index 2d8b4bf..3f6488f 100644 --- a/src/main/java/com/codesdream/ase/validator/ActivityValidator.java +++ b/src/main/java/com/codesdream/ase/validator/ActivityValidator.java @@ -1,17 +1,20 @@ package com.codesdream.ase.validator; +import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.model.activity.Activity; import org.springframework.stereotype.Component; +import java.nio.file.OpenOption; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; //检查当前活动各属性值是否合法(存在) @Component public class ActivityValidator { - public String[] check(Map parameterMap){ + public String[] check(Optional json) { return null; } } diff --git a/src/main/java/com/codesdream/ase/validator/JSONFormValidator.java b/src/main/java/com/codesdream/ase/validator/JSONFormValidator.java new file mode 100644 index 0000000..79a3c83 --- /dev/null +++ b/src/main/java/com/codesdream/ase/validator/JSONFormValidator.java @@ -0,0 +1,30 @@ +package com.codesdream.ase.validator; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.codesdream.ase.exception.DataIllegalTableFormatException; +import org.springframework.stereotype.Component; + +import java.util.*; + +//用于检查JSON格式是否合法 +@Component +public class JSONFormValidator { + + /** + * @param stdForm 标准表单格式,根据需求自定义 + * @param json 待检验的json对象 + * @return 空列表或者缺失的表单信息列表 + */ + public List check(Set stdForm, JSONObject json) { + + List res = new ArrayList<>(); + Set jsonForm = json.keySet(); + for (String str : stdForm) { + if (!jsonForm.contains(str)) { + res.add(str); + } + } + return res; + } +} diff --git a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java b/src/main/java/com/codesdream/ase/validator/WebFormValidator.java deleted file mode 100644 index 6ffaac0..0000000 --- a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.codesdream.ase.validator; - -import org.springframework.stereotype.Component; - -import java.util.*; - -//用于检查网页表单格式是否合法 -@Component -public class WebFormValidator { - - public boolean check(Collection stdForm, Map webFormMap){ - - Collection webForm = webFormMap.keySet(); - if(webForm.containsAll(stdForm)){ - return true; - } - return false; - } -} diff --git a/src/test/java/com/codesdream/ase/test/JSONFormValidatorTest.java b/src/test/java/com/codesdream/ase/test/JSONFormValidatorTest.java new file mode 100644 index 0000000..11ef842 --- /dev/null +++ b/src/test/java/com/codesdream/ase/test/JSONFormValidatorTest.java @@ -0,0 +1,61 @@ +package com.codesdream.ase.test; + +import com.alibaba.fastjson.JSONObject; +import com.codesdream.ase.component.ASESpringUtil; +import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; +import com.codesdream.ase.configure.ActivityFormConfigure; +import com.codesdream.ase.exception.InvalidFormFormatException; +import com.codesdream.ase.validator.JSONFormValidator; +import com.fasterxml.jackson.databind.util.JSONPObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +@Slf4j +@RunWith(SpringRunner.class) +@SpringBootTest +@ActiveProfiles("test") +public class JSONFormValidatorTest { + @Resource + ASESpringUtil aseSpringUtil; + + @Test + public void checkTest() throws InvalidFormFormatException { + Map map = new HashMap() {{ + put("creator", "tom"); + put("title", "haha"); + put("description", "h"); + put("cycle", "h"); + put("volunteers", "tom"); + put("participate", "tom"); + put("sign", "s"); + put("visible", "s"); + put("start-time", "1"); + put("remind", "1"); + put("enclosure", "1"); + put("chief-manager", "tom"); + put("assist-manager", "1"); + put("attendance", "1"); + put("type", "h"); + put("attendance", "aa"); + put("inform", "aaa"); + }}; + JSONObject jsonObject = new JSONObject(); + jsonObject.putAll(map); + Optional json = Optional.of(jsonObject); + ActivityFormConfigure activityFormConfigure = aseSpringUtil.getBean(ActivityFormConfigure.class); + JSONFormValidator jsonFormValidator = aseSpringUtil.getBean(JSONFormValidator.class); + if (jsonFormValidator.check(activityFormConfigure.getStdActivityForm(), json.get()).isEmpty()) { + System.out.println("error"); + } else System.out.println("ok"); + } +} From 9a8459df6c01cfd7e198a7a56f667fa466d82363 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Mar 2020 02:01:24 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E7=AD=96=E7=95=A5;=E6=B7=BB=E5=8A=A0=E9=A2=84=E9=AA=8C?= =?UTF-8?q?=E8=AF=81;=E4=BF=AE=E6=AD=A3=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++ .../auth/ASEAuthenticationSuccessHandler.java | 1 + .../ASESecurityAuthenticationProvider.java | 21 +-- ...EUsernamePasswordAuthenticationFilter.java | 1 + .../auth/TimestampExpiredChecker.java | 6 + .../datamanager/QuickJSONRespond.java | 5 + .../json/respond/PermissionJSONRespond.java | 16 ++ .../respond/UserLoginCheckerJSONRespond.java | 1 + .../ase/controller/HomeController.java | 4 +- .../ase/controller/LoginController.java | 14 ++ .../ase/controller/PermissionContainer.java | 23 --- .../ase/controller/PermissionController.java | 143 ++++++++++++++++++ .../ase/model/auth/PreValidationCode.java | 20 +++ .../auth/PreValidationCodeRepository.java | 12 ++ .../ase/service/ASEUserDetailsService.java | 5 +- .../codesdream/ase/service/AuthService.java | 31 +++- .../codesdream/ase/service/IAuthService.java | 6 + .../ase/service/IPermissionService.java | 7 +- .../codesdream/ase/service/IUserService.java | 2 +- .../ase/service/PermissionService.java | 13 +- .../codesdream/ase/service/UserService.java | 4 +- .../codesdream/ase/test/AuthServiceTest.java | 28 ++++ .../com/codesdream/ase/test/UserTest.java | 11 +- 23 files changed, 338 insertions(+), 48 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/json/respond/PermissionJSONRespond.java delete mode 100644 src/main/java/com/codesdream/ase/controller/PermissionContainer.java create mode 100644 src/main/java/com/codesdream/ase/controller/PermissionController.java create mode 100644 src/main/java/com/codesdream/ase/model/auth/PreValidationCode.java create mode 100644 src/main/java/com/codesdream/ase/repository/auth/PreValidationCodeRepository.java create mode 100644 src/test/java/com/codesdream/ase/test/AuthServiceTest.java diff --git a/pom.xml b/pom.xml index 1307c09..575b3db 100644 --- a/pom.xml +++ b/pom.xml @@ -163,6 +163,18 @@ true + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + ${JAVA_HOME}/jre/lib/rt.jar + + + diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java index 2a44f39..fcd62e3 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java @@ -41,6 +41,7 @@ public class ASEAuthenticationSuccessHandler extends SavedRequestAwareAuthentica UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setUserExist(authentication.isAuthenticated()); respond.setLoginStatus(authentication.isAuthenticated()); + respond.setPvc(authService.preValidationCodeGetter()); // 获得 JSONTokenAuthenticationToken JSONTokenAuthenticationToken authenticationToken = (JSONTokenAuthenticationToken) authentication; diff --git a/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java index f347be8..fc70128 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java @@ -32,11 +32,11 @@ public class ASESecurityAuthenticationProvider implements AuthenticationProvider JSONTokenUsernamePasswordAuthenticationToken authenticationToken = (JSONTokenUsernamePasswordAuthenticationToken) authentication; - // 获得登录表单中的学号 + // 获得JSON中的学号 String username = usernameEncoder.encode((CharSequence) authenticationToken.getPrincipal()); - // 获得表单中的密码 - String password = passwordEncoder.encode((CharSequence) authenticationToken.getCredentials()); - // 获得 + // 获得JSON中的加密密码 + String encrypted_password = (String) authenticationToken.getCredentials(); + // 获得客户端代码 String clientCode = authenticationToken.getClientCode(); // 判断用户是否存在 UserDetails userInfo = userDetailsService.loadUserByUsername(username); @@ -45,20 +45,23 @@ public class ASESecurityAuthenticationProvider implements AuthenticationProvider throw new UsernameNotFoundException("User Not Exist"); } + String sha256_password = userInfo.getPassword(); + // 判断密码是否正确 - if (!userInfo.getPassword().equals(password)) { - throw new BadCredentialsException("Password IS Uncorrected"); + if(!passwordEncoder.encode(String.format( + "PASS_ENCODE [%s][%s]", sha256_password, clientCode)).equals(encrypted_password)){ + throw new BadCredentialsException("Password IS INCORRECT"); } // 判断账号是否停用/删除 if (!userInfo.isEnabled()) { throw new DisabledException("User IS Disabled"); } - else if(!userInfo.isAccountNonLocked()){ + else if(!userInfo.isAccountNonLocked()) { throw new LockedException("User IS Locked"); } - else if(!userInfo.isAccountNonExpired()){ - throw new AccountExpiredException("User IS Expired"); + else if(!userInfo.isAccountNonExpired()) { + throw new AccountExpiredException("User IS Expired"); } // 生成权限列表 diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java index 6cd03ad..3297622 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java @@ -63,6 +63,7 @@ public class ASEUsernamePasswordAuthenticationFilter extends UsernamePasswordAut // 获得相应的用户名密码 String username = checker.getUsername(); + // 得到加密密码 String password = checker.getPassword(); String clientCode = checker.getClientCode(); diff --git a/src/main/java/com/codesdream/ase/component/auth/TimestampExpiredChecker.java b/src/main/java/com/codesdream/ase/component/auth/TimestampExpiredChecker.java index 080bd20..667d801 100644 --- a/src/main/java/com/codesdream/ase/component/auth/TimestampExpiredChecker.java +++ b/src/main/java/com/codesdream/ase/component/auth/TimestampExpiredChecker.java @@ -15,4 +15,10 @@ public class TimestampExpiredChecker { return timestampDate.before(maxDate); } + public boolean checkDateBeforeMaxTime(Date date, int seconds){ + long currentTime = System.currentTimeMillis(); + Date maxDate = new Date(currentTime + seconds * 1000); + return date.before(maxDate); + } + } diff --git a/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java b/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java index ab2d6ab..0838a41 100644 --- a/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java +++ b/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java @@ -76,5 +76,10 @@ public class QuickJSONRespond { return getJSONStandardRespond(400, "Bad Request", info); } + // 获得标准的JSON响应字符串返回(400状态) + public String getRespond409(String info){ + return getJSONStandardRespond(409, "Conflict", info); + } + } diff --git a/src/main/java/com/codesdream/ase/component/json/respond/PermissionJSONRespond.java b/src/main/java/com/codesdream/ase/component/json/respond/PermissionJSONRespond.java new file mode 100644 index 0000000..915804a --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/respond/PermissionJSONRespond.java @@ -0,0 +1,16 @@ +package com.codesdream.ase.component.json.respond; + +import com.sun.org.apache.xpath.internal.operations.Bool; +import lombok.Data; + +import java.util.List; +import java.util.Set; + +@Data +public class PermissionJSONRespond { + private Boolean tagExist = null; + private Boolean actionSuccess = null; + private Integer tagId = null; + private String tagName = null; + private Set users = null; +} diff --git a/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java b/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java index 6cbaeed..e12c077 100644 --- a/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java +++ b/src/main/java/com/codesdream/ase/component/json/respond/UserLoginCheckerJSONRespond.java @@ -12,5 +12,6 @@ public class UserLoginCheckerJSONRespond { String respondInformation = null; String token = null; String uid = null; + String pvc = null; } diff --git a/src/main/java/com/codesdream/ase/controller/HomeController.java b/src/main/java/com/codesdream/ase/controller/HomeController.java index 0d73a79..1748b9c 100644 --- a/src/main/java/com/codesdream/ase/controller/HomeController.java +++ b/src/main/java/com/codesdream/ase/controller/HomeController.java @@ -17,7 +17,9 @@ public class HomeController { @RequestMapping(value = "/home") public String showHomeView(Model model, Principal principal){ - User user = userService.findUserByUsername(principal.getName()); + Optional userOptional = userService.findUserByUsername(principal.getName()); + if(!userOptional.isPresent()) return "error"; + User user = userOptional.get(); // 为视图模板指定参数 model.addAttribute("username", user.getUsername().substring(0, 18)); model.addAttribute("real_name", user.getUserDetail().getRealName()); diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index 0935d3c..36f7522 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -6,6 +6,7 @@ import com.codesdream.ase.component.datamanager.QuickJSONRespond; import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond; import com.codesdream.ase.component.json.request.UserLoginChecker; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; +import com.codesdream.ase.service.IAuthService; import com.codesdream.ase.service.IUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; @@ -35,6 +36,9 @@ public class LoginController { @Resource private IUserService userService; + @Resource + private IAuthService authService; + @RequestMapping(value = "/login") String printLogin(Model model) { @@ -73,12 +77,22 @@ public class LoginController { @RequestMapping(value = "/login/check_uid", method = RequestMethod.POST) @ResponseBody String checkUsernameByStudentID(HttpServletRequest request){ + + String preValidationCode = request.getHeader("pvc"); + + // 检查随机预验证码 + if(preValidationCode == null || !authService.preValidationCodeChecker(preValidationCode)) + return quickJSONRespond.getRespond403("Invalid PreValidationCode"); + // 检查是否为JSON Optional json = jsonParameter.getJSONByRequest(request); if(!json.isPresent()) return jsonParameter.getJSONString(new JSONStandardFailedRespond()); UserLoginChecker loginChecker = json.get().toJavaObject(UserLoginChecker.class); + if(loginChecker.getUsername() == null || loginChecker.getCheckType() == null) + return quickJSONRespond.getRespond406("Request Violates The Interface Protocol"); + if(loginChecker.getCheckType().equals("UIDGeneratorChecker")) { UserLoginCheckerJSONRespond respond = new UserLoginCheckerJSONRespond(); respond.setUid(userService.getUsernameByStudentId(loginChecker.getUsername())); diff --git a/src/main/java/com/codesdream/ase/controller/PermissionContainer.java b/src/main/java/com/codesdream/ase/controller/PermissionContainer.java deleted file mode 100644 index 92f447f..0000000 --- a/src/main/java/com/codesdream/ase/controller/PermissionContainer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.codesdream.ase.controller; - -import org.springframework.security.access.annotation.Secured; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; - -@RestController -@RequestMapping("pmt") -public class PermissionContainer { - - @Secured({"ROLE_ADMIN","ROLE_USER"}) - @PostMapping("tag") - public String createTag(HttpServletRequest request, Authentication authentication){ - return ""; - } - - -} diff --git a/src/main/java/com/codesdream/ase/controller/PermissionController.java b/src/main/java/com/codesdream/ase/controller/PermissionController.java new file mode 100644 index 0000000..358e3a2 --- /dev/null +++ b/src/main/java/com/codesdream/ase/controller/PermissionController.java @@ -0,0 +1,143 @@ +package com.codesdream.ase.controller; + +import com.alibaba.fastjson.JSONObject; +import com.codesdream.ase.component.datamanager.JSONParameter; +import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.json.respond.PermissionJSONRespond; +import com.codesdream.ase.model.permission.Tag; +import com.codesdream.ase.model.permission.User; +import com.codesdream.ase.service.IUserService; +import com.codesdream.ase.service.PermissionService; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; + +@RestController +@RequestMapping("pmt") +public class PermissionController { + + @Resource + private PermissionService permissionService; + + @Resource + private IUserService userService; + + @Resource + private JSONParameter jsonParameter; + + @Resource + private QuickJSONRespond jsonRespond; + + // 根据名字创建新的标签 + @PostMapping("tag/create") + public String createTag(HttpServletRequest request){ + Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); + if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); + JSONObject jsonObject = jsonObjectOptional.get(); + + String tagName = jsonObject.getString("name"); + if(tagName == null) return jsonRespond.getRespond406("Missing Tag Name"); + // 检查JSON是否合法 + Optional tagOptional = permissionService.findTag(tagName); + if(tagOptional.isPresent()) return jsonRespond.getRespond409("Tag Name Already Exist"); + + Tag newTag = permissionService.getDefaultTag(tagName); + newTag = permissionService.save(newTag); + + PermissionJSONRespond respond = new PermissionJSONRespond(); + respond.setActionSuccess(true); + respond.setTagId(newTag.getId()); + respond.setTagName(newTag.getName()); + + return jsonRespond.getRespond200(null, respond); + } + + + // 根据名字搜索标签的简要信息 + @PostMapping("tag/search") + public String checkTag(HttpServletRequest request){ + Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); + if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); + + JSONObject jsonObject = jsonObjectOptional.get(); + String tagName = jsonObject.getString("name"); + if(tagName == null) return jsonRespond.getRespond406("Problem With Tag Name"); + Optional tagOptional = permissionService.findTag(tagName); + + PermissionJSONRespond respond = new PermissionJSONRespond(); + respond.setActionSuccess(true); + + if(tagOptional.isPresent()){ + respond.setTagExist(true); + respond.setTagId(tagOptional.get().getId()); + respond.setTagName(tagOptional.get().getName()); + } + else respond.setTagExist(false); + + return jsonRespond.getRespond200(null, respond); + } + + // 由标签ID找到用户ID列表 + @PostMapping("tag/get/users") + public String getUsersTag(HttpServletRequest request){ + Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); + if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); + + JSONObject jsonObject = jsonObjectOptional.get(); + Integer tagId = jsonObject.getInteger("id"); + if(tagId == null) return jsonRespond.getRespond406("Problem With Tag ID"); + Optional tagOptional = permissionService.findTag(tagId); + + PermissionJSONRespond respond = new PermissionJSONRespond(); + respond.setActionSuccess(true); + + if(tagOptional.isPresent()){ + respond.setTagExist(true); + respond.setTagId(tagOptional.get().getId()); + Set userIds = new HashSet<>(); + for(User user : permissionService.getUsersFromTag(tagOptional.get())) { + userIds.add(user.getId()); + } + respond.setUsers(userIds); + } + else respond.setTagExist(false); + + return jsonRespond.getRespond200(null, respond); + } + + // 将用户添加到Tag中 + @PostMapping("tag/add/user") + public String addUserTag(HttpServletRequest request){ + Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); + if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); + + JSONObject jsonObject = jsonObjectOptional.get(); + Integer tagId = jsonObject.getInteger("tagId"); + Integer userId = jsonObject.getInteger("userId"); + + if(userId == null || tagId == null) + return jsonRespond.getRespond406("Request Violates The Interface Protocol"); + + Optional user = userService.findUserById(userId); + if(!user.isPresent()) return jsonRespond.getRespond406("User Not Exist"); + + Optional tag = permissionService.findTag(tagId); + if(!tag.isPresent()) return jsonRespond.getRespond406("Tag Not Exist"); + + // 检查用户是否已经在标签中 + if(tag.get().getUsers().contains(user.get())) return jsonRespond.getRespond409("User Already In The Tag"); + permissionService.addUserToTag(tag.get(), user.get()); + + return jsonRespond.getRespond200("Add User TO Tag Successful"); + } + + + +} diff --git a/src/main/java/com/codesdream/ase/model/auth/PreValidationCode.java b/src/main/java/com/codesdream/ase/model/auth/PreValidationCode.java new file mode 100644 index 0000000..41c9f3b --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/auth/PreValidationCode.java @@ -0,0 +1,20 @@ +package com.codesdream.ase.model.auth; + +import lombok.Data; + +import javax.persistence.*; +import java.util.Date; + +@Data +@Entity +@Table(name = "pre_validation_code") +public class PreValidationCode { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + private String value; + + private Date date = new Date(); + +} diff --git a/src/main/java/com/codesdream/ase/repository/auth/PreValidationCodeRepository.java b/src/main/java/com/codesdream/ase/repository/auth/PreValidationCodeRepository.java new file mode 100644 index 0000000..8b1d389 --- /dev/null +++ b/src/main/java/com/codesdream/ase/repository/auth/PreValidationCodeRepository.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.repository.auth; + +import com.codesdream.ase.model.auth.PreValidationCode; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface PreValidationCodeRepository extends CrudRepository { + Optional findByValue(String value); +} diff --git a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java index 2d9a666..7778168 100644 --- a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java +++ b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.transaction.Transactional; +import java.util.Optional; @Service public class ASEUserDetailsService implements UserDetailsService { @@ -25,7 +26,9 @@ public class ASEUserDetailsService implements UserDetailsService { @Transactional public UserDetails loadUserByUsername(String s) { try { - User user = userService.findUserByUsername(s); + Optional userOptional = userService.findUserByUsername(s); + if(!userOptional.isPresent()) throw new UserNotFoundException(s); + User user = userOptional.get(); user.setAuthorities(userAuthoritiesGenerator.grantedAuthorities(user)); return user; } catch (UserNotFoundException e){ diff --git a/src/main/java/com/codesdream/ase/service/AuthService.java b/src/main/java/com/codesdream/ase/service/AuthService.java index 1784365..85891f7 100644 --- a/src/main/java/com/codesdream/ase/service/AuthService.java +++ b/src/main/java/com/codesdream/ase/service/AuthService.java @@ -1,16 +1,19 @@ package com.codesdream.ase.service; import com.codesdream.ase.component.auth.AuthTokenGenerator; +import com.codesdream.ase.component.auth.TimestampExpiredChecker; import com.codesdream.ase.model.auth.JSONToken; +import com.codesdream.ase.model.auth.PreValidationCode; import com.codesdream.ase.model.permission.User; import com.codesdream.ase.repository.auth.JSONTokenRepository; -import com.sun.org.apache.xpath.internal.operations.Bool; +import com.codesdream.ase.repository.auth.PreValidationCodeRepository; import javafx.util.Pair; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.Optional; +import java.util.UUID; // 认证服务 @Service @@ -25,6 +28,12 @@ public class AuthService implements IAuthService { @Resource private AuthTokenGenerator authTokenGenerator; + @Resource + private PreValidationCodeRepository preValidationCodeRepository; + + @Resource + private TimestampExpiredChecker timestampExpiredChecker; + @Override public Optional findTokenByUserName(String username) { return jsonTokenRepository.findByUsername(username); @@ -60,4 +69,24 @@ public class AuthService implements IAuthService { } else return Optional.empty(); } + + @Override + public String preValidationCodeGetter() { + PreValidationCode preValidationCode = new + PreValidationCode(); + preValidationCode.setValue(UUID.randomUUID().toString()); + preValidationCode = preValidationCodeRepository.save(preValidationCode); + return preValidationCode.getValue(); + } + + @Override + public boolean preValidationCodeChecker(String pvc) { + Optional preValidationCode = + preValidationCodeRepository.findByValue(pvc); + if(preValidationCode.filter(validationCode -> timestampExpiredChecker.checkDateBeforeMaxTime(validationCode.getDate(), 60)).isPresent()){ + preValidationCodeRepository.delete(preValidationCode.get()); + return true; + } + else return false; + } } diff --git a/src/main/java/com/codesdream/ase/service/IAuthService.java b/src/main/java/com/codesdream/ase/service/IAuthService.java index fc4eae0..0adae64 100644 --- a/src/main/java/com/codesdream/ase/service/IAuthService.java +++ b/src/main/java/com/codesdream/ase/service/IAuthService.java @@ -13,4 +13,10 @@ public interface IAuthService { // 为用户获得一个新的API Token Optional userNewTokenGetter(String username, String clientCode); + + // 获得一个新的预验证码 + String preValidationCodeGetter(); + + // 检验预验证码 + boolean preValidationCodeChecker(String pvc); } diff --git a/src/main/java/com/codesdream/ase/service/IPermissionService.java b/src/main/java/com/codesdream/ase/service/IPermissionService.java index f4a8b1a..fc1cb70 100644 --- a/src/main/java/com/codesdream/ase/service/IPermissionService.java +++ b/src/main/java/com/codesdream/ase/service/IPermissionService.java @@ -5,6 +5,7 @@ import javafx.util.Pair; import java.util.Collection; import java.util.Optional; +import java.util.Set; public interface IPermissionService { @@ -19,6 +20,9 @@ public interface IPermissionService { // 查找用户标签 Optional findTag(String name); + // 查找用户标签 + Optional findTag(Integer id); + // 查找功能性权限容器 Optional findFPC(String name); @@ -41,12 +45,13 @@ public interface IPermissionService { // 查找用户下的所有标签列表 Collection getTagsFromUser(User user); + // 查找功能性权限容器下的所有范围性权限容器列表 Collection getFPCs( PermissionContainersCollection pcc); // 查找标签下的所有用户 - Collection getUsersFromTag(Tag tag); + Set getUsersFromTag(Tag tag); // 指定一对功能性权限容器与对应的范围性权限容器并添加到指定权限容器集合中 PermissionContainersCollection addRelationItemToPCC( diff --git a/src/main/java/com/codesdream/ase/service/IUserService.java b/src/main/java/com/codesdream/ase/service/IUserService.java index ad3a01e..fbd20db 100644 --- a/src/main/java/com/codesdream/ase/service/IUserService.java +++ b/src/main/java/com/codesdream/ase/service/IUserService.java @@ -22,7 +22,7 @@ public interface IUserService { Optional findUserById(int id); - User findUserByUsername(String username); + Optional findUserByUsername(String username); // 查询用户是否存在 public Pair checkIfUserExists(String username); diff --git a/src/main/java/com/codesdream/ase/service/PermissionService.java b/src/main/java/com/codesdream/ase/service/PermissionService.java index a810e5f..73ad410 100644 --- a/src/main/java/com/codesdream/ase/service/PermissionService.java +++ b/src/main/java/com/codesdream/ase/service/PermissionService.java @@ -12,9 +12,7 @@ import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Optional; +import java.util.*; @Service public class PermissionService implements IPermissionService { @@ -65,6 +63,11 @@ public class PermissionService implements IPermissionService { return tagRepository.findByName(name); } + @Override + public Optional findTag(Integer id) { + return tagRepository.findById(id); + } + @Override public Optional findFPC(String name) { return fpcRepository.findByName(name); @@ -117,8 +120,8 @@ public class PermissionService implements IPermissionService { } @Override - public Collection getUsersFromTag(Tag tag) { - return new ArrayList<>(tag.getUsers()); + public Set getUsersFromTag(Tag tag) { + return new HashSet<>(tag.getUsers()); } @Override diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index 9fe7045..faae155 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -45,10 +45,10 @@ public class UserService implements IUserService { } @Override - public User findUserByUsername(String username) { + public Optional findUserByUsername(String username) { Optional user = userRepository.findByUsername(username); if(!user.isPresent()) throw new UsernameNotFoundException(username); - return user.get(); + return user; } @Override diff --git a/src/test/java/com/codesdream/ase/test/AuthServiceTest.java b/src/test/java/com/codesdream/ase/test/AuthServiceTest.java new file mode 100644 index 0000000..ba50288 --- /dev/null +++ b/src/test/java/com/codesdream/ase/test/AuthServiceTest.java @@ -0,0 +1,28 @@ +package com.codesdream.ase.test; + +import com.codesdream.ase.service.AuthService; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +@RunWith(SpringRunner.class) +@SpringBootTest +@ActiveProfiles("test") +public class AuthServiceTest { + + @Resource + private AuthService authService; + + // 测试随机验证码 + @Test + public void preValidationCodeCheckerTest(){ + String authStr = authService.preValidationCodeGetter(); + + Assert.assertTrue(authService.preValidationCodeChecker(authStr)); + } +} diff --git a/src/test/java/com/codesdream/ase/test/UserTest.java b/src/test/java/com/codesdream/ase/test/UserTest.java index 9274f19..4cab429 100644 --- a/src/test/java/com/codesdream/ase/test/UserTest.java +++ b/src/test/java/com/codesdream/ase/test/UserTest.java @@ -45,7 +45,10 @@ public class UserTest { user.getUserDetail().setRealName("提姆"); userService.save(user); - user = userService.findUserByUsername("Tim"); + Optional userOptional = userService.findUserByUsername("Tim"); + + assertTrue(userOptional.isPresent()); + user = userOptional.get(); assertEquals(user.getUsername(), "Tim"); assertEquals(user.getPassword(), @@ -65,9 +68,9 @@ public class UserTest { @Test public void UserBaseTest_2(){ - User user = userService.findUserByUsername("Tim"); - - assertNotNull(user); + Optional userOptional = userService.findUserByUsername("Tim"); + assertTrue(userOptional.isPresent()); + User user = userOptional.get(); user.setEnabled(false); user.getUserAuth().setMail("saturneric@163.com"); From 3181288755ebf533f5a20f97751bc8e7832980ab Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Mar 2020 02:07:09 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=AD=90=E7=B3=BB=E7=BB=9F=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/activity/ActivityConverter.java | 28 +++++++++---------- .../exception/DataInvalidFormatException.java | 4 +++ .../codesdream/ase/model/activity/Period.java | 4 +++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java index e3f0d18..67c90b9 100644 --- a/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java +++ b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java @@ -44,14 +44,14 @@ public class ActivityConverter { JSONObject jsonObject = json.get(); String username = (String) jsonObject.get("creator"); - User creator = userService.findUserByUsername(username); - activity.setCreator(creator); + Optional creator = userService.findUserByUsername(username); + activity.setCreator(creator.get()); List participateGroupFromJson = (List) jsonObject.get("participate-group"); Set participateGroup = new HashSet<>(); for (String name : participateGroupFromJson) { - User user = userService.findUserByUsername(name); - participateGroup.add(user); + Optional user = userService.findUserByUsername(name); + participateGroup.add(user.get()); } activity.setParticipateGroup(participateGroup); @@ -59,14 +59,14 @@ public class ActivityConverter { activity.setTitle(title); String chiefManagerName = (String) jsonObject.get("chief-manager"); - User chiefManager = userService.findUserByUsername(chiefManagerName); - activity.setChiefManager(chiefManager); + Optional chiefManager = userService.findUserByUsername(chiefManagerName); + activity.setChiefManager(chiefManager.get()); List assistManagerFromJSON = (List) jsonObject.get("assist-manager"); Set assistManager = new HashSet<>(); for (String name : assistManagerFromJSON) { - User user = userService.findUserByUsername(name); - assistManager.add(user); + Optional user = userService.findUserByUsername(name); + assistManager.add(user.get()); } activity.setAssistManagers(assistManager); @@ -91,24 +91,24 @@ public class ActivityConverter { List signGroupFromJSON = (List) jsonObject.get("sign-group"); Set signGroup = new HashSet<>(); for (String name : signGroupFromJSON) { - User user = userService.findUserByUsername(name); - signGroup.add(user); + Optional user = userService.findUserByUsername(name); + signGroup.add(user.get()); } activity.setSignGroup(signGroup); List informGroupFromJSON = (List) jsonObject.get("inform-group"); Set informGroup = new HashSet<>(); for (String name : informGroupFromJSON) { - User user = userService.findUserByUsername(name); - informGroup.add(user); + Optional user = userService.findUserByUsername(name); + informGroup.add(user.get()); } activity.setInformGroup(informGroup); List visibleGroupFromJSON = (List) jsonObject.get("visible-group"); Set visibleGroup = new HashSet<>(); for (String name : visibleGroupFromJSON) { - User user = userService.findUserByUsername(name); - visibleGroup.add(user); + Optional user = userService.findUserByUsername(name); + visibleGroup.add(user.get()); } activity.setVisibleGroup(informGroup); diff --git a/src/main/java/com/codesdream/ase/exception/DataInvalidFormatException.java b/src/main/java/com/codesdream/ase/exception/DataInvalidFormatException.java index e06394f..b5d4de5 100644 --- a/src/main/java/com/codesdream/ase/exception/DataInvalidFormatException.java +++ b/src/main/java/com/codesdream/ase/exception/DataInvalidFormatException.java @@ -12,4 +12,8 @@ public class DataInvalidFormatException extends RuntimeException { super(); information = e.getMessage(); } + + public DataInvalidFormatException(){ + super(); + } } diff --git a/src/main/java/com/codesdream/ase/model/activity/Period.java b/src/main/java/com/codesdream/ase/model/activity/Period.java index 8064ffc..ae359f7 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Period.java +++ b/src/main/java/com/codesdream/ase/model/activity/Period.java @@ -34,4 +34,8 @@ public class Period { this.endTime = endTime; } + public Period(){ + + } + } From 4b7411f562a37b4fec8f905c6e35c9e2340de475 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Mar 2020 02:22:11 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E8=BF=90=E8=A1=8C=E7=AB=AF=E5=8F=A3=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E4=B8=8E=E5=85=B6=E4=BB=96=E5=BA=94=E7=94=A8=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/codesdream/ase/model/activity/Period.java | 2 +- src/main/resources/application-test.properties | 2 +- src/main/resources/application.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/codesdream/ase/model/activity/Period.java b/src/main/java/com/codesdream/ase/model/activity/Period.java index ae359f7..3e39829 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Period.java +++ b/src/main/java/com/codesdream/ase/model/activity/Period.java @@ -35,7 +35,7 @@ public class Period { } public Period(){ - + } } diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index aa149bd..7ff0096 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,4 +1,4 @@ -server.port=8080 +server.port=80 spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.suffix=.html diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0a91e8b..102108f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=8080 +server.port=80 spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.suffix=.html From e8d91a402261ef518a1b315f51496e827d706f4f Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Mar 2020 02:40:38 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E7=94=B1=E4=BA=8E=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E8=BF=90=E8=A1=8C=E7=AB=AF=E5=8F=A3=E4=B8=BA8081?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-test.properties | 2 +- src/main/resources/application.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index 7ff0096..c9dc072 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,4 +1,4 @@ -server.port=80 +server.port=8081 spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.suffix=.html diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 102108f..258e642 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=80 +server.port=8081 spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.suffix=.html From f4d00f349f87b25b6d878cdd45bb593d1957c588 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Mar 2020 15:51:06 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Swagger;=E5=BC=95?= =?UTF-8?q?=E5=85=A5Restful=20API=E6=A0=87=E5=87=86;Exception=E5=BD=92?= =?UTF-8?q?=E7=B1=BB;=E9=94=99=E8=AF=AF=E7=AE=A1=E7=90=86=E5=AD=90?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=AE=8C=E5=96=84;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 22 ++++- .../QuickJSONRespond.java | 13 ++- .../auth/ASEAccessDeniedHandler.java | 4 +- .../auth/ASEAuthenticationEntryPoint.java | 6 +- .../auth/ASEAuthenticationFailureHandler.java | 5 +- .../auth/ASEAuthenticationSuccessHandler.java | 5 +- .../datamanager/DataExcelGenerator.java | 2 +- .../datamanager/DataExcelReader.java | 1 + .../ase/component/json/model/JsonableTag.java | 41 ++++++++ .../json/model/JsonableUidGetter.java | 6 ++ .../ase/configure/ASESwaggerConfigure.java | 57 +++++++++++ .../configure/CustomWebSecurityConfig.java | 8 +- .../ase/controller/ASEControllerAdvice.java | 32 ++++++- .../ase/controller/ASEErrorController.java | 12 +-- .../ase/controller/LoginController.java | 13 +-- .../ase/controller/PermissionController.java | 94 +++++-------------- .../ase/controller/RegisterController.java | 2 +- .../exception/DataFileNotFoundException.java | 15 --- .../notfound/DataFileNotFoundException.java | 15 +++ .../exception/notfound/NotFoundException.java | 12 +++ .../notfound/TagNotFoundException.java | 11 +++ .../{ => notfound}/UserNotFoundException.java | 10 +- .../ase/service/ASEUserDetailsService.java | 3 +- .../codesdream/ase/service/UserService.java | 2 +- src/main/resources/application-dev.properties | 23 +++++ 25 files changed, 275 insertions(+), 139 deletions(-) rename src/main/java/com/codesdream/ase/component/{datamanager => api}/QuickJSONRespond.java (85%) create mode 100644 src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java create mode 100644 src/main/java/com/codesdream/ase/component/json/model/JsonableUidGetter.java create mode 100644 src/main/java/com/codesdream/ase/configure/ASESwaggerConfigure.java delete mode 100644 src/main/java/com/codesdream/ase/exception/DataFileNotFoundException.java create mode 100644 src/main/java/com/codesdream/ase/exception/notfound/DataFileNotFoundException.java create mode 100644 src/main/java/com/codesdream/ase/exception/notfound/NotFoundException.java create mode 100644 src/main/java/com/codesdream/ase/exception/notfound/TagNotFoundException.java rename src/main/java/com/codesdream/ase/exception/{ => notfound}/UserNotFoundException.java (56%) create mode 100644 src/main/resources/application-dev.properties diff --git a/pom.xml b/pom.xml index 53a9200..900747a 100644 --- a/pom.xml +++ b/pom.xml @@ -139,11 +139,12 @@ - org.mariadb.jdbc - mariadb-java-client - 2.5.4 - + org.mariadb.jdbc + mariadb-java-client + 2.5.4 + + com.h2database h2 @@ -163,6 +164,19 @@ 3.2.0 + + + io.springfox + springfox-swagger2 + 2.9.2 + + + + io.springfox + springfox-swagger-ui + 2.9.2 + + diff --git a/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java b/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java similarity index 85% rename from src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java rename to src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java index 0838a41..dfe654d 100644 --- a/src/main/java/com/codesdream/ase/component/datamanager/QuickJSONRespond.java +++ b/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java @@ -1,5 +1,6 @@ -package com.codesdream.ase.component.datamanager; +package com.codesdream.ase.component.api; +import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.json.respond.EmptyDataObjectRespond; import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; import org.springframework.stereotype.Component; @@ -36,6 +37,11 @@ public class QuickJSONRespond { return getJSONStandardRespond(404, "Not Found", info); } + // 获得标准的JSON响应字符串返回(404状态) + public String getRespond404(String info, Object object){ + return getJSONStandardRespond(404, "Not Found", info, object); + } + // 获得标准的JSON响应字符串返回(500状态) public String getRespond500(String info){ return getJSONStandardRespond(500, "Internal Server Error", info); @@ -76,6 +82,11 @@ public class QuickJSONRespond { return getJSONStandardRespond(400, "Bad Request", info); } + // 获得标准的JSON响应字符串返回(404状态) + public String getRespond400(String info, Object object){ + return getJSONStandardRespond(400, "Bad Request", info, object); + } + // 获得标准的JSON响应字符串返回(400状态) public String getRespond409(String info){ return getJSONStandardRespond(409, "Conflict", info); diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java index 3ab64a1..0c3350e 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java @@ -1,8 +1,6 @@ package com.codesdream.ase.component.auth; -import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; -import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.web.access.AccessDeniedHandler; diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java index a72840e..296cc2b 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java @@ -1,16 +1,12 @@ package com.codesdream.ase.component.auth; -import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; -import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; -import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java index b3a9dae..d90a784 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java @@ -1,16 +1,13 @@ package com.codesdream.ase.component.auth; -import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; -import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java index fcd62e3..f73d445 100644 --- a/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java +++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java @@ -1,8 +1,6 @@ package com.codesdream.ase.component.auth; -import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken; -import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import com.codesdream.ase.model.permission.User; @@ -19,7 +17,6 @@ import javax.annotation.Resource; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.Optional; diff --git a/src/main/java/com/codesdream/ase/component/datamanager/DataExcelGenerator.java b/src/main/java/com/codesdream/ase/component/datamanager/DataExcelGenerator.java index 1ca17b2..83c1948 100644 --- a/src/main/java/com/codesdream/ase/component/datamanager/DataExcelGenerator.java +++ b/src/main/java/com/codesdream/ase/component/datamanager/DataExcelGenerator.java @@ -1,6 +1,6 @@ package com.codesdream.ase.component.datamanager; -import com.codesdream.ase.exception.DataFileNotFoundException; +import com.codesdream.ase.exception.notfound.DataFileNotFoundException; import com.codesdream.ase.exception.DataIOException; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; diff --git a/src/main/java/com/codesdream/ase/component/datamanager/DataExcelReader.java b/src/main/java/com/codesdream/ase/component/datamanager/DataExcelReader.java index ae2e2e6..f5471f2 100644 --- a/src/main/java/com/codesdream/ase/component/datamanager/DataExcelReader.java +++ b/src/main/java/com/codesdream/ase/component/datamanager/DataExcelReader.java @@ -2,6 +2,7 @@ package com.codesdream.ase.component.datamanager; import com.codesdream.ase.exception.*; +import com.codesdream.ase.exception.notfound.DataFileNotFoundException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.*; diff --git a/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java b/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java new file mode 100644 index 0000000..b5397cd --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java @@ -0,0 +1,41 @@ +package com.codesdream.ase.component.json.model; + +import com.codesdream.ase.model.permission.Tag; +import com.codesdream.ase.model.permission.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import net.bytebuddy.implementation.bind.annotation.DefaultMethod; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Data +@ApiModel("标签") +public class JsonableTag { + @ApiModelProperty(value = "标签id") + private Integer id = null; + @ApiModelProperty(value = "标签名", example = "系统管理员") + private String name; + @ApiModelProperty(value = "标签说明", example = "该系统的管理员") + private String description; + @ApiModelProperty(value = "用户列表", hidden = true) + private Set users = new HashSet<>(); + + public JsonableTag(){ + + } + + public JsonableTag(Tag tag){ + this.id = tag.getId(); + this.name = tag.getName(); + this.description = tag.getDescription(); + // 构建用户的ID列表 + for(User user : tag.getUsers()) { + users.add(user.getId()); + } + } + +} diff --git a/src/main/java/com/codesdream/ase/component/json/model/JsonableUidGetter.java b/src/main/java/com/codesdream/ase/component/json/model/JsonableUidGetter.java new file mode 100644 index 0000000..9eee677 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/model/JsonableUidGetter.java @@ -0,0 +1,6 @@ +package com.codesdream.ase.component.json.model; + +public class JsonableUidGetter { + private String checkType; + private String username; +} diff --git a/src/main/java/com/codesdream/ase/configure/ASESwaggerConfigure.java b/src/main/java/com/codesdream/ase/configure/ASESwaggerConfigure.java new file mode 100644 index 0000000..1e2061e --- /dev/null +++ b/src/main/java/com/codesdream/ase/configure/ASESwaggerConfigure.java @@ -0,0 +1,57 @@ +package com.codesdream.ase.configure; + +import com.google.common.collect.Sets; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.parameters.P; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Configuration +@EnableSwagger2 +public class ASESwaggerConfigure { + @Bean + public Docket createRestApi() { + + List pars = new ArrayList(); + + pars.add(new ParameterBuilder().name("username").description("真实用户名").hidden(true).order(1) + .modelRef(new ModelRef("string")).parameterType("header") + .required(false).defaultValue("u_id_88883b9e023c8824310760d8bb8b6542e5a3f16a0d67253214e01ee7ab0e96a1").build()); + pars.add(new ParameterBuilder().name("signed").description("客户端签名").hidden(true).order(2) + .modelRef(new ModelRef("string")).parameterType("header") + .required(false).defaultValue("6d4923fca4dcb51f67b85e54a23a8d763d9e02af").build()); + pars.add(new ParameterBuilder().name("timestamp").description("时间戳").hidden(true).order(3) + .modelRef(new ModelRef("string")).parameterType("header") + .required(false).defaultValue(Long.toString(new Date().getTime())).build()); + + return new Docket(DocumentationType.SWAGGER_2) + .protocols(Sets.newHashSet("http")) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.codesdream.ase.controller")) + .paths(PathSelectors.any()) + .build() + .globalOperationParameters(pars); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("全员育人管理系统后端接口定义") + .version("0.0.1") + .description("用于对后端接口进行说明") + .build(); + } +} diff --git a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java index 96d414a..b2d3413 100644 --- a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java +++ b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java @@ -87,7 +87,13 @@ public class CustomWebSecurityConfig extends WebSecurityConfigurerAdapter { "/forget/**", "/not_found/**", "/error/**", - "/login/**"); + "/login/**", + "/swagger-ui.html", + "/webjars/**", + "/swagger-resources/**", + "/v2/api-docs", + "/configuration/ui", + "/configuration/security"); } //注册自定义的UsernamePasswordAuthenticationFilter diff --git a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java index 332f5ba..755d930 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java +++ b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java @@ -1,7 +1,11 @@ package com.codesdream.ase.controller; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.error.ErrorResponse; import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; +import com.codesdream.ase.exception.notfound.NotFoundException; +import com.sun.xml.bind.v2.model.annotation.Quick; +import org.apache.poi.openxml4j.opc.internal.ContentType; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AuthenticationServiceException; @@ -11,21 +15,39 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.context.request.WebRequest; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.Date; import java.util.List; @RestControllerAdvice public class ASEControllerAdvice { - @ExceptionHandler(value = {RuntimeException.class}) - public final Object handleRuntimeException(RuntimeException e, WebRequest webRequest){ + + @Resource + private QuickJSONRespond quickJSONRespond; + + @ExceptionHandler(value = {NullPointerException.class}) + public ResponseEntity handleBadRequest(Exception ex) { + + String json = quickJSONRespond.getRespond400(null, getJSONRespondObject(ex)); + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(json); + } + + @ExceptionHandler(value = {NotFoundException.class}) + public ResponseEntity handleNotFound(Exception ex) { + String json = quickJSONRespond.getRespond404(null, getJSONRespondObject(ex)); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(json); + } + + private Object getJSONRespondObject(Exception ex){ ErrorInfoJSONRespond errorInfoJSONRespond = new ErrorInfoJSONRespond(); + errorInfoJSONRespond.setException(ex.getClass().getName()); + errorInfoJSONRespond.setExceptionMessage(ex.getMessage()); errorInfoJSONRespond.setDate(new Date()); - errorInfoJSONRespond.setExceptionMessage(e.getMessage()); - errorInfoJSONRespond.setException(e.getClass().getName()); return errorInfoJSONRespond; } - } diff --git a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java index ab33dc1..23d166d 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java +++ b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java @@ -1,24 +1,16 @@ package com.codesdream.ase.controller; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; -import com.codesdream.ase.component.error.ErrorResponse; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.context.request.WebRequest; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; import java.util.Date; -import java.util.List; @Controller public class ASEErrorController implements ErrorController { @@ -80,7 +72,7 @@ public class ASEErrorController implements ErrorController { return quickJSONRespond.getJSONStandardRespond( statusCode, - "Error Controller Handle", + "Internal Server Error", null, errorInfoJSONRespond); } diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java index 36f7522..fc3a5ce 100644 --- a/src/main/java/com/codesdream/ase/controller/LoginController.java +++ b/src/main/java/com/codesdream/ase/controller/LoginController.java @@ -2,15 +2,17 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond; import com.codesdream.ase.component.json.request.UserLoginChecker; import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond; import com.codesdream.ase.service.IAuthService; import com.codesdream.ase.service.IUserService; +import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -25,6 +27,7 @@ import java.util.Optional; */ @Slf4j @Controller +@Api(tags = "用户登录有关接口") public class LoginController { @Resource @@ -39,13 +42,7 @@ public class LoginController { @Resource private IAuthService authService; - - @RequestMapping(value = "/login") - String printLogin(Model model) { - return "login"; - } - - @RequestMapping(value = "/login/check_exists", method = RequestMethod.POST) + @PostMapping(value = "/login/check_exists") @ResponseBody String checkExists(HttpServletRequest request){ diff --git a/src/main/java/com/codesdream/ase/controller/PermissionController.java b/src/main/java/com/codesdream/ase/controller/PermissionController.java index 358e3a2..d702bee 100644 --- a/src/main/java/com/codesdream/ase/controller/PermissionController.java +++ b/src/main/java/com/codesdream/ase/controller/PermissionController.java @@ -2,16 +2,19 @@ package com.codesdream.ase.controller; import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; +import com.codesdream.ase.component.json.model.JsonableTag; import com.codesdream.ase.component.json.respond.PermissionJSONRespond; +import com.codesdream.ase.exception.notfound.TagNotFoundException; import com.codesdream.ase.model.permission.Tag; import com.codesdream.ase.model.permission.User; import com.codesdream.ase.service.IUserService; import com.codesdream.ase.service.PermissionService; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -21,6 +24,7 @@ import java.util.Set; @RestController @RequestMapping("pmt") +@Api(tags = "权限管理接口") public class PermissionController { @Resource @@ -36,80 +40,34 @@ public class PermissionController { private QuickJSONRespond jsonRespond; // 根据名字创建新的标签 - @PostMapping("tag/create") - public String createTag(HttpServletRequest request){ - Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); - if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); - JSONObject jsonObject = jsonObjectOptional.get(); + @PostMapping("tag") + @ApiOperation(value = "创建新的标签", notes = "创建标签时其ID自动分配,指定ID无效") + public JsonableTag createTag(@RequestBody JsonableTag tag){ + + String tagName = tag.getName(); +/* if(tagName == null) return jsonRespond.getRespond406("Missing Tag Name");*/ - String tagName = jsonObject.getString("name"); - if(tagName == null) return jsonRespond.getRespond406("Missing Tag Name"); - // 检查JSON是否合法 Optional tagOptional = permissionService.findTag(tagName); - if(tagOptional.isPresent()) return jsonRespond.getRespond409("Tag Name Already Exist"); +/* if(tagOptional.isPresent()) return jsonRespond.getRespond409("Tag Name Already Exist");*/ Tag newTag = permissionService.getDefaultTag(tagName); - newTag = permissionService.save(newTag); - - PermissionJSONRespond respond = new PermissionJSONRespond(); - respond.setActionSuccess(true); - respond.setTagId(newTag.getId()); - respond.setTagName(newTag.getName()); - - return jsonRespond.getRespond200(null, respond); + if(tag.getDescription() != null) { + newTag.setDescription(tag.getDescription()); + } + return new JsonableTag(permissionService.save(newTag)); } // 根据名字搜索标签的简要信息 - @PostMapping("tag/search") - public String checkTag(HttpServletRequest request){ - Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); - if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); - - JSONObject jsonObject = jsonObjectOptional.get(); - String tagName = jsonObject.getString("name"); - if(tagName == null) return jsonRespond.getRespond406("Problem With Tag Name"); - Optional tagOptional = permissionService.findTag(tagName); - - PermissionJSONRespond respond = new PermissionJSONRespond(); - respond.setActionSuccess(true); - + @GetMapping("tag") + @ApiOperation("搜索标签信息") + @ApiImplicitParam(name = "name", value = "标签名") + public JsonableTag checkTag(@RequestParam(value = "name") String name){ + Optional tagOptional = permissionService.findTag(name); if(tagOptional.isPresent()){ - respond.setTagExist(true); - respond.setTagId(tagOptional.get().getId()); - respond.setTagName(tagOptional.get().getName()); + return new JsonableTag(tagOptional.get()); } - else respond.setTagExist(false); - - return jsonRespond.getRespond200(null, respond); - } - - // 由标签ID找到用户ID列表 - @PostMapping("tag/get/users") - public String getUsersTag(HttpServletRequest request){ - Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); - if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); - - JSONObject jsonObject = jsonObjectOptional.get(); - Integer tagId = jsonObject.getInteger("id"); - if(tagId == null) return jsonRespond.getRespond406("Problem With Tag ID"); - Optional tagOptional = permissionService.findTag(tagId); - - PermissionJSONRespond respond = new PermissionJSONRespond(); - respond.setActionSuccess(true); - - if(tagOptional.isPresent()){ - respond.setTagExist(true); - respond.setTagId(tagOptional.get().getId()); - Set userIds = new HashSet<>(); - for(User user : permissionService.getUsersFromTag(tagOptional.get())) { - userIds.add(user.getId()); - } - respond.setUsers(userIds); - } - else respond.setTagExist(false); - - return jsonRespond.getRespond200(null, respond); + else throw new TagNotFoundException(name); } // 将用户添加到Tag中 diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index 88b4827..0908a34 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -1,7 +1,7 @@ package com.codesdream.ase.controller; import com.codesdream.ase.component.datamanager.JSONParameter; -import com.codesdream.ase.component.datamanager.QuickJSONRespond; +import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.request.UserRegisterChecker; import com.codesdream.ase.model.information.BaseStudentInfo; import com.codesdream.ase.model.permission.User; diff --git a/src/main/java/com/codesdream/ase/exception/DataFileNotFoundException.java b/src/main/java/com/codesdream/ase/exception/DataFileNotFoundException.java deleted file mode 100644 index c85958a..0000000 --- a/src/main/java/com/codesdream/ase/exception/DataFileNotFoundException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.codesdream.ase.exception; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Data -public class DataFileNotFoundException extends RuntimeException { - private String path; - - public DataFileNotFoundException(String filePath){ - super(); - this.path = filePath; - } -} diff --git a/src/main/java/com/codesdream/ase/exception/notfound/DataFileNotFoundException.java b/src/main/java/com/codesdream/ase/exception/notfound/DataFileNotFoundException.java new file mode 100644 index 0000000..6ff26be --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/notfound/DataFileNotFoundException.java @@ -0,0 +1,15 @@ +package com.codesdream.ase.exception.notfound; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class DataFileNotFoundException extends NotFoundException { + private String path; + + public DataFileNotFoundException(String msg){ + super(msg); + this.path = msg; + } +} diff --git a/src/main/java/com/codesdream/ase/exception/notfound/NotFoundException.java b/src/main/java/com/codesdream/ase/exception/notfound/NotFoundException.java new file mode 100644 index 0000000..a632648 --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/notfound/NotFoundException.java @@ -0,0 +1,12 @@ +package com.codesdream.ase.exception.notfound; + + +public class NotFoundException extends RuntimeException { + public NotFoundException(String msg){ + super(msg); + } + + public NotFoundException(){ + super(); + } +} diff --git a/src/main/java/com/codesdream/ase/exception/notfound/TagNotFoundException.java b/src/main/java/com/codesdream/ase/exception/notfound/TagNotFoundException.java new file mode 100644 index 0000000..a7509ac --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/notfound/TagNotFoundException.java @@ -0,0 +1,11 @@ +package com.codesdream.ase.exception.notfound; + + +public class TagNotFoundException extends NotFoundException { + String tagName; + + public TagNotFoundException(String tagName){ + super(tagName); + this.tagName = tagName; + } +} diff --git a/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java b/src/main/java/com/codesdream/ase/exception/notfound/UserNotFoundException.java similarity index 56% rename from src/main/java/com/codesdream/ase/exception/UserNotFoundException.java rename to src/main/java/com/codesdream/ase/exception/notfound/UserNotFoundException.java index c721ae9..65a58c0 100644 --- a/src/main/java/com/codesdream/ase/exception/UserNotFoundException.java +++ b/src/main/java/com/codesdream/ase/exception/notfound/UserNotFoundException.java @@ -1,22 +1,20 @@ -package com.codesdream.ase.exception; +package com.codesdream.ase.exception.notfound; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class UserNotFoundException extends RuntimeException { +public class UserNotFoundException extends NotFoundException { Integer id; String username; - String message; public UserNotFoundException(Integer id, String username){ super(); this.id = id; this.username = username; } - public UserNotFoundException(String message){ - super(); - this.message = message; + public UserNotFoundException(String msg){ + super(msg); } } diff --git a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java index 7778168..6aae6c0 100644 --- a/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java +++ b/src/main/java/com/codesdream/ase/service/ASEUserDetailsService.java @@ -1,12 +1,11 @@ package com.codesdream.ase.service; import com.codesdream.ase.component.permission.UserAuthoritiesGenerator; -import com.codesdream.ase.exception.UserNotFoundException; +import com.codesdream.ase.exception.notfound.UserNotFoundException; import com.codesdream.ase.model.permission.User; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import javax.annotation.Resource; diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index faae155..3fd26b1 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -4,7 +4,7 @@ import com.codesdream.ase.component.auth.ASEPasswordEncoder; import com.codesdream.ase.component.auth.ASEUsernameEncoder; import com.codesdream.ase.component.permission.UserRolesListGenerator; import com.codesdream.ase.exception.UserInformationIllegalException; -import com.codesdream.ase.exception.UserNotFoundException; +import com.codesdream.ase.exception.notfound.UserNotFoundException; import com.codesdream.ase.exception.UsernameAlreadyExistException; import com.codesdream.ase.model.information.BaseStudentInfo; import com.codesdream.ase.model.permission.User; diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties new file mode 100644 index 0000000..240adf1 --- /dev/null +++ b/src/main/resources/application-dev.properties @@ -0,0 +1,23 @@ +server.port=8081 + +spring.thymeleaf.prefix=classpath:templates/ +spring.thymeleaf.suffix=.html +spring.thymeleaf.mode=HTML +spring.thymeleaf.encoding=UTF-8 + +spring.jpa.generate-ddl=false +spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=update +spring.jooq.sql-dialect=org.hibernate.dialect.MariaDB102Dialect +spring.jpa.open-in-view=true +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true + +spring.datasource.url=jdbc:mariadb://localhost:3306/ase?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=#a9b9fa6422 +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver + +server.error.whitelabel.enabled=false + +logging.level.root=info +logging.level.org.springframework.security=info \ No newline at end of file From e09f373fc0230c67d688d5911828662cc87ca090 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Thu, 26 Mar 2020 01:28:22 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E7=BC=96=E5=86=99=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3;=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E6=9C=8D=E5=8A=A1=E5=B1=82?= =?UTF-8?q?;=E5=AE=8C=E5=96=84=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=B1=82;=E5=AE=8C=E5=96=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=AE=A1=E7=90=86=E5=AD=90=E7=B3=BB=E7=BB=9F;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ase/component/api/QuickJSONRespond.java | 50 +++++-- .../ase/component/json/model/JsonableTag.java | 11 +- .../json/model/JsonableTagUserList.java | 26 ++++ .../component/json/model/JsonableUser.java | 19 +++ .../ase/controller/ASEControllerAdvice.java | 45 +++--- .../ase/controller/PermissionController.java | 133 ++++++++++++++---- .../badrequest/AlreadyExistException.java | 14 ++ .../BaseInformationAlreadyExistException.java | 6 +- .../UsernameAlreadyExistException.java | 6 +- .../RelatedObjectsExistException.java | 13 ++ .../BaseInformationNotFoundException.java} | 8 +- .../ase/service/BaseInformationService.java | 22 +-- .../ase/service/IPermissionService.java | 8 ++ .../codesdream/ase/service/IUserService.java | 3 + .../ase/service/PermissionService.java | 22 +++ .../codesdream/ase/service/UserService.java | 18 ++- 16 files changed, 313 insertions(+), 91 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/component/json/model/JsonableTagUserList.java create mode 100644 src/main/java/com/codesdream/ase/component/json/model/JsonableUser.java create mode 100644 src/main/java/com/codesdream/ase/exception/badrequest/AlreadyExistException.java rename src/main/java/com/codesdream/ase/exception/{ => badrequest}/BaseInformationAlreadyExistException.java (61%) rename src/main/java/com/codesdream/ase/exception/{ => badrequest}/UsernameAlreadyExistException.java (59%) create mode 100644 src/main/java/com/codesdream/ase/exception/conflict/RelatedObjectsExistException.java rename src/main/java/com/codesdream/ase/exception/{BaseInformationNotExistException.java => notfound/BaseInformationNotFoundException.java} (50%) diff --git a/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java b/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java index dfe654d..be125bf 100644 --- a/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java +++ b/src/main/java/com/codesdream/ase/component/api/QuickJSONRespond.java @@ -3,6 +3,8 @@ package com.codesdream.ase.component.api; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.json.respond.EmptyDataObjectRespond; import com.codesdream.ase.component.json.respond.JSONBaseRespondObject; +import com.sun.deploy.net.HttpResponse; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -23,6 +25,33 @@ public class QuickJSONRespond { return jsonParameter.getJSONString(respondObject); } + // 根据对象构造获得标准的JSON响应字符串返回 + public String getJSONStandardRespond(HttpStatus status, Object dataObject){ + JSONBaseRespondObject respondObject = new JSONBaseRespondObject(status.value(), status.getReasonPhrase()); + + respondObject.setData(dataObject); + return jsonParameter.getJSONString(respondObject); + } + + // 根据对象构造获得标准的JSON响应字符串返回 + public String getJSONStandardRespond(HttpStatus status, String info, Object dataObject){ + JSONBaseRespondObject respondObject = new JSONBaseRespondObject(status.value(), status.getReasonPhrase()); + if(info != null) respondObject.setInfo(info); + else respondObject.setInfo(null); + + respondObject.setData(dataObject); + return jsonParameter.getJSONString(respondObject); + } + + // 根据对象构造获得标准的JSON响应字符串返回 + public String getJSONStandardRespond(HttpStatus status, String info){ + JSONBaseRespondObject respondObject = new JSONBaseRespondObject(status.value(), status.getReasonPhrase()); + if(info != null) respondObject.setInfo(info); + else respondObject.setInfo(null); + + return jsonParameter.getJSONString(respondObject); + } + // 获得标准的JSON响应字符串返回特定状态码的和解释息 public String getJSONStandardRespond(Integer code, String msg, String info){ JSONBaseRespondObject respondObject = new JSONBaseRespondObject(code, msg); @@ -34,37 +63,42 @@ public class QuickJSONRespond { // 获得标准的JSON响应字符串返回(404状态) public String getRespond404(String info){ - return getJSONStandardRespond(404, "Not Found", info); + return getJSONStandardRespond(HttpStatus.NOT_FOUND, info); } // 获得标准的JSON响应字符串返回(404状态) public String getRespond404(String info, Object object){ - return getJSONStandardRespond(404, "Not Found", info, object); + return getJSONStandardRespond(HttpStatus.NOT_FOUND, info, object); } // 获得标准的JSON响应字符串返回(500状态) public String getRespond500(String info){ - return getJSONStandardRespond(500, "Internal Server Error", info); + return getJSONStandardRespond(HttpStatus.INTERNAL_SERVER_ERROR, info); } // 获得标准的JSON响应字符串返回(200状态) public String getRespond200(String info){ - return getJSONStandardRespond(200, "Ok", info); + return getJSONStandardRespond(HttpStatus.OK, info); } // 获得标准的JSON响应字符串返回(200状态) public String getRespond200(String info, Object object){ - return getJSONStandardRespond(200, "Ok", info, object); + return getJSONStandardRespond(HttpStatus.OK, info, object); } // 获得标准的JSON响应字符串返回(403状态) public String getRespond403(String info){ - return getJSONStandardRespond(403, "Forbidden", info); + return getJSONStandardRespond(HttpStatus.FORBIDDEN, info); } - // 获得标准的JSON响应字符串返回(403状态) + // 获得标准的JSON响应字符串返回(406状态) public String getRespond406(String info){ - return getJSONStandardRespond(406, "Not Acceptable", info); + return getJSONStandardRespond(HttpStatus.NOT_ACCEPTABLE, info); + } + + // 获得标准的JSON响应字符串返回(406状态) + public String getRespond406(String info, Object object){ + return getJSONStandardRespond(HttpStatus.NOT_ACCEPTABLE, info, object); } // 获得标准的JSON响应字符串返回(501态) diff --git a/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java b/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java index b5397cd..8db125b 100644 --- a/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java +++ b/src/main/java/com/codesdream/ase/component/json/model/JsonableTag.java @@ -5,6 +5,7 @@ import com.codesdream.ase.model.permission.User; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.NoArgsConstructor; import net.bytebuddy.implementation.bind.annotation.DefaultMethod; import java.util.ArrayList; @@ -13,6 +14,7 @@ import java.util.List; import java.util.Set; @Data +@NoArgsConstructor @ApiModel("标签") public class JsonableTag { @ApiModelProperty(value = "标签id") @@ -21,21 +23,12 @@ public class JsonableTag { private String name; @ApiModelProperty(value = "标签说明", example = "该系统的管理员") private String description; - @ApiModelProperty(value = "用户列表", hidden = true) - private Set users = new HashSet<>(); - public JsonableTag(){ - - } public JsonableTag(Tag tag){ this.id = tag.getId(); this.name = tag.getName(); this.description = tag.getDescription(); - // 构建用户的ID列表 - for(User user : tag.getUsers()) { - users.add(user.getId()); - } } } diff --git a/src/main/java/com/codesdream/ase/component/json/model/JsonableTagUserList.java b/src/main/java/com/codesdream/ase/component/json/model/JsonableTagUserList.java new file mode 100644 index 0000000..523c61e --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/model/JsonableTagUserList.java @@ -0,0 +1,26 @@ +package com.codesdream.ase.component.json.model; + +import com.codesdream.ase.model.permission.Tag; +import com.codesdream.ase.model.permission.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@NoArgsConstructor +@ApiModel("标签所属用户集合") +public class JsonableTagUserList { + + @ApiModelProperty(name = "用户列表") + private List users; + + + public JsonableTagUserList(Tag tag){ + for(User user : tag.getUsers()){ + users.add(user.getId()); + } + } +} diff --git a/src/main/java/com/codesdream/ase/component/json/model/JsonableUser.java b/src/main/java/com/codesdream/ase/component/json/model/JsonableUser.java new file mode 100644 index 0000000..74f6467 --- /dev/null +++ b/src/main/java/com/codesdream/ase/component/json/model/JsonableUser.java @@ -0,0 +1,19 @@ +package com.codesdream.ase.component.json.model; + +import com.codesdream.ase.model.permission.User; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@ApiModel("用户") +@NoArgsConstructor +public class JsonableUser { + private Integer id; + private String username; + + public JsonableUser(User user){ + this.id = user.getId(); + this.username = user.getUsername(); + } +} diff --git a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java index 755d930..bdddf30 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java +++ b/src/main/java/com/codesdream/ase/controller/ASEControllerAdvice.java @@ -1,26 +1,17 @@ package com.codesdream.ase.controller; import com.codesdream.ase.component.api.QuickJSONRespond; -import com.codesdream.ase.component.error.ErrorResponse; import com.codesdream.ase.component.json.respond.ErrorInfoJSONRespond; +import com.codesdream.ase.exception.badrequest.AlreadyExistException; +import com.codesdream.ase.exception.conflict.RelatedObjectsExistException; import com.codesdream.ase.exception.notfound.NotFoundException; -import com.sun.xml.bind.v2.model.annotation.Quick; -import org.apache.poi.openxml4j.opc.internal.ContentType; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.core.AuthenticationException; -import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.context.request.WebRequest; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; import java.util.Date; -import java.util.List; @RestControllerAdvice public class ASEControllerAdvice { @@ -28,17 +19,37 @@ public class ASEControllerAdvice { @Resource private QuickJSONRespond quickJSONRespond; - @ExceptionHandler(value = {NullPointerException.class}) + @ExceptionHandler(value = { + NullPointerException.class, + AlreadyExistException.class + }) public ResponseEntity handleBadRequest(Exception ex) { - - String json = quickJSONRespond.getRespond400(null, getJSONRespondObject(ex)); - return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(json); + return getResponse(HttpStatus.BAD_REQUEST, ex); } @ExceptionHandler(value = {NotFoundException.class}) public ResponseEntity handleNotFound(Exception ex) { - String json = quickJSONRespond.getRespond404(null, getJSONRespondObject(ex)); - return ResponseEntity.status(HttpStatus.NOT_FOUND).body(json); + + return getResponse(HttpStatus.NOT_FOUND, ex); + } + + @ExceptionHandler(value = {}) + public ResponseEntity handleNotAcceptable(Exception ex) { + return getResponse(HttpStatus.NOT_ACCEPTABLE, ex); + } + + @ExceptionHandler(value = {RelatedObjectsExistException.class}) + public ResponseEntity handleConflict(Exception ex) { + return getResponse(HttpStatus.CONFLICT, ex); + } + + private ResponseEntity getResponse(HttpStatus status, Exception ex){ + return ResponseEntity.status(status).body(getJSON(status, ex)); + + } + + private String getJSON(HttpStatus status, Exception ex){ + return quickJSONRespond.getJSONStandardRespond(status, getJSONRespondObject(ex)); } private Object getJSONRespondObject(Exception ex){ diff --git a/src/main/java/com/codesdream/ase/controller/PermissionController.java b/src/main/java/com/codesdream/ase/controller/PermissionController.java index d702bee..766d619 100644 --- a/src/main/java/com/codesdream/ase/controller/PermissionController.java +++ b/src/main/java/com/codesdream/ase/controller/PermissionController.java @@ -4,7 +4,12 @@ import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.component.datamanager.JSONParameter; import com.codesdream.ase.component.api.QuickJSONRespond; import com.codesdream.ase.component.json.model.JsonableTag; +import com.codesdream.ase.component.json.model.JsonableTagUserList; +import com.codesdream.ase.component.json.model.JsonableUser; import com.codesdream.ase.component.json.respond.PermissionJSONRespond; +import com.codesdream.ase.exception.badrequest.AlreadyExistException; +import com.codesdream.ase.exception.conflict.RelatedObjectsExistException; +import com.codesdream.ase.exception.notfound.NotFoundException; import com.codesdream.ase.exception.notfound.TagNotFoundException; import com.codesdream.ase.model.permission.Tag; import com.codesdream.ase.model.permission.User; @@ -14,11 +19,14 @@ import com.codesdream.ase.service.PermissionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.HashSet; +import java.util.List; import java.util.Optional; import java.util.Set; @@ -33,23 +41,14 @@ public class PermissionController { @Resource private IUserService userService; - @Resource - private JSONParameter jsonParameter; - - @Resource - private QuickJSONRespond jsonRespond; - // 根据名字创建新的标签 @PostMapping("tag") + @ResponseStatus(HttpStatus.CREATED) @ApiOperation(value = "创建新的标签", notes = "创建标签时其ID自动分配,指定ID无效") public JsonableTag createTag(@RequestBody JsonableTag tag){ - String tagName = tag.getName(); -/* if(tagName == null) return jsonRespond.getRespond406("Missing Tag Name");*/ - Optional tagOptional = permissionService.findTag(tagName); -/* if(tagOptional.isPresent()) return jsonRespond.getRespond409("Tag Name Already Exist");*/ - + if(tagOptional.isPresent()) throw new AlreadyExistException(tagName); Tag newTag = permissionService.getDefaultTag(tagName); if(tag.getDescription() != null) { newTag.setDescription(tag.getDescription()); @@ -57,9 +56,9 @@ public class PermissionController { return new JsonableTag(permissionService.save(newTag)); } - // 根据名字搜索标签的简要信息 @GetMapping("tag") + @ResponseStatus(HttpStatus.OK) @ApiOperation("搜索标签信息") @ApiImplicitParam(name = "name", value = "标签名") public JsonableTag checkTag(@RequestParam(value = "name") String name){ @@ -67,33 +66,105 @@ public class PermissionController { if(tagOptional.isPresent()){ return new JsonableTag(tagOptional.get()); } - else throw new TagNotFoundException(name); + else throw new NotFoundException(name); } - // 将用户添加到Tag中 - @PostMapping("tag/add/user") - public String addUserTag(HttpServletRequest request){ - Optional jsonObjectOptional = jsonParameter.getJSONByRequest(request); - if(!jsonObjectOptional.isPresent()) return jsonRespond.getRespond400("Illegal JSON Format"); + // 根据名字搜索标签的简要信息 + @GetMapping("tags") + @ResponseStatus(HttpStatus.OK) + @ApiOperation("列出所有的标签信息") + @ApiImplicitParam(name = "name", value = "标签名") + public Set listTag(){ + Iterable tagIterable = permissionService.findAllTag(); + Set jsonableTagSet = new HashSet<>(); + for(Tag tag : tagIterable){ + jsonableTagSet.add(new JsonableTag(tag)); + } + return jsonableTagSet; + } - JSONObject jsonObject = jsonObjectOptional.get(); - Integer tagId = jsonObject.getInteger("tagId"); - Integer userId = jsonObject.getInteger("userId"); + // 根据名字搜索标签的简要信息 + @DeleteMapping("tag") + @ResponseStatus(HttpStatus.NO_CONTENT) + @ApiOperation("删除标签") + @ApiImplicitParam(name = "name", value = "标签名") + public void deleteTag(@RequestParam(value = "name") String name){ + Optional tag = permissionService.findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); - if(userId == null || tagId == null) - return jsonRespond.getRespond406("Request Violates The Interface Protocol"); + // 检查外键关联 + if(tag.get().getUsers().size() > 0) throw new RelatedObjectsExistException(); + if(tag.get().getPermissionContainersCollections().size() > 0) throw new RelatedObjectsExistException(); - Optional user = userService.findUserById(userId); - if(!user.isPresent()) return jsonRespond.getRespond406("User Not Exist"); + permissionService.delete(tag.get()); + } - Optional tag = permissionService.findTag(tagId); - if(!tag.isPresent()) return jsonRespond.getRespond406("Tag Not Exist"); - // 检查用户是否已经在标签中 - if(tag.get().getUsers().contains(user.get())) return jsonRespond.getRespond409("User Already In The Tag"); - permissionService.addUserToTag(tag.get(), user.get()); + @GetMapping("tag/users") + @ResponseStatus(HttpStatus.OK) + @ApiOperation("搜索单个标签所属用户集合信息") + public JsonableTagUserList getUserTag(@RequestParam(value = "name") String name){ + Optional tag = permissionService.findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); + return new JsonableTagUserList(tag.get()); + } - return jsonRespond.getRespond200("Add User TO Tag Successful"); + @PutMapping("tag/users") + @ApiOperation("更新索单个标签所属用户集合信息") + public JsonableTagUserList setUserTag(@RequestParam String name, @RequestBody JsonableTagUserList userList){ + Optional tag = permissionService.findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); + + Set userSet = new HashSet<>(userList.getUsers()); + tag.get().setUsers(userService.findUsersById(userSet)); + + return new JsonableTagUserList(permissionService.save(tag.get())); + } + + @PostMapping("tag/users") + @ApiOperation("更新单个标签所属用户集合中添加一个或多个用户") + public JsonableTagUserList addUserTag(@RequestParam String name, @RequestBody JsonableTagUserList userList){ + Optional tag = permissionService.findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); + Set newUserSet = userService.findUsersById(new HashSet<>(userList.getUsers())); + + Set userSet = tag.get().getUsers(); + + userSet.addAll(newUserSet); + tag.get().setUsers(userSet); + + return new JsonableTagUserList(permissionService.save(tag.get())); + } + + @DeleteMapping("tag/users") + @ApiOperation("从单个标签所属用户集合中删除一个或多个用户") + @ApiImplicitParam(name = "name", value = "标签名") + public JsonableTagUserList deleteUserTag(@RequestParam String name, @RequestBody JsonableTagUserList userList){ + Optional tag = permissionService.findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); + Set userSet = tag.get().getUsers(); + Set deleteUserSet = userService.findUsersById(new HashSet<>(userList.getUsers())); + + userSet.removeAll(deleteUserSet); + tag.get().setUsers(userSet); + + return new JsonableTagUserList(permissionService.save(tag.get())); + } + + @GetMapping("tags/users") + @ResponseStatus(HttpStatus.OK) + @ApiOperation("搜索多个标签所属用户集合信息") + public Set getUserTags(@RequestParam(value = "name") List names){ + Set tagSet = permissionService.findTags(names); + Set userSet = new HashSet<>(); + Set jsonableUsers = new HashSet<>(); + for(Tag tag : tagSet){ + userSet.addAll(tag.getUsers()); + } + for(User user : userSet){ + jsonableUsers.add(new JsonableUser(user)); + } + return jsonableUsers; } diff --git a/src/main/java/com/codesdream/ase/exception/badrequest/AlreadyExistException.java b/src/main/java/com/codesdream/ase/exception/badrequest/AlreadyExistException.java new file mode 100644 index 0000000..81fa88b --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/badrequest/AlreadyExistException.java @@ -0,0 +1,14 @@ +package com.codesdream.ase.exception.badrequest; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +public class AlreadyExistException extends RuntimeException { + public AlreadyExistException(String msg){ + super(msg); + } +} diff --git a/src/main/java/com/codesdream/ase/exception/BaseInformationAlreadyExistException.java b/src/main/java/com/codesdream/ase/exception/badrequest/BaseInformationAlreadyExistException.java similarity index 61% rename from src/main/java/com/codesdream/ase/exception/BaseInformationAlreadyExistException.java rename to src/main/java/com/codesdream/ase/exception/badrequest/BaseInformationAlreadyExistException.java index 54a564b..47fda13 100644 --- a/src/main/java/com/codesdream/ase/exception/BaseInformationAlreadyExistException.java +++ b/src/main/java/com/codesdream/ase/exception/badrequest/BaseInformationAlreadyExistException.java @@ -1,16 +1,16 @@ -package com.codesdream.ase.exception; +package com.codesdream.ase.exception.badrequest; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class BaseInformationAlreadyExistException extends RuntimeException { +public class BaseInformationAlreadyExistException extends AlreadyExistException { private String className; private String value; public BaseInformationAlreadyExistException(Class aClass, String value){ - super(); + super(String.format("%s: %s", aClass.getName(), value)); this.className = aClass.getName(); this.value = value; } diff --git a/src/main/java/com/codesdream/ase/exception/UsernameAlreadyExistException.java b/src/main/java/com/codesdream/ase/exception/badrequest/UsernameAlreadyExistException.java similarity index 59% rename from src/main/java/com/codesdream/ase/exception/UsernameAlreadyExistException.java rename to src/main/java/com/codesdream/ase/exception/badrequest/UsernameAlreadyExistException.java index 634d2e8..c08d0e0 100644 --- a/src/main/java/com/codesdream/ase/exception/UsernameAlreadyExistException.java +++ b/src/main/java/com/codesdream/ase/exception/badrequest/UsernameAlreadyExistException.java @@ -1,16 +1,16 @@ -package com.codesdream.ase.exception; +package com.codesdream.ase.exception.badrequest; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class UsernameAlreadyExistException extends RuntimeException { +public class UsernameAlreadyExistException extends AlreadyExistException { String username; public UsernameAlreadyExistException(String username){ - super(); + super(username); this.username = username; } } diff --git a/src/main/java/com/codesdream/ase/exception/conflict/RelatedObjectsExistException.java b/src/main/java/com/codesdream/ase/exception/conflict/RelatedObjectsExistException.java new file mode 100644 index 0000000..48fb482 --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/conflict/RelatedObjectsExistException.java @@ -0,0 +1,13 @@ +package com.codesdream.ase.exception.conflict; + +import lombok.NoArgsConstructor; + +/** + * 存在与之相关联的对象 + */ +@NoArgsConstructor +public class RelatedObjectsExistException extends RuntimeException { + public RelatedObjectsExistException(String msg){ + super(msg); + } +} diff --git a/src/main/java/com/codesdream/ase/exception/BaseInformationNotExistException.java b/src/main/java/com/codesdream/ase/exception/notfound/BaseInformationNotFoundException.java similarity index 50% rename from src/main/java/com/codesdream/ase/exception/BaseInformationNotExistException.java rename to src/main/java/com/codesdream/ase/exception/notfound/BaseInformationNotFoundException.java index 65da967..961d435 100644 --- a/src/main/java/com/codesdream/ase/exception/BaseInformationNotExistException.java +++ b/src/main/java/com/codesdream/ase/exception/notfound/BaseInformationNotFoundException.java @@ -1,16 +1,16 @@ -package com.codesdream.ase.exception; +package com.codesdream.ase.exception.notfound; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class BaseInformationNotExistException extends RuntimeException { +public class BaseInformationNotFoundException extends NotFoundException { private String className; private String value; - public BaseInformationNotExistException(Class baseInformationClass, String value){ - super(); + public BaseInformationNotFoundException(Class baseInformationClass, String value){ + super(String.format("%s: %s", baseInformationClass.getName(), value)); this.className = baseInformationClass.getName(); this.value = value; } diff --git a/src/main/java/com/codesdream/ase/service/BaseInformationService.java b/src/main/java/com/codesdream/ase/service/BaseInformationService.java index 072ec94..ec287a5 100644 --- a/src/main/java/com/codesdream/ase/service/BaseInformationService.java +++ b/src/main/java/com/codesdream/ase/service/BaseInformationService.java @@ -1,9 +1,9 @@ package com.codesdream.ase.service; import com.codesdream.ase.component.datamanager.DataTable; -import com.codesdream.ase.exception.BaseInformationAlreadyExistException; +import com.codesdream.ase.exception.badrequest.BaseInformationAlreadyExistException; import com.codesdream.ase.exception.BaseInformationIllegalException; -import com.codesdream.ase.exception.BaseInformationNotExistException; +import com.codesdream.ase.exception.notfound.BaseInformationNotFoundException; import com.codesdream.ase.model.information.*; import com.codesdream.ase.repository.information.*; import lombok.extern.slf4j.Slf4j; @@ -103,7 +103,7 @@ public class BaseInformationService implements IBaseInformationService { if(administrativeDivision.isPresent()) { return administrativeDivision.get(); } - else throw new BaseInformationNotExistException(BaseAdministrativeDivision.class, name); + else throw new BaseInformationNotFoundException(BaseAdministrativeDivision.class, name); } return administrativeDivision.get(); @@ -114,7 +114,7 @@ public class BaseInformationService implements IBaseInformationService { Optional college = collegeRepository.findByName(name); // 检查 - if(!college.isPresent()) throw new BaseInformationNotExistException(BaseCollege.class, name); + if(!college.isPresent()) throw new BaseInformationNotFoundException(BaseCollege.class, name); return college.get(); } @@ -122,7 +122,7 @@ public class BaseInformationService implements IBaseInformationService { public BaseEthnic findEthnicByName(String name) { Optional ethnic = ethnicRepository.findByName(name); - if(!ethnic.isPresent()) throw new BaseInformationNotExistException(BaseEthnic.class, name); + if(!ethnic.isPresent()) throw new BaseInformationNotFoundException(BaseEthnic.class, name); return ethnic.get(); } @@ -130,7 +130,7 @@ public class BaseInformationService implements IBaseInformationService { public BaseMajor findMajorByName(String name) { Optional major = majorRepository.findByName(name); - if(!major.isPresent()) throw new BaseInformationNotExistException(BaseMajor.class, name); + if(!major.isPresent()) throw new BaseInformationNotFoundException(BaseMajor.class, name); return major.get(); } @@ -139,7 +139,7 @@ public class BaseInformationService implements IBaseInformationService { Optional politicalStatus = politicalStatusRepository.findByName(name); if(!politicalStatus.isPresent()) - throw new BaseInformationNotExistException(BasePoliticalStatus.class, name); + throw new BaseInformationNotFoundException(BasePoliticalStatus.class, name); return politicalStatus.get(); } @@ -148,7 +148,7 @@ public class BaseInformationService implements IBaseInformationService { Optional candidateCategory = candidateCategoryRepository.findByName(name); if(!candidateCategory.isPresent()) - throw new BaseInformationNotExistException(BaseCandidateCategory.class, name); + throw new BaseInformationNotFoundException(BaseCandidateCategory.class, name); return candidateCategory.get(); } @@ -157,7 +157,7 @@ public class BaseInformationService implements IBaseInformationService { Optional studentInfo = studentInfoRepository.findByStudentId(studentId); if(!studentInfo.isPresent()) - throw new BaseInformationNotExistException(BaseStudentInfo.class, studentId); + throw new BaseInformationNotFoundException(BaseStudentInfo.class, studentId); return studentInfo.get(); } @@ -202,7 +202,7 @@ public class BaseInformationService implements IBaseInformationService { row.elementAt(infoIndex.elementAt(7)), row.elementAt(infoIndex.elementAt(8))); save(studentInfo); - } catch (BaseInformationNotExistException e){ + } catch (BaseInformationNotFoundException e){ String log_info = String.format("一项学生信息的某项基本信息未在数据库找到, 该项数据无效." + " %s: %s",e.getClassName(), e.getValue()); log.warn(log_info); @@ -281,7 +281,7 @@ public class BaseInformationService implements IBaseInformationService { public BaseStudentInfo update(BaseStudentInfo baseStudentInfo) { // 更新前检查 if(!checkStudentInfo(baseStudentInfo.getStudentId())) - throw new BaseInformationNotExistException(BaseStudentInfo.class, baseStudentInfo.getStudentId()); + throw new BaseInformationNotFoundException(BaseStudentInfo.class, baseStudentInfo.getStudentId()); return studentInfoRepository.save(baseStudentInfo); } } diff --git a/src/main/java/com/codesdream/ase/service/IPermissionService.java b/src/main/java/com/codesdream/ase/service/IPermissionService.java index fc1cb70..ca8ec6e 100644 --- a/src/main/java/com/codesdream/ase/service/IPermissionService.java +++ b/src/main/java/com/codesdream/ase/service/IPermissionService.java @@ -4,6 +4,7 @@ import com.codesdream.ase.model.permission.*; import javafx.util.Pair; import java.util.Collection; +import java.util.List; import java.util.Optional; import java.util.Set; @@ -23,6 +24,11 @@ public interface IPermissionService { // 查找用户标签 Optional findTag(Integer id); + // 列出所有的标签 + Iterable findAllTag(); + + Set findTags(List names); + // 查找功能性权限容器 Optional findFPC(String name); @@ -95,6 +101,8 @@ public interface IPermissionService { Tag save(Tag tag); + void delete(Tag tag); + FunctionalPermissionContainer save(FunctionalPermissionContainer fpc); ScopePermissionContainer save(ScopePermissionContainer spc); diff --git a/src/main/java/com/codesdream/ase/service/IUserService.java b/src/main/java/com/codesdream/ase/service/IUserService.java index fbd20db..8426fd2 100644 --- a/src/main/java/com/codesdream/ase/service/IUserService.java +++ b/src/main/java/com/codesdream/ase/service/IUserService.java @@ -8,6 +8,7 @@ import org.springframework.security.core.GrantedAuthority; import java.util.Collection; import java.util.List; import java.util.Optional; +import java.util.Set; public interface IUserService { @@ -42,6 +43,8 @@ public interface IUserService { // 更具学号获得对应的用户名 String getUsernameByStudentId(String studentId); + Set findUsersById(Set usersId); + // 随机生成一个用户名 void generateRandomUsername(User user); diff --git a/src/main/java/com/codesdream/ase/service/PermissionService.java b/src/main/java/com/codesdream/ase/service/PermissionService.java index 73ad410..918c7f2 100644 --- a/src/main/java/com/codesdream/ase/service/PermissionService.java +++ b/src/main/java/com/codesdream/ase/service/PermissionService.java @@ -2,6 +2,7 @@ package com.codesdream.ase.service; import com.codesdream.ase.component.permission.UserFPCListGenerator; import com.codesdream.ase.component.permission.UserFSRGenerator; +import com.codesdream.ase.exception.notfound.NotFoundException; import com.codesdream.ase.model.permission.*; import com.codesdream.ase.repository.permission.FunctionalPermissionContainerRepository; import com.codesdream.ase.repository.permission.PermissionContainersCollectionRepository; @@ -68,6 +69,22 @@ public class PermissionService implements IPermissionService { return tagRepository.findById(id); } + @Override + public Iterable findAllTag() { + return tagRepository.findAll(); + } + + @Override + public Set findTags(List names) { + Set tagSet = new HashSet<>(); + for(String name : names){ + Optional tag = findTag(name); + if(!tag.isPresent()) throw new NotFoundException(name); + tagSet.add(tag.get()); + } + return tagSet; + } + @Override public Optional findFPC(String name) { return fpcRepository.findByName(name); @@ -223,6 +240,11 @@ public class PermissionService implements IPermissionService { return tagRepository.save(tag); } + @Override + public void delete(Tag tag) { + tagRepository.delete(tag); + } + @Override public FunctionalPermissionContainer save(FunctionalPermissionContainer fpc) { if(fpcRepository.findByName(fpc.getName()).isPresent()) diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index 3fd26b1..f4710e4 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -5,7 +5,7 @@ import com.codesdream.ase.component.auth.ASEUsernameEncoder; import com.codesdream.ase.component.permission.UserRolesListGenerator; import com.codesdream.ase.exception.UserInformationIllegalException; import com.codesdream.ase.exception.notfound.UserNotFoundException; -import com.codesdream.ase.exception.UsernameAlreadyExistException; +import com.codesdream.ase.exception.badrequest.UsernameAlreadyExistException; import com.codesdream.ase.model.information.BaseStudentInfo; import com.codesdream.ase.model.permission.User; import com.codesdream.ase.repository.permission.UserRepository; @@ -15,10 +15,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.UUID; +import java.util.*; @Service public class UserService implements IUserService { @@ -86,6 +83,17 @@ public class UserService implements IUserService { return usernameEncoder.encode(studentId); } + @Override + public Set findUsersById(Set usersId) { + Set userSet = new HashSet<>(); + for(Integer id : usersId){ + Optional user = findUserById(id); + if(!user.isPresent()) throw new UserNotFoundException(String.format("ID: %d", id)); + userSet.add(user.get()); + } + return userSet; + } + @Override public void generateRandomUsername(User user) { user.setUsername(usernameEncoder.encode(UUID.randomUUID().toString()));