首页>代码>SpringMVC+Spring+mybatis+mysql+jsp微信商城系统,有后台管理系统>/chihaodian/src/com/weixin/controller/ClickTextController.java
package com.weixin.controller; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.google.gson.Gson; import com.weixin.entity.ClickText; import com.weixin.service.ClickTextService; @Controller @RequestMapping("/main") public class ClickTextController { @Autowired private ClickTextService clickTextService ; private Map<String, Object> map = new HashMap<>(); Gson gson= new Gson(); @RequestMapping(value="/reply_add.html") public ModelAndView reply_add(ModelAndView ml){ ml.setViewName("main/clicktext/add"); return ml; } @ResponseBody @RequestMapping(value="/reply_insert.html") public String insert(ClickText clickText){ int rs = clickTextService.insertSelective(clickText); if(rs!=1){ map.put("message", "reply_insert.html is error"); } map.put("rs", rs); return gson.toJson(map); } @RequestMapping(value="/reply_list.html") public ModelAndView select(ModelAndView ml,ClickText clickText){ List<ClickText> list= clickTextService.select(clickText); ml.addObject("list",list); ml.setViewName("main/clicktext/list"); return ml; } @RequestMapping(value="/replyById.html") public ModelAndView selectById(ModelAndView ml,String ct_key){ // if(StringUtils.isNotEmpty(ct_key)){ // try { // ct_key = new String(ct_key.getBytes("iso8859-1"),"utf-8"); // } catch (UnsupportedEncodingException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } ClickText clickText = clickTextService.selectByPrimaryKey(ct_key); ml.addObject("clickText",clickText); ml.setViewName("main/clicktext/reply"); return ml; } @RequestMapping(value="/reply_byId.html") public ModelAndView listById(ModelAndView ml,String ct_key){ // if(StringUtils.isNotEmpty(ct_key)){ // try { // ct_key = new String(ct_key.getBytes("iso8859-1"),"utf-8"); // System.out.println(ct_key); // } catch (UnsupportedEncodingException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } ClickText clickText = clickTextService.selectByPrimaryKey(ct_key); ml.addObject("clickText",clickText); ml.setViewName("main/clicktext/info"); return ml; } @ResponseBody @RequestMapping(value="/reply_update.html") public String update(ClickText clickText){ int rs = clickTextService.updateByPrimaryKeySelective(clickText); if(rs!=1){ map.put("message", "reply_update.html is error"); } map.put("rs", rs); return gson.toJson(map); } @ResponseBody @RequestMapping(value="/reply_delete.html") public String delete(String ct_key){ // if(StringUtils.isNotEmpty(ct_key)){ // try { // ct_key = java.net.URLDecoder.decode(ct_key,"utf-8"); // System.out.println(ct_key); // // ct_key = new String(ct_key.getBytes("iso8859-1"),"utf-8"); // } catch (UnsupportedEncodingException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // // } int rs = clickTextService.deleteByPrimaryKey(ct_key); if(rs!=1){ map.put("message", "reply_delete.html is error"); } map.put("rs", rs); return gson.toJson(map); } }
最近下载更多
wuying8208 LV15
2023年9月4日
lvllvl LV4
2023年7月18日
tangyongheng08 LV6
2023年6月13日
lilonghui LV3
2023年5月17日
泓鼎168 LV19
2023年5月10日
jimodeai LV14
2023年4月4日
liangju666 LV6
2023年3月14日
liuhongbing123 LV5
2022年11月23日
PaymentCodeSystem LV11
2022年6月9日
jwz jwz LV13
2022年5月1日
最近浏览更多
玖零定制问题修复 LV34
4月4日
Gin19960217 LV4
3月18日
SZEPEZS LV8
3月12日
李朝磊 LV18
3月4日
ljhgff LV1
2月8日
i-caigou
1月18日
暂无贡献等级
微信网友_6786215447367680 LV4
2023年12月20日
2385649653 LV7
2023年12月12日
heqian LV16
2023年12月6日
lasttimeapp
2023年11月27日
暂无贡献等级