| package com.matrix.system.hive.action; | 
|   | 
| import com.matrix.core.anotations.RemoveRequestToken; | 
| import com.matrix.core.anotations.SaveRequestToken; | 
| import com.matrix.core.pojo.AjaxResult; | 
| import com.matrix.system.hive.action.util.QueryUtil; | 
| import com.matrix.system.hive.bean.SysProjType; | 
| import com.matrix.system.hive.service.SysProjTypeService; | 
| 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; | 
|   | 
|   | 
| /** | 
|  * @description 项目类型管理 | 
|  * @author jyy | 
|  * @email 820786562@qqcom | 
|  * @date 2016-07-14 | 
|  */ | 
| @Controller | 
| @RequestMapping(value = "/admin/projtype") | 
| public class ProjTypeController extends BaseController { | 
|   | 
|    @Resource | 
|    private SysProjTypeService currentService; | 
|      | 
|     public static final String fnCode = "projType"; | 
|     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"; | 
|    @RequestMapping(value = "/all") | 
|    public @ResponseBody | 
|    AjaxResult all(SysProjType sysProjType) { | 
|        QueryUtil.setQueryLimit(sysProjType); | 
|        return new AjaxResult(AjaxResult.STATUS_SUCCESS,    currentService.findByModel(sysProjType), 0); | 
|    } | 
|     | 
|    /** | 
|     * 新增或修改页面 | 
|     */        | 
|        @RequestMapping(value = "/addOrModify") | 
|        @RemoveRequestToken | 
|    public @ResponseBody AjaxResult addOrModify(SysProjType sysProjType) { | 
|        if (sysProjType.getId() != null) { | 
|   | 
|            return modify(currentService, sysProjType, "项目"); | 
|        } else { | 
|            QueryUtil.setQueryLimit(sysProjType); | 
|            return add(currentService, sysProjType, "项目"); | 
|        } | 
|    } | 
|         | 
|   | 
|    @RequestMapping(value = "/editForm") | 
|    @SaveRequestToken | 
|    public String editForm(Long id, HttpServletRequest request) { | 
|        SysProjType sysProjType; | 
|        if (id != null) { | 
|            sysProjType = currentService.findById(id); | 
|            request.setAttribute("obj", sysProjType); | 
|        } | 
|        return "admin/hive/products/projtype-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) { | 
|        SysProjType sysProjType = findById(currentService, id); | 
|        return new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(sysProjType), 0); | 
|    } | 
|   | 
| } |