| package com.matrix.system.hive.action; | 
|   | 
| import javax.annotation.Resource; | 
|   | 
| import com.matrix.core.constance.MatrixConstance; | 
| import com.matrix.system.common.bean.SysUsers; | 
| import com.matrix.system.hive.action.util.QueryUtil; | 
| import com.matrix.system.hive.service.SysSupplierTypeService; | 
| import org.springframework.stereotype.Controller; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.ResponseBody; | 
|   | 
|   | 
| import com.matrix.core.anotations.RemoveRequestToken; | 
| import com.matrix.core.anotations.SaveRequestToken; | 
|   | 
| import com.matrix.system.hive.bean.SysSupplierType; | 
| import com.matrix.core.pojo.PaginationVO; | 
| import com.matrix.core.tools.WebUtil; | 
| import com.matrix.core.pojo.AjaxResult; | 
|   | 
| /**往来单位类型 | 
|  * @author jiangyouyao | 
|  * @date 2016-07-17 | 
|  */ | 
| @Controller | 
| @RequestMapping(value = "admin/suppliertype") | 
| public class SupplierTypeController extends BaseController{ | 
|     @Resource | 
|     private SysSupplierTypeService currentService; | 
|      | 
|   | 
|   | 
|      | 
|      | 
|      | 
|     //记录编辑前的值Before_Edit_Value | 
|     public static final String BEV="Suppliertype_BEV"; | 
|      | 
|     public static final String fnCode = "suppliertype"; | 
|     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"; | 
|     /**所有 | 
|      * @param sysSupplierType | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/all") | 
|     public @ResponseBody AjaxResult all(SysSupplierType sysSupplierType) { | 
|         QueryUtil.setQueryLimit(sysSupplierType); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS,    currentService.findByModel(sysSupplierType), 0); | 
|     } | 
|      | 
|     /** | 
|      * 分页列表显示 | 
|      */ | 
|     @RequestMapping(value = "/showList") | 
|     public @ResponseBody AjaxResult showList(SysSupplierType sysSupplierType, PaginationVO pageVo) { | 
|         SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
|         sysSupplierType.setShopId(sysUsers.getShopId()); | 
|         sysSupplierType.setCompanyId(sysUsers.getCompanyId()); | 
|         return showList(currentService, sysSupplierType, pageVo); | 
|     } | 
|         | 
|     /** | 
|      * 新增或修改页面 | 
|      */        | 
|        @RequestMapping(value = "/addOrModify") | 
|        @RemoveRequestToken | 
|     public @ResponseBody AjaxResult addOrModify(SysSupplierType sysSupplierType) { | 
|            SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
|         if (sysSupplierType.getId() != null) { | 
|   | 
|             return modify(currentService, sysSupplierType, "往来单位类型"); | 
|         } else { | 
|             sysSupplierType.setShopId(sysUsers.getShopId()); | 
|             sysSupplierType.setCompanyId(sysUsers.getCompanyId()); | 
|             return add(currentService, sysSupplierType, "往来单位类型"); | 
|         } | 
|     } | 
|      | 
|        /** | 
|      * 进入修改界面 | 
|      */    | 
|        @RequestMapping(value = "/editForm") | 
|        @SaveRequestToken | 
|     public String editForm(Long id) { | 
|            SysSupplierType sysSupplierType; | 
|         if (id != null) { | 
|             sysSupplierType = currentService.findById(id); | 
|             WebUtil.getRequest().setAttribute("obj", sysSupplierType); | 
|         } | 
|         return "admin/hive/instore/suppliertype-form"; | 
|     } | 
|         | 
|         | 
|        /** | 
|      * 删除 | 
|      */   | 
|      @RequestMapping(value = "/del") | 
|     public @ResponseBody AjaxResult del(String keys) { | 
|   | 
|         return remove(currentService, keys); | 
|     } | 
|    | 
|       | 
| } |