14 Star 132 Fork 143

weiit / weiit-frame

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

JAVA极速开发框架[Weiit]

Weiit是基于Java语言的极速web开发框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。Weiit适用于快速开发,轻应用型的应用开发,大大降低开发人员投入与维护成本支出,是一款永久免费开源的Web开发框架。weiit-saas是完全开源电商SaaS系统,属于weiit开源的社区版,旧版框架已不在维护和更新,仅供学习和参考,新版saas从底层架构到前后端UI设计已经全面优化和升级,访问地址:https://www.wei-it.com/

框架应用案例-最新下载

一、框架主要特点

  • 基于Spring+SpringMVC+Mybstis主流开源框架,遵循MVC架构,设计轻巧,使用简单,拥有传统 SSH 框架的绝大部分核心功能,适用于快速开发;
  • 框架去实体化,请求参数进行统一拦截与处理,所有取值从FormMap 中获取;
  • 框架定义 Mapper/Service/Controller 方法标准,常规方法统一省略不写,开发人员只关注特殊业务的编写的原则;
  • 框架统一封装结果集 E 对象,即所有取值对象皆转化成E对象,从E对象中Get;
  • 框架统一封装第三方资源 支持包,支持阿里云、腾讯云、七牛云、容联云、快递鸟、百度等厂商。统一约定 工具类 的使用与标准,避免技术成员随意引用第三方工具类导致升级与维护成本增加;
  • 支持 模块化开发 ,可对常用功能进行模块成组件,方便热插式使用,如系统管理模块功能,可作为热插模块;
  • 支持快速开发 定时任务,可视化管理定时任务。
  • 支持微信小程序微信公众号微信开放平台微信支付快速集成与运用。
  • 支持全栈式开发前后端分离两种开发方式,分别采用Shiro与JWT进行校验框架。

二、客户案例

截止2020年,Weiit团队基于自身框架已经成功应用为300多家企业提供技术支持。Weiit团队还自身开源了一个产品项目,蜗店SAAS电商系统。

《蜗店》线上环境https://www.wstore.me

《蜗店》目前已下线,weiit新版saas升级版本环境演示: https://www.wei-it.com/

三、Maven仓库

必须依赖,框架核心支持:

 <dependency>
    <groupId>com.weiit</groupId>
    <artifactId>weiit-support-core</artifactId>
    <version>1.0.0</version>
</dependency>

需第三方支持与工具类,则引入,非必须依赖:

 <dependency>
    <groupId>com.weiit</groupId>
    <artifactId>weiit-resource-common</artifactId>
    <version>1.0.0</version>
</dependency>

如需定时任务是,则引入,非必须依赖:

 <dependency>
    <groupId>com.weiit</groupId>
    <artifactId>weiit-suppor-task</artifactId>
    <version>1.0.0</version>
</dependency>

如需系统管理模块,则引入,非必须依赖:

 <dependency>
    <groupId>com.weiit</groupId>
    <artifactId>weiit-business-system</artifactId>
    <version>1.0.0</version>
</dependency>

四、代码示例

Mapper层:

package com.weiit.web.admin.user.mapper;

import java.util.List;

import com.weiit.core.entity.FormMap;
import com.weiit.core.mapper.BaseMapper;

/**
 * 用户中心 mapper
 * @author 半个鼠标
 * @date 2017年8月15日 下午3:20:16
 * @version 1.0
 * @company http://www.wei-it.com
 */

public interface UserMapper extends BaseMapper {
    
    /**
     * 查询所有的会员积分信息
     * @param param 
     * @return 返回所有会员的积分信息
     */
    List selectUserIntergralList(FormMap formMap);

    /**
     * 查询所有的会员余额信息
     * @param param 
     * @return 返回所有会员的余额信息
     */
    List selectbalanceList(FormMap forMap);

    /**
     * 查询所有的会员地址信息
     * @param param 
     * @return 返回所有会员的地址信息
     */
    List selectAdressList(FormMap formMap);
	
   /**
     * 删除会员地址库
     * @param param 
     * @return 
     */
    int removeAddress(FormMap formMap);
	
   /**
     * 删除会员余额记录
     * @param param 
     * @return 
     */
    int removeBalanceLog(FormMap formMap);
	
   /**
     * 删除会员积分记录
     * @param param 
     * @return 
     */
    int removeIntegralLog(FormMap formMap);

}

Service层:

package com.weiit.web.admin.user.service;

import java.util.List;

import com.weiit.core.entity.FormMap;
import com.weiit.core.service.BaseService;

/**
 * 用户模块接口
 * @author 半个鼠标
 * @date 2017年8月15日 上午11:55:25
 * @version 1.0
 * @company http://www.wei-it.com 
 */
public interface UserService extends BaseService{

	List selectUserIntergralList(FormMap formMap);

	List selectbalanceList(FormMap forMap);
	
	List selectAdressList(FormMap formMap);
	
	void removeTrans(FormMap formMap);
}

Service实现层:

package com.weiit.web.admin.user.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.weiit.core.entity.FormMap;
import com.weiit.core.mapper.BaseMapper;
import com.weiit.core.service.impl.AbstractService;
import com.weiit.web.admin.user.mapper.UserMapper;
import com.weiit.web.admin.user.service.UserService;

/**
 * 会员模块接口实现接口
 * @author 半个鼠标
 * @date 2017年8月15日 下午3:23:04
 * @version 1.0
 * @company http://www.wei-it.com
 */
@Service
@Transactional(readOnly=false)
public class UserServiceImpl extends AbstractService implements UserService {

	@Resource
	private UserMapper userMapper;

	@Override
	public BaseMapper setMapper() {
		return userMapper;
	}

	/**
	 * 查询会员积分
	 */
	@Override
	public List selectUserIntergralList(FormMap formMap) {
		return userMapper.selectUserIntergralList(formMap);
	}

	/**
	 * 查询会员余额
	 */
	@Override
	public List selectbalanceList(FormMap forMap) {
		return userMapper.selectbalanceList(forMap);
	}

	/**
	 * 查询会员地址
	 */
	@Override
	public List selectAdressList(FormMap formMap) {
		return userMapper.selectAdressList(formMap);
	}

	/**
	 * 会员删除 (事务管理) 1、删除积分记录。2、删除余额记录。3、删除收货地址。4、删除会员信息
	 */
	@Override
	@Transactional(readOnly=false,propagation=Propagation.REQUIRED,rollbackFor=Exception.class)//事务可写,记住方法中不能捕获异常,捕获异常不会回滚事务,trycatch也不能用
	public void removeTrans(FormMap formMap) {
		//1、先删除积分记录
		userMapper.removeIntegralLog(formMap);
		//2、删除余额记录
		userMapper.removeBalanceLog(formMap);
		//3、删除会员收货地址
		userMapper.removeAddress(formMap);
		//4、删除会员
		userMapper.remove(formMap);
	}
	
	
}

控制层(全栈式开发):

package com.weiit.web.admin.user.controller;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.weiit.core.entity.E;
import com.weiit.core.entity.FormMap;
import com.weiit.support.common.utils.WeiitUtil;
import com.weiit.web.admin.user.service.UserService;
import com.weiit.web.base.AdminController;
import com.weiit.web.base.Message;

/**
 * 后台管理 》会员模块 
 * @author 半个鼠标
 * @date:2017年8月15日 下午3:20:56
 * @version 1.0
 * @company http://www.wei-it.com
 */

@Controller
@RequestMapping("/user")
public class UserController extends AdminController {
	
	public static Logger logger = Logger.getLogger(UserController.class);
	
	@Resource
	private UserService userService;
	
	private String page_list = "/center/user/userList";
	
	private String page_intergral = "/center/user/userIntergral";
	
	private String redirect_list = "redirect:userList";
	
	private String page_balance = "/center/user/userBalance";
	
	private String page_adress = "/center/user/userAdress";

	/**
	 * 会员管理》查询用户列表
	 */
	@RequestMapping("/userList")
	public ModelAndView userList() {
		logger.info("进入UserController-user_list,会员列表展示");
		
		ModelAndView result = UIView(page_list);
		FormMap formMap = getFormMap();
		// 开启分页
		PageHelper.startPage(formMap.getPage(), formMap.getRows());
		List userslist = userService.selectList(formMap);
		result.addObject("pageInfo", new PageInfo<E>(userslist));
		result.addObject("queryParam", formMap);
		return result;

	}

	/**
	 * 会员管理》刪除会员
	 */
	@RequestMapping("/remove")
	public ModelAndView remove() {
		logger.info("进入UserController-remove,会员删除");
		
		ModelAndView result = UIView(redirect_list, Message.DANGER);
		FormMap formMap = getFormMap();
		//用户删除【事务】
		userService.removeTrans(formMap);
		return result;
	}

	/**
	 * 会员管理》添加会员
	 */
	@RequestMapping("/save")
	public ModelAndView save() {
		logger.info("进入UserController-save,添加会员");
		
		ModelAndView result = UIView(redirect_list, Message.INFO);
		FormMap formMap = getFormMap();
		if (StringUtils.isEmpty(formMap.getStr("user_id"))) {
			userService.insert(formMap);
		} else {
			userService.edit(formMap);
		}
		return result;
	}

	/**
	 * 会员管理》根据id查询会员
	 */

	@ResponseBody
	@RequestMapping("/view")
	public String view() {
		logger.info("进入UserController-view,根据id查询会员");
		
		FormMap formMap = getFormMap();
		E e = userService.selectOne(formMap);
		return toJsonAPI(e);
	}

	/**
	 * 会员管理》查询用户积分
	 */
	@RequestMapping("/userIntergral")
	public ModelAndView userIntergral() {
		logger.info("进入UserController-user_intergralList,会员积分查询");
		
		ModelAndView result = UIView(page_intergral);
		FormMap formMap = getFormMap();
		// 开启分页
		PageHelper.startPage(formMap.getPage(), formMap.getRows());
		List intergrallist = userService.selectUserIntergralList(formMap);
		result.addObject("pageInfo", new PageInfo<E>(intergrallist));
		result.addObject("queryParam", formMap);
		return result;
	}

	/**
	 * 会员管理》查询用户余额
	 */
	@RequestMapping("/userBalance")
	public ModelAndView userBalance() {
		logger.info("进入UserController-user_balanceList,会员余额展示");
		
		FormMap forMap = getFormMap();
		List balancelist = userService.selectbalanceList(forMap);
		ModelAndView result = UIView(page_balance);
		result.addObject("pageInfo", new PageInfo<E>(balancelist));
		result.addObject("queryParam", forMap);
		return result;
	}

	/**
	 *会员管理》查询会员地址
	 */
	@RequestMapping("/userAddress")
	public ModelAndView userAddress() {
		logger.info("进入UserController-useradressList,会员地址展示");
		
		ModelAndView result = UIView(page_adress);
		FormMap formMap = getFormMap();
		// 开启分页
		PageHelper.startPage(formMap.getPage(), formMap.getRows());
		List adresslist = userService.selectAdressList(formMap);
		result.addObject("pageInfo", new PageInfo<E>(adresslist));
		result.addObject("queryParam", formMap);
		return result;
	}

	/**
	 * 会员管理》批量删除会员
	 * */
	@RequestMapping(value="/removeBatch")
	public ModelAndView removeBatch(){
		logger.info("进入UserController-deleteBatch,批量删除会员");
		
		ModelAndView result = UIView(redirect_list, Message.INFO);
		FormMap formMap=getFormMap();
		String[] validate_id=formMap.getAttrNames("validate_id");//
		String validate_ids=WeiitUtil.arrayToString(validate_id);
		formMap.set("validate_ids", validate_ids);
		userService.removeBatch(formMap);
		return result;
	} 

}

控制层(前后端分离开发):

package com.weiit.web.admin.user.controller;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.weiit.core.entity.E;
import com.weiit.core.entity.FormMap;
import com.weiit.support.common.utils.WeiitUtil;
import com.weiit.web.admin.user.service.UserService;
import com.weiit.web.base.AdminController;
import com.weiit.web.base.Message;

/**
 * 会员相关接口 
 * @author 半个鼠标
 * @date:2017年8月15日 下午3:20:56
 * @version 1.0
 * @company http://www.wei-it.com
 */

@Controller
@RequestMapping("/user")
public class UserController extends AdminController {
	
	public static Logger logger = Logger.getLogger(UserController.class);
	
	

	/**
	 * 查询用户接口
	 */
	@RequestMapping("/getUserInfo")
	public String getUserList() {
	    logger.info("进入UserController-getUserInfo,查询用户信息");
		
	      //判断用户token真实的,重新查询用户信息出来
               if (formMap.get("user_id") != null) {
                    E userInfo = userService.userInfo(formMap);
                    return toJsonAPI(userInfo);
                } else {
                    return toJsonAPI(ApiResponseCode.TOKEN_INVALID);
               }

	}

	

}

更多支持

weiit开源支持

avatar

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

Weiit是基于Java语言的极速web开发框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。Weiit适用于快速开发,轻应用型的应用开发,大大降低开发人员投入与维护成本支出,是一款永久免费开源的Web开发框架。 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/wei-it/weiit-frame.git
git@gitee.com:wei-it/weiit-frame.git
wei-it
weiit-frame
weiit-frame
main

搜索帮助