初始版本
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.vverp.controller.admin;
|
||||
|
||||
import com.vverp.annotation.Module;
|
||||
import com.vverp.entity.*;
|
||||
import com.vverp.moli.util.RespData;
|
||||
import com.vverp.service.SnPrefixService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author dealsky
|
||||
* @date 2020/3/11 8:38 下午
|
||||
*/
|
||||
@Controller("adminSnPrefixController")
|
||||
@RequestMapping("/admin/snPrefix")
|
||||
public class SnPrefixController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private SnPrefixService snPrefixService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(ModelMap modelMap) {
|
||||
Class[] classes = new Class[]{PurchaseOrder.class, PurchaseStock.class};
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (Class cls : classes) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String key = cls.getSimpleName();
|
||||
Module module = (Module) cls.getAnnotation(Module.class);
|
||||
if (module == null || StringUtils.isBlank(module.name())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
map.put("moduleName", module.name());
|
||||
map.put("name", key);
|
||||
map.put("prefix", snPrefixService.get(key).getPrefix());
|
||||
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
modelMap.addAttribute("list", list);
|
||||
return "snPrefix/list";
|
||||
}
|
||||
|
||||
@RequestMapping("/dialog/edit")
|
||||
public String dialogEdit(ModelMap modelMap, String name) {
|
||||
SnPrefix snPrefix = snPrefixService.get(name);
|
||||
modelMap.addAttribute("snPrefix", snPrefix);
|
||||
return "/snPrefix/dialog/edit";
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@ResponseBody
|
||||
public RespData update(SnPrefix snPrefix) {
|
||||
snPrefixService.updateSnPrefix(snPrefix);
|
||||
return RespData.success();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user