MISBoot快速开发平台

Controller类

一、通过自动生成代码功能生成代码

把生成出来的Controller类复制到项目对应的文件夹下。

二、示例

示例
package cn.ewsd.mdata.controller;

    import java.util.Date;
    import java.util.List;
    import java.util.Map;

    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.ModelAttribute;
    import org.springframework.web.bind.annotation.PathVariable;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.stereotype.Controller;

    import cn.ewsd.common.annotation.ControllerLog;
    import cn.ewsd.common.controller.BaseController;
    import cn.ewsd.common.utils.BaseUtils;
    import cn.ewsd.common.utils.easyui.PageParam;
    import cn.ewsd.common.utils.easyui.PageSet;

    import cn.ewsd.mdata.model.SysUser;
    import cn.ewsd.mdata.service.SysUserService;

    /**
     *
     *
     * @Author zhaoxiace
     * @Email zhaoxiace@ewsd.cn
     * @Date 2019-07-16 03:29:31
     */
    @Controller
    @RequestMapping("/sysUser")
    public class SysUserController extends MdataBaseController {

        @Autowired
        private SysUserService sysUserService;

        //分页页面
        @RequestMapping("/index")
        @ControllerLog(description = "打开SysUser模块管理页面")
        public String index(@RequestParam Mapparams) {
            return "office/sysUser/index";
        }

        //获取分页集
        @ResponseBody
        @RequestMapping(value = "/getPageSet", method = RequestMethod.POST)
        @ControllerLog(description = "获得SysUser分页集数据")
        public Object getPageSet(PageParam pageParam) {
            String filterSort = "";
            filterSort = BaseUtils.filterSort(request, filterSort + getAuthFilter());
            PageSetpageSet = sysUserService.getPageSet(pageParam, filterSort);
            return pageSet;
        }

        //获取详情
        @ResponseBody
        @RequestMapping(value = "/getDetailByUuid")
        @ControllerLog(description = "获得SysUser模块详细数据")
        public Object getDetailByUuid(String uuid) {
            SysUser sysUser = sysUserService.selectByPrimaryKey(uuid);
            return sysUser;
        }

        //新增页面
        @RequestMapping("/add")
        @ControllerLog(description = "打开SysUser模块新增页面")
        public String add() {
            return "office/sysUser/edit";
        }

        //保存数据
        @ResponseBody
        @RequestMapping(value = "/save", method = RequestMethod.POST)
        @ControllerLog(description = "保存SysUser模块数据")
        public Object save(@ModelAttribute SysUser sysUser) {
            int result = sysUserService.insertSelective(getSaveData(sysUser));
            return result > 0 ? success("保存成功!") : failure("保存失败!");
        }

        //编辑页面
        @RequestMapping("/edit")
        @ControllerLog(description = "打开SysUser模块编辑页面")
        public String edit() {
            return "office/sysUser/edit";
        }

        //更新数据
        @ResponseBody
        @RequestMapping(value = "/update", method = RequestMethod.POST)
        @ControllerLog(description = "更新SysUser模块数据")
        public Object update(@ModelAttribute SysUser sysUser) {
            int result = sysUserService.updateByPrimaryKeySelective(getUpdateData(sysUser));
            return result > 0 ? success("更新成功!") : failure("更新失败!");
        }

        //删除数据
        @ResponseBody
        @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
        @ControllerLog(description = "删除SysUser模块数据")
        public Object deleteBatch(@RequestParam String[] uuid) {
            int result = sysUserService.executeDeleteBatch(uuid);
            return result > 0 ? success("删除成功!") : failure("删除失败!");
        }

    }
QQ在线咨询
客服 QQ
251122361
微信/手机
18973127736
办公电话
0731-89565588