| package com.matrix.system.hive.action; | 
|   | 
| import com.matrix.core.anotations.RemoveRequestToken; | 
| import com.matrix.core.anotations.SaveRequestToken; | 
| import com.matrix.core.constance.MatrixConstance; | 
| import com.matrix.core.pojo.AjaxResult; | 
| import com.matrix.core.pojo.PaginationVO; | 
| import com.matrix.core.tools.WebUtil; | 
| import com.matrix.system.common.bean.SysUsers; | 
| import com.matrix.system.constance.Dictionary; | 
| import com.matrix.system.hive.action.util.QueryUtil; | 
| import com.matrix.system.hive.bean.SysShopInfo; | 
| import com.matrix.system.hive.service.SysShopInfoService; | 
| import org.springframework.stereotype.Controller; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.ResponseBody; | 
|   | 
| import javax.annotation.Resource; | 
| import javax.servlet.http.HttpServletRequest; | 
| import java.util.Arrays; | 
|   | 
| /** | 
|  *  | 
|  * 店铺管理 | 
|  *  | 
|  * @time 2016-07-15 | 
|  * @author 姜友瑶 | 
|  */ | 
| @Controller | 
| @RequestMapping(value = "admin/shopInfo") | 
| public class ShopInfoController extends BaseController { | 
|   | 
|     @Resource | 
|     private SysShopInfoService currentService; // 店铺Service | 
|   | 
|   | 
|      | 
|      | 
|      | 
|     //记录编辑前的值Before_Edit_Value | 
|     public static final String BEV="ShopInfo_BEV"; | 
|      | 
|     public static final String fnCode = "shopInfo"; | 
|     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 shopInfo | 
|      * @param pageVo | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/showList") | 
|     public @ResponseBody | 
|     AjaxResult showShopInfoList(SysShopInfo shopInfo, PaginationVO pageVo) { | 
|   | 
|         return showList(currentService, shopInfo, pageVo); | 
|     } | 
|   | 
|      | 
|   | 
|     @RequestMapping(value = "/addOrModify") | 
|     @RemoveRequestToken | 
|     public @ResponseBody AjaxResult addOrModify(SysShopInfo shopInfo) { | 
|         if (shopInfo.getId() != null) { | 
|   | 
|             return modify(currentService, shopInfo, "门店"); | 
|         } else { | 
|   | 
|             return add(currentService, shopInfo, "门店"); | 
|         } | 
|     } | 
|   | 
|     @RequestMapping(value = "/del") | 
|     public @ResponseBody AjaxResult del(String keys) { | 
|   | 
|         return remove(currentService, keys); | 
|     } | 
|   | 
|     @RequestMapping(value = "/editForm") | 
|     @SaveRequestToken | 
|     public String editForm(Long id, HttpServletRequest request) { | 
|         SysShopInfo shopInfo; | 
|         if (id != null) { | 
|             shopInfo = currentService.findById(id); | 
|             request.setAttribute("obj", shopInfo); | 
|         } | 
|         return "admin/hive/orgment/shopInfo-form"; | 
|     } | 
|   | 
|      | 
|      | 
|      | 
|     /** | 
|      * ======================================================= | 
|      * *******************公共的数据访问方法******************** | 
|      * ======================================================= | 
|      */ | 
|   | 
|     /** | 
|      *  | 
|      * @author jiangyouyao | 
|      */ | 
|     @RequestMapping(value = "/findAll" ) | 
|     public @ResponseBody AjaxResult findAll(SysShopInfo shopInfo) { | 
|         QueryUtil.setQueryLimitCom(shopInfo); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS, currentService.findByModel(shopInfo), null); | 
|     } | 
|     /** | 
|      * 查询非总店 商城店铺的门店 | 
|      * TODO 微商城不应该调用这里的接口 | 
|      * @author jiangyouyao | 
|      */ | 
|     @RequestMapping(value = "/findShops" ) | 
|     public @ResponseBody AjaxResult findShops() { | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS, currentService.findShopInfos(getMe().getCompanyId()), null); | 
|     } | 
|      | 
|   | 
|     /** | 
|      * 查询当前登录用户所在门店信息 | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/findUserShop" ) | 
|     public @ResponseBody AjaxResult findUserShop() { | 
|         SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS, | 
|                 Arrays.asList(currentService.findById(user.getShopId())), null); | 
|     } | 
|   | 
|   | 
|   | 
| } |