diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/PostController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/PostController.java index 92ff614..7f40513 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/PostController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/PostController.java @@ -4,7 +4,6 @@ import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -22,7 +21,8 @@ import com.tamguo.modules.sys.utils.Result; public class PostController { private final String POST_INDEX_PAGE = "modules/sys/post/index"; - private final String POST_DETAIL_PAGE = "modules/sys/post/detail"; + private final String POST_UPDATE_PAGE = "modules/sys/post/update"; + private final String POST_ADD_PAGE = "modules/sys/post/add"; @Autowired private IPostService iPostService; @@ -32,18 +32,19 @@ public class PostController { return POST_INDEX_PAGE; } - @RequestMapping(path="detail") - public ModelAndView detail(ModelAndView model , String id) { - if(StringUtils.isEmpty(id)) { - model.addObject("title", "新增岗位"); - }else { - model.addObject("title", "修改岗位"); - model.addObject("post", iPostService.selectById(id)); - } - model.setViewName(POST_DETAIL_PAGE); + @RequestMapping(path="update") + public ModelAndView update(ModelAndView model , String id) { + model.addObject("title", "修改岗位"); + model.addObject("post", iPostService.selectById(id)); + model.setViewName(POST_UPDATE_PAGE); return model; } + @RequestMapping(path="add") + public String add() { + return POST_ADD_PAGE; + } + @RequestMapping(path="listData",method=RequestMethod.POST) @ResponseBody public Map listData(SysPostCondition condition) { @@ -55,15 +56,22 @@ public class PostController { @ResponseBody public Result save(SysPostEntity post) { try { - if(StringUtils.isEmpty(post.getId())) { - iPostService.add(post); - }else { - iPostService.update(post); - } + iPostService.add(post); return Result.result(0, null, "操作成功"); } catch (Exception e) { return ExceptionSupport.resolverResult("保存岗位", this.getClass(), e); } + } + + @RequestMapping(path="update",method=RequestMethod.POST) + @ResponseBody + public Result update(SysPostEntity post) { + try { + iPostService.update(post); + return Result.result(0, null, "操作成功"); + } catch (Exception e) { + return ExceptionSupport.resolverResult("修改岗位", this.getClass(), e); + } } } diff --git a/tamguo-oms/src/main/resources/templates/modules/sys/post/add.html b/tamguo-oms/src/main/resources/templates/modules/sys/post/add.html new file mode 100644 index 0000000..4225f72 --- /dev/null +++ b/tamguo-oms/src/main/resources/templates/modules/sys/post/add.html @@ -0,0 +1,130 @@ + +岗位管理 - JeeSite Demo + + + + + + + + + + + + +
+
+
+
+ 新增岗位 +
+
+ +
+
+
+
+
基本信息
+
+
+
+ +
+ + +
+
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tamguo-oms/src/main/resources/templates/modules/sys/post/index.html b/tamguo-oms/src/main/resources/templates/modules/sys/post/index.html index 3cde61c..3dc0a56 100644 --- a/tamguo-oms/src/main/resources/templates/modules/sys/post/index.html +++ b/tamguo-oms/src/main/resources/templates/modules/sys/post/index.html @@ -25,7 +25,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
查询 - 新增 + 新增
@@ -124,7 +124,7 @@ $('#dataGrid').dataGrid({ }}, {header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){ var actions = []; - actions.push(' '); + actions.push(' '); if (row.status == "normal"){ actions.push(' '); } diff --git a/tamguo-oms/src/main/resources/templates/modules/sys/post/detail.html b/tamguo-oms/src/main/resources/templates/modules/sys/post/update.html similarity index 95% rename from tamguo-oms/src/main/resources/templates/modules/sys/post/detail.html rename to tamguo-oms/src/main/resources/templates/modules/sys/post/update.html index d6921a0..ac1057d 100644 --- a/tamguo-oms/src/main/resources/templates/modules/sys/post/detail.html +++ b/tamguo-oms/src/main/resources/templates/modules/sys/post/update.html @@ -19,13 +19,14 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
-
+
+ 修改岗位
-
+
基本信息