1.serviceId改为自动获取,不能手动输入
2.修改时serviceId、动作、类型、表类型不可更改 3.增加单域、多域时关联表数量的限制
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.nis.web.controller.systemService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,11 +14,13 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.SystemServiceInfo;
|
||||
import com.nis.util.Collections3;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -30,8 +34,6 @@ public class SystemServiceController extends BaseController {
|
||||
@ModelAttribute
|
||||
public SystemServiceInfo get(Long id) {
|
||||
if (!StringUtil.isEmpty(id)){
|
||||
// SystemServiceInfo systemServiceInfo = new SystemServiceInfo();
|
||||
// systemServiceInfo.setId(id);
|
||||
return systemServiceService.get(id);
|
||||
}else{
|
||||
return new SystemServiceInfo();
|
||||
@@ -123,5 +125,44 @@ public class SystemServiceController extends BaseController {
|
||||
return "/systemService/list";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "serviceIdValidate")
|
||||
public String serviceIdValidate(String serviceId, Long id) {
|
||||
List<SystemServiceInfo> list = systemServiceService.getSystemServiceByServiceId(serviceId);
|
||||
if (Collections3.isEmpty(list)) {
|
||||
return "true";
|
||||
} else {
|
||||
if (id != null) {
|
||||
if (list.get(0).getId() == id) {
|
||||
return "true";
|
||||
} else {
|
||||
return "false";
|
||||
}
|
||||
} else {
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "newServiceId")
|
||||
public Integer getNewServiceId(Integer serviceIdPre) {
|
||||
if (serviceIdPre != null) {
|
||||
SystemServiceInfo ssi = new SystemServiceInfo();
|
||||
ssi.setServiceIdPre(serviceIdPre);
|
||||
List<SystemServiceInfo> list = systemServiceService.findList(ssi);
|
||||
if (!Collections3.isEmpty(list)) {
|
||||
Collections.sort(list, new Comparator<SystemServiceInfo>() {
|
||||
@Override
|
||||
public int compare(SystemServiceInfo arg0, SystemServiceInfo arg1) {
|
||||
return arg1.getServiceId().compareTo(arg0.getServiceId());
|
||||
}
|
||||
});
|
||||
return list.get(0).getServiceId() + 1;
|
||||
} else {
|
||||
return serviceIdPre * 100;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user