首页>代码>springMVC+Mybatis+Spring+Easyui+zTree+ueditor+highchart企业IT信息管理系统>/IT_M - 副本/src/com/gree/ssm/controller/BasedataController.java
001 | package com.gree.ssm.controller; |
002 |
003 | import java.util.HashMap; |
004 | import java.util.List; |
005 | import java.util.Map; |
006 |
007 | import javax.servlet.http.HttpServletRequest; |
008 | import javax.servlet.http.HttpServletResponse; |
009 |
010 | import org.springframework.beans.factory.annotation.Autowired; |
011 | import org.springframework.stereotype.Controller; |
012 | import org.springframework.ui.Model; |
013 | import org.springframework.web.bind.annotation.RequestMapping; |
014 | import org.springframework.web.bind.annotation.ResponseBody; |
015 |
016 | import com.github.pagehelper.PageInfo; |
017 | import com.gree.ssm.po.BaseDataCustom; |
018 | import com.gree.ssm.service.BaseDataService; |
019 | /** |
020 | * 下拉框、复选框、radio等基础数据 |
021 | * @author Administrator |
022 | * |
023 | */ |
024 | @Controller |
025 | @RequestMapping ( "/basedata" ) |
026 | public class BasedataController { |
027 | @Autowired |
028 | private BaseDataService basedataService; |
029 |
030 | /** |
031 | * 根据名称加载基础数据 |
032 | * |
033 | * @param request |
034 | * @param response |
035 | * @param dbName |
036 | * @return |
037 | * @throws Exception |
038 | */ |
039 | @RequestMapping ( "/loadByName" ) |
040 | public @ResponseBody |
041 | List<BaseDataCustom> loadByName(HttpServletRequest request, |
042 | HttpServletResponse response, String dataName) throws Exception { |
043 | List<BaseDataCustom> list = basedataService |
044 | .findBasedataListBydbName(dataName); |
045 | return list; |
046 | } |
047 |
048 | @RequestMapping ( "/opList" ) |
049 | public String opList(Model model, HttpServletRequest request, |
050 | HttpServletResponse response) throws Exception { |
051 | // 页面转发 |
052 | return "basedata" ; |
053 | } |
054 |
055 | /** |
056 | * 管理基础数据 |
057 | * |
058 | * @param request |
059 | * @param response |
060 | * @param dbName |
061 | * @param page |
062 | * @param rows |
063 | * @return |
064 | * @throws Exception |
065 | */ |
066 | @RequestMapping ( "/queryBasedata" ) |
067 | public @ResponseBody |
068 | Map<String, Object> queryBasedata(HttpServletRequest request, |
069 | HttpServletResponse response, String dbName, Integer page, |
070 | Integer rows) throws Exception { |
071 | Map<String, Object> re = new HashMap<String, Object>(); |
072 | PageInfo<BaseDataCustom> pageInfo = basedataService |
073 | .findBasedataListBydbNamePage(dbName, page, rows); |
074 | re.put( "total" , pageInfo.getTotal()); |
075 | re.put( "rows" , pageInfo.getList()); |
076 |
077 | return re; |
078 | } |
079 |
080 | /** |
081 | * 修改 |
082 | * |
083 | * @param request |
084 | * @param response |
085 | * @param BaseDataCustom |
086 | * @return |
087 | * @throws Exception |
088 | */ |
089 | @RequestMapping ( "/updateBasedata" ) |
090 | public @ResponseBody |
091 | Map<String, Object> updateBasedata(HttpServletRequest request, |
092 | HttpServletResponse response, BaseDataCustom baseDataCustom) |
093 | throws Exception { |
094 | Map<String, Object> re = new HashMap<String, Object>(); |
095 | boolean result = basedataService.update(baseDataCustom); |
096 | if (result) { |
097 | re.put( "success" , true ); |
098 | re.put( "msg" , "修改成功" ); |
099 | } else { |
100 | re.put( "success" , false ); |
101 | re.put( "msg" , "修改失败" ); |
102 | } |
103 | return re; |
104 | } |
105 |
106 | /** |
107 | * 添加 |
108 | * |
109 | * @param request |
110 | * @param response |
111 | * @param BaseDataCustom |
112 | * @return |
113 | * @throws Exception |
114 | */ |
115 | @RequestMapping ( "/addBaseData" ) |
116 | public @ResponseBody |
117 | Map<String, Object> addBaseData(HttpServletRequest request, |
118 | HttpServletResponse response, BaseDataCustom baseDataCustom) |
119 | throws Exception { |
120 | Map<String, Object> re = new HashMap<String, Object>(); |
121 | boolean result = basedataService.add(baseDataCustom); |
122 | if (result) { |
123 | re.put( "success" , true ); |
124 | re.put( "msg" , "添加成功" ); |
125 | } else { |
126 | re.put( "success" , false ); |
127 | re.put( "msg" , "添加失败" ); |
128 | } |
129 | return re; |
130 | } |
131 |
132 | /** |
133 | * 删除 |
134 | * |
135 | * @return |
136 | */ |
137 | @RequestMapping ( "/delete" ) |
138 | public @ResponseBody |
139 | Map<Object, Object> delete(Integer[] ids) { |
140 | Map<Object, Object> resMap = new HashMap<Object, Object>(); |
141 | boolean result = basedataService.deleteByIds(ids); |
142 | if (result) { |
143 | resMap.put( "success" , true ); |
144 | resMap.put( "msg" , "删除成功!" ); |
145 | } else { |
146 | resMap.put( "success" , false ); |
147 | resMap.put( "msg" , "删除失败!" ); |
148 | } |
149 | return resMap; |
150 | } |
151 | } |

zhaoyangwfd LV17
2022年1月20日
wanglinddad LV55
2022年1月19日
543666826 LV34
2021年11月18日
2231788897 LV6
2021年10月20日
lewis365 LV2
2021年8月22日
ericxu1116 LV24
2021年6月7日
幸运疯子 LV13
2021年5月16日
小屁孩 LV7
2021年4月11日
skipple3 LV39
2020年11月26日
ddqddqddq LV14
2020年9月5日

xiaohuaidan455 LV2
2月23日
xianyu091012 LV5
2024年12月26日
255921158 LV5
2024年12月20日
张春青 LV6
2024年11月14日
shaohuaqingfu LV3
2024年11月6日
唐唐丶 LV34
2024年9月12日
a801824 LV1
2024年7月4日
sunlea LV20
2024年6月23日
李俊雄 LV3
2024年5月8日
educationAAA LV11
2024年5月2日