| | |
| | | package com.yeshi.makemoney.app.controller.admin.goldcorn; |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornConsumeRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/goldcorn/consume/record") |
| | | public class GoldCornConsumeRecordAdminController { |
| | |
| | | private GoldCornConsumeRecordService goldCornConsumeRecordService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @ResponseBody |
| | | @RequestMapping("list") |
| | | public String list(GoldCornConsumeRecordQuery query, int page, int limit ) { |
| | | List<GoldCornConsumeRecord> list = goldCornConsumeRecordService.list(query,page,limit); |
| | | public String list(GoldCornConsumeRecordQuery query, int page, int limit) { |
| | | List<GoldCornConsumeRecord> list = goldCornConsumeRecordService.list(query, page, limit); |
| | | long count = goldCornConsumeRecordService.count(query); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(String ids) { |
| | | Type type = new TypeToken<List<String>>(){}.getType(); |
| | | List<String> idList=new Gson().fromJson(ids,type); |
| | | Type type = new TypeToken<List<String>>() { |
| | | }.getType(); |
| | | List<String> idList = new Gson().fromJson(ids, type); |
| | | goldCornConsumeRecordService.delete(idList); |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | |
| | | @RequestMapping("get") |
| | | public String get(String id, HttpSession session) { |
| | | GoldCornConsumeRecord entity = goldCornConsumeRecordService.get(id); |
| | | if (entity !=null){ |
| | | if (entity != null) { |
| | | return JsonUtil.loadTrueResult(entity); |
| | | |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getTypeList") |
| | | public String getTypeList(String id, HttpSession session) { |
| | | JSONArray array = new JSONArray(); |
| | | for (GoldCornConsumeType type : GoldCornConsumeType.values()) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("key", type.name()); |
| | | data.put("value", type.getName()); |
| | | array.add(data); |
| | | } |
| | | return JsonUtil.loadTrueResult(array); |
| | | } |
| | | |
| | | |
| | | } |