我们的信息系统主要技术包括:js+jquery+jsp+bootstrap+json+mybatis+springmvc+spring+myql,我主要负责后台的设计部分!
后台代码框架结构:
com.goodtaste.constantField:记录了系统用到的一些常量
com.goodtaste.controller:springmvc的controller层,用于和前台数据的交互
com.goodtaste.dao:封装了一些操作数据库的SQL语句【这也是我当初用这个框架的原因:学习一下SQL语句】
com.goodtaste.filter:这里面我定义了两个类:1、用户登录拦截;2、系统缓存框架
com.goodtaste.modle,pojo:封装了一些简单的JavaBean
com.goodtaste.service:封装dao层的方法,用户业务处理,但是在实际操作的时候,我把业务处理放在了controller层,算是一个设计上的失败吧。
com.goodtaste.util:工具类,系统用到的一些公有操作!
部分代码展示:
@Controller public class OrderController extends BaseController { private HttpSession session = null; private RecordSystemLogController recordSystemLog = new RecordSystemLogController(); @Resource(name = "UserService") private IUserService userService; public IUserService getUserService() { return userService; } public void setUserService(IUserService userService) { this.userService = userService; } @Resource(name = "OrderService") private IOrderService orderService; public IOrderService getOrderService() { return orderService; } public void setOrderService(IOrderService orderService) { this.orderService = orderService; } @Resource(name = "DishesService") private IDishesService dishesService; public IDishesService getDishesService() { return dishesService; } public void setDishesService(IDishesService dishesService) { this.dishesService = dishesService; } @Resource(name = "MenuCspService") private IMenuCspService menuCspService; public IMenuCspService getMenuCspService() { return menuCspService; } public void setMenuCspService(IMenuCspService menuCspService) { this.menuCspService = menuCspService; } @Resource(name = "PermissionService") private IPermissionService permissionService; public IPermissionService getPermissionService() { return permissionService; } public void setPermissionService(IPermissionService permissionService) { this.permissionService = permissionService; } /** * * @Title: AccountDishes * @Description: TODO 结账 void 返回类型 * @throws */ @RequestMapping("/AccountDishes.do") public void AccountDishes( @RequestParam(value = ConstantFiled.ORDERID) String orderId, HttpServletResponse response) { try { boolean flag = false; String result = null; Map<String, Object> map_data = getMap(); Order data_order = this.getOrderService().getOrder(orderId); if (data_order == null) { result = "结账失败,没有这个订单!"; flag = false; } else { if (data_order.getAccountTime() != null) { result = "该订单已经结账"; flag = false; } else { Order order = new Order(); order.setAccountTime(Calendar.getInstance().getTime()); order.setOrderId(orderId); flag = this.getOrderService().AccountDishes(order); if (flag) { result = "结账成功"; } else { result = "结账失败"; } } } map_data.put(ConstantFiled.RESULT, result); ResponseData.handleReauestData(flag, map_data, getData(), getObjectMapper(), response); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } public interface OrderMapper { public void addOrder(Order order); public List<Order> getOrder(String orderId); public List<Order> getOrdersByOrdersParams(OrderParams orderParams); public List<Order> getAllOrdersByOrdersParams(OrderParams orderParams); public void AccountDishes(Order order); public List<Order> getAllOrdersByDateTime(String dateTime); }
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.goodtaste.dao.OrderMapper"> <insert id="addOrder" parameterType="Order"> insert into user_order_table(orderId,tableNum,orderTime,accountTime,consmNums,totalPrice) values(#{orderId},#{tableNum},#{orderTime},#{accountTime},#{consmNums},#{totalPrice}); </insert> <select id="getOrder" parameterType="String" resultType="Order"> select * from user_order_table where orderId=#{orderId}; </select> <select id="getOrdersByOrdersParams" parameterType="OrderParams" resultType="Order"> select * from user_order_table <where> <if test="tableNum !=null and tableNum !=''"> tableNum like #{tableNum} </if> <if test="accountTime !=null and accountTime !=''"> and accountTime is not null </if> <if test="accountTime ==null or accountTime ==''"> and accountTime is null </if> <if test="orderTime1 !=null and orderTime1 !='' and orderTime2 !=null and orderTime2 !=''"> and orderTime between #{orderTime1} and #{orderTime2} </if> <if test="totalPrice1 !=null and totalPrice1 !='' and totalPrice2 !=null and totalPrice2 !=''"> and totalPrice between #{totalPrice1} and #{totalPrice2} </if> </where> order by orderTime desc limit #{pageNum},#{pageSize}; </select> <select id="getAllOrdersByOrdersParams" parameterType="OrderParams" resultType="Order"> select * from user_order_table <where> <if test="tableNum !=null and tableNum !=''"> tableNum like #{tableNum} </if> <if test="accountTime !=null and accountTime !=''"> and accountTime is not null </if> <if test="accountTime ==null or accountTime ==''"> and accountTime is null </if> <if test="orderTime1 !=null and orderTime1 !='' and orderTime2 !=null and orderTime2 !=''"> and orderTime between #{orderTime1} and #{orderTime2} </if> <if test="totalPrice1 !=null and totalPrice1 !='' and totalPrice2 !=null and totalPrice2 !=''"> and totalPrice between #{totalPrice1} and #{totalPrice2} </if> </where> order by orderTime desc; </select> <update id="AccountDishes" parameterType="Order"> update user_order_table set accountTime=#{accountTime} where orderId=#{orderId}; </update> <select id="getAllOrdersByDateTime" parameterType="String" resultType="Order"> select * from user_order_table where orderTime like #{dateTime}; </select> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd"> <context:component-scan base-package="com.*" /> <context:annotation-config/> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${jdbc.driverClass}"/> <property name="jdbcUrl" value="${jdbc.jdbcUrl}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="minPoolSize" value="5"/> <property name="maxPoolSize" value="50"/> <property name="maxIdleTime" value="1800"/> <property name="acquireIncrement" value="2"/> <property name="maxStatements" value="0"/> <property name="initialPoolSize" value="10"/> <property name="idleConnectionTestPeriod" value="30"/> <property name="acquireRetryAttempts" value="30"/> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="configLocation" value="classpath:configuration.xml"></property> <property name="dataSource" ref="dataSource" /> </bean> <import resource="applicationContext-*.xml"/> <import resource="configuration.xml"/> </beans>
<cache name="SimplePageCachingFilter" maxElementsInMemory="10000" eternal="false" overflowToDisk="false" timeToIdleSeconds="900" timeToLiveSeconds="1800" memoryStoreEvictionPolicy="LFU" />
页面包括:管理页面 和 前台展示! http://my.oschina.net/tdd/blog/368322
总结:
记得昨天答辩的时候,有一组个人感觉很好! 实现了很多的高级特性好功能!【在线预览文档,邮件发送和自动接收,调用各种浏览器搜索...】 只能说自己还需要努力吧!