admin
2021-10-14 932777e9d6dc8dc5d9edbfc9117639ae02d96956
src/main/resources/generater/admin/adminController.template
@@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.TimeUtil;
import com.google.gson.reflect.TypeToken;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
@@ -20,7 +21,7 @@
@Controller
@RequestMapping("${mapping}")
public class AdminAppController {
public class ${controllerName} {
    <#assign serviceObjName="${service.name?uncap_first}">
    <#assign entityObjName="${entity.name?uncap_first}">
@@ -58,8 +59,8 @@
    @ResponseBody
    @RequestMapping("delete")
    public String delete(String ids, String callback) {
        Type type = new TypeToken<List<${identifyIdType}>>(){}.get();
        List<${identifyIdType}> idList=new Gson().from(ids,type);
        Type type = new TypeToken<List<${identifyIdType}>>(){}.getType();
        List<${identifyIdType}> idList=new Gson().fromJson(ids,type);
        ${serviceObjName}.delete(idList);
        return loadPrint(callback, JsonUtil.loadTrueResult(""));
    }
@@ -71,7 +72,7 @@
            ${serviceObjName}.add(bean);
            return loadPrint(callback, JsonUtil.loadTrueResult(""));
        }catch(Exception e){
            return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage));
            return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage()));
        }
    }
@@ -94,9 +95,9 @@
            return loadPrint(callback, JsonUtil.loadFalseResult("ID不能为空"));
        }
        try{
            ${serviceObjName}.updateSelective(bean);
            ${serviceObjName}.update(bean);
        }catch(Exception e){
            return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage));
            return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage()));
        }
        return loadPrint(callback,JsonUtil.loadTrueResult(""));
    }