conf.autoCodeTemplate.XController.tmp Maven / Gradle / Ivy
The newest version!
package {packageName}.action.autocode.{ClassName};
import com.mycomm.itool.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import {packageName}.action.base.BaseLogicController;
import {packageName}.beans.{ClassName};
import java.util.ArrayList;
import java.util.List;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
* @author jw362j
*/
@Controller
public class {ClassName}Controller extends BaseLogicController {
@ResponseBody
@RequestMapping("/{ControllerAddUpdate}")
public String {ClassName}ControllerAddUpdate({ClassName} instance) {
return AddUpdate(instance);
}
@ResponseBody
@RequestMapping("/{ControllerLoadById}")
public String {ClassName}ControllerLoadById({ClassName} instance) {
return LoadById(instance);
}
@ResponseBody
@RequestMapping("/{ControllerLoadByList}")
public String {ClassName}ControllerLoadByList({ClassName} instance) {
return LoadByList(instance.getClass(), instance.getStart(), instance.getLimit());
}
@ResponseBody
@RequestMapping("/{ControllerDelById}")
public String {ClassName}ControllerDelById({ClassName} instance) {
return DelById(instance);
}
@ResponseBody
@RequestMapping("/{ControllerDelByList}")
public String {ClassName}ControllerDelByList({ClassName} instance, @RequestParam("ids") String ids) {
if (ids == null) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("success", false);
jsonObj.put("errorMsg", "ids are null!");
return jsonObj.toString();
}
String[] theIds = ids.split(",");
if (theIds == null) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("success", false);
jsonObj.put("errorMsg", "theIds are null!");
return jsonObj.toString();
}
List targetIds_ = new ArrayList<>();
for (String theId : theIds) {
if (SystemUtil.isNumberString(theId)) {
targetIds_.add(Long.valueOf(theId));
}
}
long[] targetIds = new long[targetIds_.size()];
for (int i = 0; i < targetIds_.size(); i++) {
targetIds[i] = targetIds_.get(i);
}
return DelByList(instance.getClass(), targetIds);
}
}