parent
138aa70bb3
commit
4dd8a5d3f3
@ -0,0 +1,22 @@
|
||||
package com.backoffice.m.bf_bottle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.renastudio.creative.web.util.DataMap;
|
||||
|
||||
/**
|
||||
* @author renamaestro
|
||||
*/
|
||||
|
||||
public interface M_Bf_bottleBO {
|
||||
|
||||
public abstract int select_tbl_cart_check(DataMap paramMap) throws Exception;
|
||||
public abstract Object insert_tbl_cart(DataMap paramMap) throws Exception;
|
||||
public abstract int delete_tbl_cart_single(DataMap paramMap) throws Exception;
|
||||
|
||||
public abstract DataMap select_db_test_milk_input(DataMap paramMap) throws Exception;
|
||||
|
||||
|
||||
public abstract int select_db_test_milk_input_list_count(DataMap paramMap) throws Exception;
|
||||
public abstract List<DataMap> select_db_test_milk_input_list(DataMap paramMap) throws Exception;
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.backoffice.m.bf_bottle;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.renastudio.creative.web.util.AbstractBOManager;
|
||||
import com.renastudio.creative.web.util.DataMap;
|
||||
|
||||
/**
|
||||
* @author renamaestro
|
||||
*/
|
||||
|
||||
public class M_Bf_bottleBOImpl extends AbstractBOManager implements M_Bf_bottleBO {
|
||||
private static Log log = LogFactory.getLog(M_Bf_bottleBOImpl.class);
|
||||
|
||||
private final static String SQLMAP_NAMESPACE = "com.backoffice.m.bf_bottle.";
|
||||
|
||||
public Object insert_tbl_cart(DataMap paramMap) throws Exception{
|
||||
Object resultObj = null;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
generalDAO.startTransaction();
|
||||
|
||||
resultObj = generalDAO.insert("insert_tbl_cart", paramMap);
|
||||
|
||||
generalDAO.commitTransaction();
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}finally{
|
||||
generalDAO.endTransaction();
|
||||
}
|
||||
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
public int select_tbl_cart_check(DataMap paramMap) throws Exception{
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
result = generalDAO.select_item_to_number("select_tbl_cart_check", paramMap);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public int delete_tbl_cart_single(DataMap paramMap) throws Exception{
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
result = generalDAO.delete("delete_tbl_cart_single", paramMap);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public DataMap select_db_test_milk_input(DataMap paramMap) throws Exception{
|
||||
DataMap rm = null;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
rm = generalDAO.select_item_to_datamap("select_db_test_milk_input", paramMap);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return rm;
|
||||
}
|
||||
|
||||
public int select_db_test_milk_input_list_count(DataMap paramMap) throws Exception{
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
result = generalDAO.select_item_to_number("select_db_test_milk_input_list_count", paramMap);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataMap> select_db_test_milk_input_list(DataMap paramMap) throws Exception{
|
||||
List<DataMap> lm = null;
|
||||
|
||||
try {
|
||||
generalDAO.setNamespace(SQLMAP_NAMESPACE);
|
||||
lm = generalDAO.select_to_list("select_db_test_milk_input_list", paramMap);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return lm;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.backoffice.m.bf_bottle;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.backoffice.constants.ConstantCode;
|
||||
import com.backoffice.constants.ConstantResultCode;
|
||||
import com.backoffice.constants.ConstantSystem;
|
||||
import com.backoffice.m.util.M_Util;
|
||||
import com.renastudio.creative.web.util.AbstractControllerManager;
|
||||
import com.renastudio.creative.web.util.DataMap;
|
||||
import com.renastudio.creative.web.util.RenaStringUtil;
|
||||
|
||||
/**
|
||||
* @author renamaestro
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value="m/bf_bottle/*")
|
||||
public class M_Bf_bottleController extends AbstractControllerManager{
|
||||
private static Log log = LogFactory.getLog(M_Bf_bottleController.class);
|
||||
|
||||
private final String REQUEST_MAPPING = "m/bf_bottle/";
|
||||
|
||||
@Autowired M_Bf_bottleBO bf_bottleBO;
|
||||
|
||||
|
||||
// paging info
|
||||
int ROW_COUNT = 20;
|
||||
int PAGE_COUNT = 10;
|
||||
|
||||
M_Util gmUtil = new M_Util();
|
||||
|
||||
|
||||
@RequestMapping(value="ajax_insert_bottle", method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public HashMap<String, Object> ajax_insert_bottle(@ModelAttribute("model") ModelMap model, HttpServletRequest request, HttpServletResponse response
|
||||
, RedirectAttributes redirectAttributes) {
|
||||
DataMap paramMap = gmUtil.getDataMapFromRequest(request);
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("RESULT", ConstantResultCode.RESULT_INIT);
|
||||
|
||||
try {
|
||||
boolean is_login = gmUtil.setSessionForMobileMember(request, paramMap);
|
||||
if(is_login == false) {
|
||||
result.put("RESULT", ConstantResultCode.RESULT_SESSION_OUT);
|
||||
//int cart_check = bf_bottleBO.select_tbl_cart_check(paramMap);
|
||||
String res = String.valueOf(bf_bottleBO.insert_tbl_cart(paramMap));
|
||||
if(!RenaStringUtil.isNullOrEmpty(res))
|
||||
result.put("RESULT", 1);
|
||||
}
|
||||
} catch (Exception ex1) {
|
||||
ex1.printStackTrace();
|
||||
result.put("RESULT", ConstantResultCode.RESULT_EXCEPTION);
|
||||
result.put("msg", ex1.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="list_db_test_milk_input")
|
||||
public String list_db_test_milk_input(@ModelAttribute("model") ModelMap model, HttpServletRequest request, HttpServletResponse response
|
||||
, RedirectAttributes ra) {
|
||||
|
||||
DataMap paramMap = this.getDataMapFromRequest(request);
|
||||
|
||||
checkHeaderParam(AbstractControllerManager.CHECK_NORMAL, paramMap);
|
||||
|
||||
DataMap map_auth = check_auth(ConstantCode.AUTH_LIST, REQUEST_MAPPING, ConstantSystem.SESSION_CACHE_MENU, request);
|
||||
if(map_auth != null){
|
||||
model.addAttribute("map_auth", map_auth);
|
||||
|
||||
String redirect_url = "admin/bf/db_test_milk_input/list_db_test_milk_input";
|
||||
|
||||
if(ConstantCode.isAuth(map_auth, ConstantCode.AUTH_R) == false){
|
||||
redirect_url = "admin/view_no_auth";
|
||||
}else{
|
||||
|
||||
String check_sys_member_id = this.getSystemLoginId(request, ConstantSystem.SESSION_SYS_MEMBER, paramMap, ConstantSystem.SESSION_SYS_MEMBER);
|
||||
|
||||
if(RenaStringUtil.isNullOrEmpty(check_sys_member_id) == false){
|
||||
|
||||
try{
|
||||
if(RenaStringUtil.isNullOrEmpty(paramMap, "rowCount") == false) ROW_COUNT = RenaStringUtil.getDataToInt(paramMap, "rowCount");
|
||||
|
||||
int rowMax = bf_bottleBO.select_db_test_milk_input_list_count(paramMap);
|
||||
initPage(paramMap, ROW_COUNT, PAGE_COUNT, rowMax); // check page count
|
||||
|
||||
List<DataMap> lm = bf_bottleBO.select_db_test_milk_input_list(paramMap);
|
||||
DataMap.putToModel(model, "lm", lm);
|
||||
|
||||
}catch(Exception ex1){
|
||||
ex1.printStackTrace();
|
||||
|
||||
DataMap errorMap = new DataMap();
|
||||
String servletPath = request.getServletPath();
|
||||
errorMap.put("servletPath", servletPath);
|
||||
errorMap.put("paramMap", RenaStringUtil.getJSONFromMap(paramMap));
|
||||
errorMap.put("ERROR_MSG", "" + ex1);
|
||||
|
||||
this.redirectParam(ra, errorMap);
|
||||
redirect_url = "redirect:/admin/error/view_error.do";
|
||||
}
|
||||
}else{
|
||||
redirect_url = "admin/view_no_auth";
|
||||
}
|
||||
|
||||
this.redirectParam(model, paramMap);
|
||||
}
|
||||
|
||||
return redirect_url;
|
||||
}else{
|
||||
return "admin/view_no_auth";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue