1 Star 0 Fork 35

头皮屑 / nutz

forked from Wendal / nutz 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 4.89 KB
一键复制 编辑 原始数据 按行查看 历史
Wendal 提交于 2016-02-04 23:26 . ...

Nutz

Build Status Circle CI Coverity Scan Build Status Maven Central codecov.io GitHub release License

对于 Java 程序员来说,除 SSH 之外,的另一个选择

Talk is cheap. Show me the code!!

项目目标

在力所能及的情况下,最大限度的提高 Web 开发人员的生产力。

项目各种资源地址

现已通过 Oracle JDK 8、Oracle JDK 7、OpenJDK 7、OpenJDK 6下的 maven 测试,请查阅 Travis CI地址CircleCI地址

基于注解配置

MainModule主配置类

@SetupBy(value=MainSetup.class)
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
										   "*anno", "net.wendal.nutzbook",
										   "*quartz",
										   "*async",
										   "*tx"
										   })
@Modules(scanPackage=true)
@ChainBy(args="mvc/nutzbook-mvc-chain.js")
@Ok("json:full")
@Fail("jsp:jsp.500")
@Localization(value="msg/", defaultLocalizationKey="zh-CN")
@Views({BeetlViewMaker.class})
@SessionBy(ShiroSessionProvider.class)
public class MainModule {
}

入口方法

  @At
  @RequiresPermissions("user:delete")
  @Aop(TransAop.READ_COMMITTED)
  @Ok("json")
  public Object delete(@Param("id")int id) {
    int me = Toolkit.uid();
    if (me == id) {
      return new NutMap().setv("ok", false).setv("msg", "不能删除当前用户!!");
    }
    dao.delete(User.class, id); // 再严谨一些的话,需要判断是否为>0
    dao.clear(UserProfile.class, Cnd.where("userId", "=", me));
    return new NutMap().setv("ok", true);
  }

非MVC环境下的NutDao -- DaoUp类

// 初始化DaoUp类
DaoUp.me().init(("db.properties"));

Dao dao = DaoUp.me().dao();
dao.insert("t_user", Chain.make("id", 1).add("nm", "wendal").add("age", 30));
List<Record> users = dao.query("t_user", Cnd.where("age", "<", 25).desc("nm"));

List<User> girls = dao.count(User.class, Cnd.where("age", "<", 25).and("sex", "=", "female"));

// 程序结束前销毁
DaoUp.me().close();

Maven 资源

稳定发布版本

		<dependency>
			<groupId>org.nutz</groupId>
			<artifactId>nutz</artifactId>
			<version>1.r.54</version>
		</dependency>

快照版本在每次提交后会自动deploy到sonatype快照库,享受各种bug fix和新功能

	<repositories>
		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>org.nutz</groupId>
			<artifactId>nutz</artifactId>
			<version>1.r.55-SNAPSHOT</version>
		</dependency>
		<!-- 其他依赖 -->
	</dependencies>

也可以将repositories配置放入$HOME/.m2/settings.xml中

或者直接去快照库下载

Sponsorship

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

YourKit Logo

JetBrains IntelliJ IDEA

http://www.jetbrains.com

1
https://gitee.com/zhaoyunjie/nutz.git
git@gitee.com:zhaoyunjie/nutz.git
zhaoyunjie
nutz
nutz
master

搜索帮助