diff --git a/pom.xml b/pom.xml index d9641c2e..f2215f28 100644 --- a/pom.xml +++ b/pom.xml @@ -209,27 +209,6 @@ http://maven.aliyun.com/nexus/content/groups/public - - - - - - development - - dev - - - true - - - - - production - - production - - - blade @@ -263,4 +242,25 @@ + + + + + + development + + dev + + + true + + + + + production + + production + + + \ No newline at end of file diff --git a/src/main/conf/production/log4j2.xml b/src/main/conf/production/log4j2.xml index 8adcbb6f..2ed5ac81 100644 --- a/src/main/conf/production/log4j2.xml +++ b/src/main/conf/production/log4j2.xml @@ -3,7 +3,7 @@ ${sys:catalina.base}/logs/springblade - 100M + 10M diff --git a/src/test/java/com/smallchill/test/example/excel/ExampleExcel.java b/src/test/java/com/smallchill/test/ExcelTest.java similarity index 92% rename from src/test/java/com/smallchill/test/example/excel/ExampleExcel.java rename to src/test/java/com/smallchill/test/ExcelTest.java index d214656f..042931d0 100644 --- a/src/test/java/com/smallchill/test/example/excel/ExampleExcel.java +++ b/src/test/java/com/smallchill/test/ExcelTest.java @@ -1,52 +1,52 @@ -package com.smallchill.test.example.excel; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; -import org.jeecgframework.poi.excel.entity.vo.MapExcelConstants; -import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.smallchill.core.base.controller.BladeController; - -public class ExampleExcel extends BladeController { - - /** - * excel视图方式 - */ - @RequestMapping("/export") - public String exportMerchantProfitQuery(ModelMap modelMap, - HttpServletResponse response) { - List entityList = new ArrayList(); - entityList.add(new ExcelExportEntity("商户名称", "merchantName", 35)); - entityList.add(new ExcelExportEntity("商户号", "merchantId", 15)); - entityList.add(new ExcelExportEntity("商户类型", "merchantType", 15)); - entityList.add(new ExcelExportEntity("联系人", "userName", 15)); - entityList.add(new ExcelExportEntity("总分润", "allProfit", 15)); - List> dataResult = new ArrayList>(); - Map map; - for (int i = 0; i < 10; i++) { - map = new HashMap(); - map.put("merchantName", "1" + i); - map.put("merchantId", "2" + i); - map.put("merchantType", "大中华"); - map.put("userName", "abc" + i); - map.put("allProfit", "def" + i); - dataResult.add(map); - } - - modelMap.put(MapExcelConstants.ENTITY_LIST, entityList); - modelMap.put(MapExcelConstants.MAP_LIST, dataResult); - modelMap.put(MapExcelConstants.FILE_NAME, "商户利润"); - modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("商户利润详情", "商户")); - return MapExcelConstants.JEECG_MAP_EXCEL_VIEW; - } - -} +package com.smallchill.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; +import org.jeecgframework.poi.excel.entity.vo.MapExcelConstants; +import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.smallchill.core.base.controller.BladeController; + +public class ExcelTest extends BladeController { + + /** + * excel视图方式 + */ + @RequestMapping("/export") + public String exportMerchantProfitQuery(ModelMap modelMap, + HttpServletResponse response) { + List entityList = new ArrayList(); + entityList.add(new ExcelExportEntity("商户名称", "merchantName", 35)); + entityList.add(new ExcelExportEntity("商户号", "merchantId", 15)); + entityList.add(new ExcelExportEntity("商户类型", "merchantType", 15)); + entityList.add(new ExcelExportEntity("联系人", "userName", 15)); + entityList.add(new ExcelExportEntity("总分润", "allProfit", 15)); + List> dataResult = new ArrayList>(); + Map map; + for (int i = 0; i < 10; i++) { + map = new HashMap(); + map.put("merchantName", "1" + i); + map.put("merchantId", "2" + i); + map.put("merchantType", "大中华"); + map.put("userName", "abc" + i); + map.put("allProfit", "def" + i); + dataResult.add(map); + } + + modelMap.put(MapExcelConstants.ENTITY_LIST, entityList); + modelMap.put(MapExcelConstants.MAP_LIST, dataResult); + modelMap.put(MapExcelConstants.FILE_NAME, "商户利润"); + modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("商户利润详情", "商户")); + return MapExcelConstants.JEECG_MAP_EXCEL_VIEW; + } + +} diff --git a/src/test/java/com/smallchill/test/example/dao/ExampleBlade.java b/src/test/java/com/smallchill/test/example/dao/ExampleBlade.java deleted file mode 100644 index fd7a2ff7..00000000 --- a/src/test/java/com/smallchill/test/example/dao/ExampleBlade.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.smallchill.test.example.dao; - -import java.util.List; - -import com.smallchill.core.base.controller.BladeController; -import com.smallchill.core.plugins.dao.Blade; -import com.smallchill.core.toolbox.Paras; -import com.smallchill.platform.model.Notice; - -/** - * javabean模块 - * - */ -public class ExampleBlade extends BladeController{ - - public void one(){ - Blade dao = Blade.create(Notice.class); - //根据主键值查询一条数据 - Notice notice = dao.findById(getParameter("id")); - System.out.println(notice); - } - - public void more(){ - Blade dao = Blade.create(Notice.class); - //指定表名、查询条件查询多条数据 - List list = dao.findBy("tb_tfw_tzgg", "f_it_xl = #{xl},f_it_cjr = #{cjr}", Paras.create().set("xl", 1).set("cjr", 1)); - System.out.println(list); - } - - public void other(){ - Blade dao = Blade.create(Notice.class); - //指定表名、查询条件查询多条数据(完整sql) - List list = dao.find("select * from tb_tfw_tzgg where f_it_xl = #{xl} and f_it_cjr = #{cjr}", Paras.create().set("xl", 1).set("cjr", 1)); - System.out.println(list); - } - - public void save(){ - Blade dao = Blade.create(Notice.class); - //自动映射前缀为notice.xx类型的数据 - //uri : /notice/save?notice.f_vc_bt=123¬ice.f_dt_cjsj=2016-02-02¬ice.f_it_cjr=1 - Notice notice = mapping("notice", Notice.class); - //根据model新增 - int id = dao.saveRtId(notice); - //新增成功后自动返回id - System.out.println(id); - } - - public void update(){ - Blade dao = Blade.create(Notice.class); - //自动映射前缀为notice.xx类型的数据 - Notice notice = mapping("notice", Notice.class); - //根据model修改 - dao.update(notice); - } - - public void remove(){ - Blade dao = Blade.create(Notice.class); - //指定表名、字段名根据传入的集合删除多条数据 - dao.deleteByIds("1,2,3,4,5"); - } - - public void count(){ - Blade dao = Blade.create(Notice.class); - Notice notice = new Notice(); - notice.setF_vc_bt("this is title"); - //查询出tb_tfw_tzgg表所有f_vc_bt字段值为"this is title"的总数 - dao.count(notice); - } - - public void countBy(){ - Blade dao = Blade.create(Notice.class); - //查询出tb_tfw_tzgg表所有f_vc_bt字段值为"this is title"并且f_it_cjr字段为1的总数 - dao.count("f_vc_bt = #{bt} and f_it_cjr = #{cjr}", Paras.create().set("bt", "this is title").set("cjr", 1)); - } - -} diff --git a/src/test/java/com/smallchill/test/example/intercept/ExampleIntercept.java b/src/test/java/com/smallchill/test/example/intercept/ExampleIntercept.java deleted file mode 100644 index cb63ef15..00000000 --- a/src/test/java/com/smallchill/test/example/intercept/ExampleIntercept.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.smallchill.test.example.intercept; - -import javax.servlet.http.HttpServletRequest; - -import com.smallchill.core.aop.Invocation; -import com.smallchill.core.intercept.BladeInterceptor; -import com.smallchill.core.toolbox.kit.StrKit; - -public class ExampleIntercept extends BladeInterceptor { - - @Override - public Object intercept(Invocation inv) { - - //在controller中使用 - //@Before(ExampleIntercept.class) - //可以在执行方法前先执行ExampleIntercept的intercept方法 - //这样达到细粒度拦截的目的 - //controller方法必须带有@ResponseBody注解 - - HttpServletRequest request = inv.getRequest(); - String test = request.getParameter("test"); - if (StrKit.notBlank(test)) { - return invoke(); - } else { - return result.addError("操作失败"); - } - } -} diff --git a/src/test/java/com/smallchill/test/example/intercept/ExampleValidator.java b/src/test/java/com/smallchill/test/example/intercept/ExampleValidator.java deleted file mode 100644 index 4c80105b..00000000 --- a/src/test/java/com/smallchill/test/example/intercept/ExampleValidator.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.smallchill.test.example.intercept; - -import com.smallchill.common.vo.User; -import com.smallchill.core.aop.Invocation; -import com.smallchill.core.intercept.BladeValidator; -import com.smallchill.core.plugins.dao.Blade; -import com.smallchill.core.toolbox.Paras; -import com.smallchill.core.toolbox.kit.StrKit; - -public class ExampleValidator extends BladeValidator{ - - @Override - protected void doValidate(Invocation inv) { - - //在controller中使用 - //@Before(ExampleValidator.class) - //可以在执行方法前先执行ExampleIntercept的doValidate方法 - //这样达到细粒度拦截的目的 - //controller方法必须带有@ResponseBody注解 - //例如请求uri为:/test/validate?abc.account=123&abc.email=123&abc.password=1 - //这样就会按照执行顺序进行后端校验,如果当中有一个出错则直接返回错误信息 - - validateRequired("abc.account", "请输入账号"); - validateAccount("abc.account", "该账号已存在"); - validateRequired("abc.name", "请输入姓名"); - validateEmail("abc.email", "请输入正确的邮箱"); - validateString("abc.password", 5, 20, "请输入5到20位的密码"); - } - - /** - * 自定义校验方法 - * 可以数据库交互,推荐dao工具为Blade或者Blade - * Blade针对于javabean,Blade针对于通用模型 - */ - protected void validateAccount(String field, String errorMessage) { - String account = request.getParameter(field); - if (StrKit.isBlank(account)) { - addError("请输入账号!"); - } - if (Blade.create(User.class).isExist("SELECT * FROM tfw_user WHERE account = #{account} and status=1", Paras.create().set("account", account))) { - addError(errorMessage); - } - } - -} diff --git a/src/test/java/com/smallchill/test/other/JunitTest.java b/src/test/java/com/smallchill/test/proxy/JunitTest.java similarity index 92% rename from src/test/java/com/smallchill/test/other/JunitTest.java rename to src/test/java/com/smallchill/test/proxy/JunitTest.java index 9a043a91..595ef1b9 100644 --- a/src/test/java/com/smallchill/test/other/JunitTest.java +++ b/src/test/java/com/smallchill/test/proxy/JunitTest.java @@ -1,4 +1,4 @@ -package com.smallchill.test.other; +package com.smallchill.test.proxy; import org.junit.After; import org.junit.Before; diff --git a/src/test/java/com/smallchill/test/other/ProxyTest.java b/src/test/java/com/smallchill/test/proxy/ProxyTest.java similarity index 98% rename from src/test/java/com/smallchill/test/other/ProxyTest.java rename to src/test/java/com/smallchill/test/proxy/ProxyTest.java index d08a2c3b..bbb7c6b4 100644 --- a/src/test/java/com/smallchill/test/other/ProxyTest.java +++ b/src/test/java/com/smallchill/test/proxy/ProxyTest.java @@ -1,4 +1,4 @@ -package com.smallchill.test.other; +package com.smallchill.test.proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method;