admin
2022-04-07 e1cc0d03fadc2d251d36c0dc3650f75e830d5363
app/src/main/java/com/yeshi/makemoney/app/controller/admin/goldcorn/GoldCornConsumeRecordAdminController.java
@@ -1,6 +1,7 @@
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;
@@ -15,9 +16,11 @@
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 {
@@ -26,10 +29,10 @@
    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>() {
@@ -49,8 +52,9 @@
    @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("");
@@ -61,7 +65,7 @@
    @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 {
@@ -70,7 +74,18 @@
        }
    }
    @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);
    }
}