All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.mingsoft.organization.action.PostAction Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package net.mingsoft.organization.action;

import java.util.List;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import java.util.*;

import com.alibaba.fastjson.JSON;
import net.mingsoft.base.entity.ResultData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.BindingResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import net.mingsoft.organization.biz.IPostBiz;
import net.mingsoft.organization.entity.PostEntity;
import net.mingsoft.base.util.JSONObject;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.base.filter.DateValueFilter;
import net.mingsoft.base.filter.DoubleValueFilter;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.constant.e.BusinessTypeEnum;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
 * 岗位管理管理控制层
 * @author 铭飞开源团队
 * 创建日期:2020-1-6 14:53:26
* 历史修订:
*/ @Api(value = "岗位管理接口") @Controller("organizationPostAction") @RequestMapping("/${ms.manager.path}/organization/post") public class PostAction extends BaseAction{ /** * 注入岗位管理业务层 */ @Autowired private IPostBiz postBiz; /** * 返回主界面index */ @GetMapping("/index") public String index(HttpServletResponse response,HttpServletRequest request){ return "/organization/post/index"; } /** * 查询岗位管理列表 * @param post 岗位管理实体 */ @ApiOperation(value = "查询岗位管理列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "postName", value = "岗位名称", required =false,paramType="query"), @ApiImplicitParam(name = "postCode", value = "岗位编号", required =false,paramType="query"), @ApiImplicitParam(name = "postDesc", value = "岗位描述", required =false,paramType="query"), @ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"), @ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"), @ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"), @ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"), @ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"), @ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"), }) @RequestMapping("/list") @ResponseBody public ResultData list(@ModelAttribute @ApiIgnore PostEntity post,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { BasicUtil.startPage(); List postList = postBiz.query(post); return ResultData.build().success(new EUListBean(postList,(int)BasicUtil.endPage(postList).getTotal())); } /** * 返回编辑界面post_form */ @GetMapping("/form") public String form(@ModelAttribute PostEntity post,HttpServletResponse response,HttpServletRequest request,ModelMap model){ if(post.getId()!=null){ BaseEntity postEntity = postBiz.getEntity(Integer.parseInt(post.getId())); model.addAttribute("postEntity",postEntity); } return "/organization/post/form"; } /** * 获取岗位管理 * @param post 岗位管理实体 */ @ApiOperation(value = "获取岗位管理列表接口") @ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") @GetMapping("/get") @ResponseBody public ResultData get(@ModelAttribute @ApiIgnore PostEntity post,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model){ if(post.getId()==null) { return ResultData.build().error(); } PostEntity _post = (PostEntity)postBiz.getEntity(Integer.parseInt(post.getId())); return ResultData.build().success(_post); } @ApiOperation(value = "保存岗位管理列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "postName", value = "岗位名称", required =false,paramType="query"), @ApiImplicitParam(name = "postCode", value = "岗位编号", required =false,paramType="query"), @ApiImplicitParam(name = "postDesc", value = "岗位描述", required =false,paramType="query"), @ApiImplicitParam(name = "createBy", value = "创建人", required =false,paramType="query"), @ApiImplicitParam(name = "createDate", value = "创建时间", required =false,paramType="query"), @ApiImplicitParam(name = "updateBy", value = "修改人", required =false,paramType="query"), @ApiImplicitParam(name = "updateDate", value = "修改时间", required =false,paramType="query"), @ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"), @ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"), }) /** * 保存岗位管理 * @param post 岗位管理实体 */ @PostMapping("/save") @ResponseBody @LogAnn(title = "保存岗位管理", businessType = BusinessTypeEnum.INSERT) @RequiresPermissions("organization:post:save") public ResultData save(@ModelAttribute @ApiIgnore PostEntity post, HttpServletResponse response, HttpServletRequest request) { if(!StringUtil.checkLength(post.getPostName()+"", 1, 10)){ return ResultData.build().error(getResString("err.length", this.getResString("post.name"), "1", "10")); } if(!StringUtil.checkLength(post.getPostCode()+"", 1, 10)){ return ResultData.build().error(getResString("err.length", this.getResString("post.code"), "1", "10")); } postBiz.saveEntity(post); return ResultData.build().success(post); } /** * @param post 岗位管理实体 */ @ApiOperation(value = "批量删除岗位管理列表接口") @PostMapping("/delete") @ResponseBody @LogAnn(title = "删除岗位管理", businessType = BusinessTypeEnum.DELETE) @RequiresPermissions("organization:post:del") public ResultData delete(@RequestBody List posts,HttpServletResponse response, HttpServletRequest request) { int[] ids = new int[posts.size()]; for(int i = 0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy