package com.matrix.system.hive.action; 
 | 
  
 | 
import com.matrix.core.pojo.AjaxResult; 
 | 
import com.matrix.core.pojo.PaginationVO; 
 | 
import com.matrix.core.tools.WebUtil; 
 | 
import com.matrix.system.hive.action.util.QueryUtil; 
 | 
import com.matrix.system.hive.bean.SysDepartInfo; 
 | 
import com.matrix.system.hive.service.CodeService; 
 | 
import com.matrix.system.hive.service.SysDepartInfoService; 
 | 
import org.springframework.stereotype.Controller; 
 | 
import org.springframework.web.bind.annotation.RequestMapping; 
 | 
import org.springframework.web.bind.annotation.ResponseBody; 
 | 
  
 | 
import javax.annotation.Resource; 
 | 
import java.util.Arrays; 
 | 
import java.util.List; 
 | 
  
 | 
  
 | 
  
 | 
/** 
 | 
 *  
 | 
 * @Title: DepartInfoController.java   
 | 
 * @Package com.zkingsoft.actions.admin   
 | 
 * @description 部门管理action 
 | 
 * @author jyy 
 | 
 * @email 18075895212@qq.com 
 | 
 * @date 2016年7月11日 下午5:41:36 
 | 
 */ 
 | 
@Controller 
 | 
@RequestMapping(value = "admin/departInfo") 
 | 
public class DepartInfoController extends BaseController { 
 | 
    public static final String fnCode = "departInfo"; 
 | 
    public static final String search = fnCode + ":search"; 
 | 
    public static final String edit = fnCode + ":edit"; 
 | 
    public static final String del = fnCode + ":del"; 
 | 
    public static final String add = fnCode + ":add"; 
 | 
  
 | 
  
 | 
    @Resource 
 | 
    private SysDepartInfoService currentService; 
 | 
    @Resource 
 | 
    private CodeService codeService; 
 | 
  
 | 
    /** 
 | 
     * 列表显示 
 | 
     */ 
 | 
    @RequestMapping(value = "/showList") 
 | 
    public @ResponseBody 
 | 
    AjaxResult showList(SysDepartInfo departInfo, PaginationVO pageVo) { 
 | 
        QueryUtil.setQueryLimit(departInfo); 
 | 
        return showList(currentService, departInfo, pageVo); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 新增或修改页面 
 | 
     */ 
 | 
    @RequestMapping(value = "/addOrModify") 
 | 
    public @ResponseBody AjaxResult addOrModify(SysDepartInfo departInfo) { 
 | 
  
 | 
        if (departInfo.getId() != null) { 
 | 
  
 | 
            return modify(currentService, departInfo, "部门"); 
 | 
        } else { 
 | 
            QueryUtil.setQueryLimit(departInfo); 
 | 
            departInfo.setDepartNo(codeService.getDepartCode()); 
 | 
            return add(currentService, departInfo, "部门"); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 进入修改界面 
 | 
     */ 
 | 
    @RequestMapping(value = "/editForm") 
 | 
    public String editForm(Long id) { 
 | 
        SysDepartInfo departInfo; 
 | 
        if (id != null) { 
 | 
            departInfo = currentService.findById(id); 
 | 
            WebUtil.getRequest().setAttribute("obj", departInfo); 
 | 
        } 
 | 
        return "admin/hive/orgment/departInfo-form"; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 删除 
 | 
     */ 
 | 
    @RequestMapping(value = "/del") 
 | 
    public @ResponseBody AjaxResult del(Long  keys) { 
 | 
  
 | 
        int i = currentService.removeById(keys); 
 | 
        if (i > 0) { 
 | 
            return new AjaxResult(AjaxResult.STATUS_SUCCESS,  "成功删除" + i + "条数据"); 
 | 
        } else { 
 | 
            return new AjaxResult(AjaxResult.STATUS_FAIL,  "删除失败"); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * ======================================================= 
 | 
     * *******************公共的数据访问方法******************** 
 | 
     * ======================================================= 
 | 
     */ 
 | 
  
 | 
    @RequestMapping(value = "/findById") 
 | 
    public @ResponseBody AjaxResult findById(Long id) { 
 | 
        SysDepartInfo sysDepartInfo = super.findById(currentService, id); 
 | 
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(sysDepartInfo), 0); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 显示所有的部门信息 
 | 
     */ 
 | 
    @RequestMapping(value = "/showDepartInfo") 
 | 
    public @ResponseBody AjaxResult showDepartInfo(SysDepartInfo departInfo, PaginationVO pageVo) { 
 | 
        // 部门信息 
 | 
        QueryUtil.setQueryLimit(departInfo); 
 | 
        List<SysDepartInfo> departInfos = currentService.findByModel(departInfo); 
 | 
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, departInfos, 0); 
 | 
    } 
 | 
  
 | 
} 
 |