diff --git a/.gitignore b/.gitignore index 12a6bc6..5495613 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ bin .classpath .settings out +.idea diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..60ae0ee --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e208459 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3e6487 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..06bc668 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tools.getPath() + + + UiUtils.getProjectRoot() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1557914467884 + + + 1557914467884 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code-generater.iml b/code-generater.iml new file mode 100644 index 0000000..fb8e866 --- /dev/null +++ b/code-generater.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/out/production/code-generater/com/taover/base/template/ControllerTemplate.ftl b/out/production/code-generater/com/taover/base/template/ControllerTemplate.ftl new file mode 100644 index 0000000..4ae013c --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/ControllerTemplate.ftl @@ -0,0 +1,149 @@ +package ${packageInfo}; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.taover.base.ResultInfo; +import ${poPackageInfo}.${poClassName}; +import ${serviceImplPackageInfo}.${serviceImplClassName}; +import com.taover.tools.CustomTimestampEditor; + +@Controller +@RequestMapping("/${classUrlPath}") +public class ${controllerClassName} { + @Resource + private ${serviceImplClassName} ${serviceImplFieldName}; + + Log log = LogFactory.getLog(this.getClass()); + + /** + * 绑定日期参数 + * @param request + * @param binder + */ + @InitBinder + protected void init(HttpServletRequest request, WebDataBinder binder){ + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dateFormat.setLenient(false); + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); + SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + datetimeFormat.setLenient(false); + binder.registerCustomEditor(java.sql.Timestamp.class,new CustomTimestampEditor(datetimeFormat, true)); + } + + @RequestMapping(value="/add", method=RequestMethod.POST) + @ResponseBody + public ResultInfo add( + ${poClassName} ${poFieldName}, + Model model, + HttpServletRequest request){ + ResultInfo result = new ResultInfo(); + try{ + result = this.${serviceImplFieldName}.add(${poFieldName}); + }catch(Exception e){ + result.setResultId("failure"); + result.setResultMessage("系统报错,添加失败!"); + log.error("系统报错,添加失败!"); + } + return result; + } + + @RequestMapping(value="/delete") + @ResponseBody + public ResultInfo delete( + @RequestParam(value="id", required=false) Integer id, + Model model, + HttpServletRequest request){ + //创建返回对象 + ResultInfo result = new ResultInfo(); + + //参数检验 + if(id==null || id<0){ + result.setResultId("failure"); + result.setResultMessage("删除失败,缺少主键信息或者主键错误!"); + //添加失败,将提交的对象信息放入 data.node + result.addData("node", id); + return result; + } + + try{ + result = this.${serviceImplFieldName}.delete(id); + }catch(Exception e){ + result.setResultId("failure"); + result.setResultMessage("系统报错,删除失败!"); + log.error("系统报错,删除失败!"); + } + return result; + } + + @RequestMapping(value="/update", method=RequestMethod.POST) + @ResponseBody + public ResultInfo update( + ${poClassName} ${poFieldName}, + Model model, + HttpServletRequest request){ + //创建返回对象 + ResultInfo result = new ResultInfo(); + + try{ + result = this.${serviceImplFieldName}.update(${poFieldName}); + }catch(Exception e){ + result.setResultId("failure"); + result.setResultMessage("系统报错,更新失败!"); + log.error("系统报错,更新失败!"); + } + return result; + } + + + /** + * 分页条件查询 + * @param page + * @param pageSize + * @return + */ + @RequestMapping(value = "/query") + @ResponseBody + public Map query( + @RequestParam(value="sort", required=false) String sort, + @RequestParam(value="order", required=false) String order, + @RequestParam(value="page", required=false) Integer page, + @RequestParam(value="rows", required=false) Integer pageSize, + HttpServletRequest request) { + //参数检验 + if(page == null){ + page = 1; + } + if(pageSize == null){ + pageSize = 20; + } + if("".equals(sort)){ + sort = "id"; + order = "desc"; + } + + //调用Service层查询方法 + List arrayCondition = null; + Map result = this.${serviceImplFieldName}.query${poClassName}List(arrayCondition, sort, order, page, pageSize); + return result; + } + +} diff --git a/out/production/code-generater/com/taover/base/template/DAOTemplate.ftl b/out/production/code-generater/com/taover/base/template/DAOTemplate.ftl new file mode 100644 index 0000000..174d42b --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/DAOTemplate.ftl @@ -0,0 +1,777 @@ +//${tableName} +<#--包名 --> +package ${packages} + +<#-- 所有的引入--> +<#list imports as ilist> +<#if ilist?exists>${ilist}<#else><#rt>#if> +#list> +import java.math.BigDecimal; + +/** + <#if version?exists> + * @version ${version} + #if> + */ +@Repository +<#--类, 还是接口 名称, 继承的类, 实现的接口 --> +public class ${beanName}Dao { +<#--变量 --> + @Resource + private JdbcTemplate jdbcegroceryRead; + @Resource + private JdbcTemplate jdbcegroceryWrite; + + Log logger = LogFactory.getLog(this.getClass()); + + + /** + * 根据Request Map 生成PO对象 + */ + public ${beanName}PO get${beanName}POFromRequest(Map map) throws Exception { + ${beanName}PO po = new ${beanName}PO(); + <#if reqParameterToPOMap?exists> + <#list reqParameterToPOMap?keys as poKey> + po.set${reqParameterToPOMap[poKey]}; + #list> + #if> + return po; + } + + /** + * 按主键查询 + */ + public ${beanName}PO findPOByID(${pkType} id) { + return findPOByID(id, true, false); + } + + /** + * 按主键查询 + * isLock 是否锁定, 默认不锁 + * fromWriteDB 是否从写库读写,默认从读库查询 + */ + public ${beanName}PO findPOByID(${pkType} id, boolean isLock, boolean fromWriteDB) { + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); + StringBuffer pql = new StringBuffer(sql.toString()); + sql.append(" WHERE ${pkColumName} = ?"); + pql.append(" WHERE ${pkColumName} = " + id); + if (isLock) { + sql.append(" FOR UPDATE"); + pql.append(" FOR UPDATE"); + } + List<${beanName}PO> resultList = null; + try { + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), id); + if (resultList == null || resultList.size() == 0) { + return null; + } + return resultList.get(0); + } catch (Exception e) { + LogUtils.error("error:findPOByID", logger, e, pql.toString(), id); + } finally { + Date endtime = new Date(); + if(false)LogUtils.info("info:", logger, + "${beanName}Dao.findPOByID(" + id + ", " + isLock + ", " + ", " + fromWriteDB + ")\n" + + "返回数据条数:" + (resultList==null?0:resultList.size()) + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return null; + } + + /** + * 根据条件List查询 + * Object[]数组长度是3 + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + */ + public List<${beanName}PO> findListByCondition(List condition) { + return findListByCondition(condition,null, false); + } + + /** + * 根据条件List查询 + * Object[]数组长度是3 + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + */ + public List<${beanName}PO> findListByCondition(List condition,String sortCondition, boolean fromWriteDB) { + if (StringUtil.isAutowired(condition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return null; + } + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + JdbcUtil.appendWhereCondition(sql, pql, list, condition); + if(!StringUtils.isEmpty(sortCondition)){ + sql.append(" " + sortCondition + " "); + pql.append(" " + sortCondition + " "); + } + List<${beanName}PO> resultList = null; + try { + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), list.toArray()); + return resultList; + } catch (Exception e) { + LogUtils.error("error:", logger, e, pql.toString(), null); + } finally { + Date endtime = new Date(); + if(false)LogUtils.info("info", logger, + "${beanName}Dao.findListByCondition(" + condition.toString() + ", " + fromWriteDB + ")\n" + + "fromWriteDB:" + fromWriteDB + + "执行SQL:" + pql.toString() + "\n" + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + + } + return null; + } + + /** + * 根据条件sql查询 + * sqlCondition 为where 后面的条件。 + */ + public List<${beanName}PO> findListBySql(String sqlCondition) { + return findListBySql(sqlCondition, false); + } + + /** + * 根据条件sql查询 + * sqlCondition 为where 后面的条件。 + */ + public List<${beanName}PO> findListBySql(String sqlCondition,boolean fromWriteDB) { + if (StringUtil.isAutowired(sqlCondition)) { + LogUtils.error("error", logger, new Exception("请求条件异常,无效请求!"), null, null); + return null; + } + Date starttime = new Date(); + + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName} WHERE " + sqlCondition); + List<${beanName}PO> resultList = null; + try { + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class)); + return resultList; + } catch (Exception e) { + LogUtils.error("error:", logger, e, sql.toString(), null); + } finally { + Date endtime = new Date(); + if(false)LogUtils.info("info", logger, + "${beanName}Dao.findListBySql(" + sqlCondition + ", " + fromWriteDB + ")\n" + + "fromWriteDB:" + fromWriteDB + "\n" + + "执行SQL:" + sql.toString() + "\n" + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return null; + } + + /** + * 按条件分页查询 + * Object[]数组长度是3 + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + */ + public Map findPageByCondition(List condition,int page, int pageSize) { + return findPageByCondition(condition, null , page, pageSize, false); + } + + /** + * 按条件分页查询 + * Object[]数组长度是3 + * Object[]第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + * boolean isUseCache, 是否用缓存,默认用。 + * boolean isAddCache, 是否添加缓存,默认添加。 + */ + public Map findPageByCondition(List condition,String sortCondition, int page, int pageSize, boolean fromWriteDB) { + if (StringUtil.isAutowired(condition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return null; + } + Date starttime = new Date(); + <#if dbType = "mysql"> + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); + StringBuffer pql = new StringBuffer(sql.toString()); + <#else> + StringBuffer sql = new StringBuffer("SELECT ${column_list_str}, ROWNUM RN FROM ${tableName}"); + StringBuffer pql = new StringBuffer(sql.toString()); + #if> + StringBuffer sqlCount = new StringBuffer("SELECT COUNT(1) FROM ${tableName}"); + + List count_list = new ArrayList(); + List page_list = new ArrayList(); + JdbcUtil.appendWhereConditionForCount(sqlCount, condition); + JdbcUtil.appendWhereCondition(sql, pql, count_list, condition); + for (int i = 0; i < count_list.size(); i++) + page_list.add(count_list.get(i)); + + <#if dbType == "mysql"> + page_list.add((page - 1) * pageSize); + page_list.add(pageSize); + + if(!StringUtils.isEmpty(sortCondition)){ + sql.append(" " + sortCondition + " "); + pql.append(" " + sortCondition + " "); + } + + String pageSql = sql.toString() + " limit ?, ?"; + String pagePql = pql.toString() + " limit " + (page -1) * pageSize + ", " + pageSize; + + <#else> + String pageSql = null; + String pagePql = null; + if (page_list.size() == 0) { + + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; + pagePql = "SELECT * FROM (" + pql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); + } else { + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; + pagePql = "SELECT * FROM (" + pql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); + } + page_list.add(page * pageSize); + page_list.add((page - 1) * pageSize + 1); + #if> + List<${beanName}PO> resultList = null; + try { + int totalPages = 0; + int totalRows = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).queryForInt(sqlCount.toString(), count_list.toArray()) ; + if (totalRows % pageSize == 0) { + totalPages = totalRows / pageSize; + } else { + totalPages = (totalRows / pageSize) + 1; + } + Map resultMap = new HashMap(); + resultMap.put("page", page); + resultMap.put("total", totalRows); + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query( pageSql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), page_list.toArray()); + resultMap.put("rows", resultList); + return resultMap; + } catch (Exception e) { + LogUtils.error("error:", logger, e, pagePql.toString(), page_list.toArray()); + } finally { + Date endtime = new Date(); + if(false)LogUtils.info("info:", logger, + "${beanName}Dao.findPageByCondition(" + condition.toString() + ", " + page + ", " + pageSize + ", " + fromWriteDB + ")\n" + + "执行SQL:" + pagePql.toString() + "\n" + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return null; + } + + /** + * 按sql分页查询, sqlCondition为where 后条件sql + */ + public Map findPageBySql(String sqlCondition, int page, int pageSize) { + return findPageBySql(sqlCondition, page, pageSize, false); + } + + /** + * 按sql分页查询, sqlCondition为where 后条件sql + */ + public Map findPageBySql(String sqlCondition, int page, int pageSize,boolean fromWriteDB) { + if (StringUtil.isAutowired(sqlCondition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return null; + } + Date starttime = new Date(); + + <#if dbType = "mysql"> + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName} WHERE " + sqlCondition ); + StringBuffer sqlCount = new StringBuffer("SELECT count(1) from ${tableName} WHERE " + sqlCondition); + String pageSql = sql.toString() + " limit ?, ?"; + String pagePql = sql.toString() + " limit " + ((page -1) * pageSize) + ", " + (page * pageSize); + List page_list = new ArrayList(); + page_list.add((page - 1) * pageSize); + page_list.add(page * pageSize); + <#else> + StringBuffer sql = new StringBuffer("SELECT ${column_list_str}, ROWNUM RN FROM ${tableName} WHERE " + sqlCondition); + StringBuffer sqlCount = new StringBuffer("SELECT count(1) from ${tableName} WHERE " + sqlCondition); + String pageSql = null; + String pagePql = null; + + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; + pagePql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); + + + List page_list = new ArrayList(); + page_list.add(page * pageSize); + page_list.add((page - 1) * pageSize + 1); + #if> + + + List<${beanName}PO> resultList = null; + try { + + int totalPages = 0; + int totalRows = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).queryForInt(sqlCount.toString()); + if (totalRows % pageSize == 0) { + totalPages = totalRows / pageSize; + } else { + totalPages = (totalRows / pageSize) + 1; + } + Map resultMap = new HashMap(); + resultMap.put("page", page); + resultMap.put("total", totalRows); + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(pageSql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), page_list.toArray()); + resultMap.put("rows", resultList); + return resultMap; + } catch (Exception e) { + LogUtils.error("error:", logger, e, pagePql.toString(), null); + } finally { + Date endtime = new Date(); + if(false)LogUtils.info("info:", logger, + "${beanName}Dao.findPageBySql(" + sqlCondition + ", " + page + ", " + pageSize + ", " + fromWriteDB + ")\n" + + "fromWriteDB:" +fromWriteDB + "\n" + + "执行SQL:" + pagePql.toString() + "\n" + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return null; + } + + /** + * 添加 + */ + public int add${beanName}PO(${beanName}PO ${beanName}) { + if (null == ${beanName}) { + LogUtils.error("error:", logger, new Exception("请求条件异常,${beanName}不能为空!"), null, null); + return -1; + } + Date starttime = new Date(); + <#-- + if (${beanName}.get${pkBeanName}() == null) { + ${beanName}.set${pkBeanName}(this.find${beanName}POSeqNextVal()); + } + --> + <#if columnList?exists> + <#list columnList as clist> + <#if clist.seqName?exists> + if (${beanName}.get${pkBeanName}() == null) { + ${beanName}.set${clist.columnUName}(this.find${beanName}POSeqNextVal()); + } + #if> + #list> + #if> + StringBuffer sql = new StringBuffer("INSERT INTO ${tableName}(" + "${column_list_str}" + ") VALUES ("); + StringBuffer sqlI = new StringBuffer("INSERT INTO ${tableName}("); + StringBuffer sqlC = new StringBuffer(") VALUES ("); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + <#if columnList?exists> + <#list columnList as clist> + if(${beanName}.get${clist.columnUName}() != null){ + sqlI.append("${clist.columnName},"); + sqlC.append(" ?, "); + pql.append(${beanName}.get${clist.columnUName}() + ", "); + list.add(${beanName}.get${clist.columnUName}()); + } + + #list> + #if> + + int count = 0; + try { + jdbcegroceryWrite.update(StringUtil.removeLast(StringUtil.removeLast(sqlI.toString())+sqlC.toString()) + ")", list.toArray()); + count = jdbcegroceryWrite.queryForInt("SELECT LAST_INSERT_ID()"); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + ")", null); + } finally { + Date endtime = new Date(); + LogUtils.info("info:", logger, + "${beanName}Dao.add${beanName}PO (${beanName}PO ${beanName})\n" + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + ")" + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + /** + * 批量添加 + */ + public int add${beanName}POList(List<${beanName}PO> ${beanName}list) { + Date starttime = new Date(); + int count = 0; + for (${beanName}PO ${beanName} : ${beanName}list) { + count += add${beanName}PO(${beanName}); + } + Date endtime = new Date(); + LogUtils.info("info:", logger, + "${beanName}Dao.add${beanName}POList(List<${beanName}PO> ${beanName}list)\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + return count; + } + /** + * 按ID删除 + */ + public int delete${beanName}POByID(${pkType} id) { + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName} WHERE"); + StringBuffer pql = new StringBuffer(sql.toString()); + pql.append(" ${pkColumName} = " + id); + sql.append(" ${pkColumName} = ?"); + int count = 0; + try { + count = jdbcegroceryWrite.update(sql.toString(), id); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, pql.toString(), null); + } finally { + Date endtime = new Date(); + LogUtils.info("info:", logger, + "${beanName}Dao.delete${beanName}POByID(${pkType} id)\n" + + "执行SQL:" + pql.toString() + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + /** + * 删除按List条件 + * Object[]数组长度是3 + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + */ + public int delete${beanName}POByCondition(List condition) { + if (null == condition || condition.size() == 0) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List condition不能为空!"), null, null); + return -1; + } + if (StringUtil.isAutowired(condition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return -1; + } + Date starttime = new Date(); + List list = new ArrayList(); + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName}"); + StringBuffer pql = new StringBuffer(sql.toString()); + JdbcUtil.appendWhereCondition(sql, pql, list, condition); + int count = 0; + try { + count = jdbcegroceryWrite.update( sql.toString(), list.toArray()); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, pql.toString(), null); + } finally { + Date endtime = new Date(); + LogUtils.info("cacheinfo:", logger, + "${beanName}Dao.delete${beanName}POByCondition(List condition)\n" + + "执行SQL:" + pql.toString() + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + + /** + * 删除按condition条件 + * 建议使用delete${beanName}POByCondition(List condition), 如果remove${beanName}POByCondition(List condition)满足不了where条件可以使用此方法。 + * condition为where后面的条件,condition不能为空。 + */ + public int delete${beanName}POBySql(String sqlCondition) { + if (StringUtil.isEmpty(sqlCondition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件String sqlCondition不能为空!"), null, null); + return -1; + } + if (StringUtil.isAutowired(sqlCondition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return -1; + } + Date starttime = new Date(); + + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName} WHERE "); + int count = 0; + try { + count = jdbcegroceryWrite.update( sql.toString() + sqlCondition); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, sql.toString() + sqlCondition, null); + } finally { + Date endtime = new Date(); + LogUtils.info("info", logger, + "${beanName}Dao.delete${beanName}POBySql(String sqlCondition)\n" + + "执行SQL:" + sql.toString() + sqlCondition + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + + /** + * 根据list对象逐个删除。 + */ + public int delete${beanName}POList(List<${beanName}PO> ${beanName}list) { + int count = 0; + for (${beanName}PO ${beanName} : ${beanName}list) { + count += delete${beanName}POByID(${beanName}.get${pkBeanName}()); + } + return count; + } + + /** + * 根据对象ID修改。 + */ + public int update${beanName}PO(${beanName}PO ${beanName}) { + if (null == ${beanName} || null == ${beanName}.get${pkBeanName}()) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求对象和对象ID不能为空!"), null, null); + return -1; + } + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + <#if columnList?exists> + <#list columnList as clist> + <#if clist.seqName?exists> + <#else> + <#if clist.columnJAVAType = "Long" || clist.columnJAVAType = "Integer" || clist.columnJAVAType = "Short" || clist.columnJAVAType = "Float" || clist.columnJAVAType = "Double"> + boolean ${clist.columnUName}IsZero = false; + Object variation${clist.columnUName} = ${beanName}.getVariation${clist.columnUName}(); + if (variation${clist.columnUName} instanceof BigDecimal) { + ${clist.columnUName}IsZero = (((BigDecimal)variation${clist.columnUName}).compareTo(BigDecimal.ZERO) == 0); + } else { + Long l${clist.columnUName} = Long.parseLong(String.valueOf(variation${clist.columnUName})); + ${clist.columnUName}IsZero = (l${clist.columnUName} == 0); + } + if (!${clist.columnUName}IsZero) { + sql.append(" ${clist.columnName} = ${clist.columnName} + ?, "); + pql.append(" ${clist.columnName} = ${clist.columnName} + " + ${beanName}.getVariation${clist.columnUName}() + ","); + list.add(${beanName}.getVariation${clist.columnUName}()); + } else { + sql.append(" ${clist.columnName} = ?, "); + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); + list.add(${beanName}.get${clist.columnUName}()); + } + <#elseif clist.columnJAVAType = "java.math.BigDecimal"> + if (${beanName}.getVariation${clist.columnUName}().compareTo(BigDecimal.ZERO) != 0) { + sql.append(" ${clist.columnName} = ${clist.columnName} + ?, "); + pql.append(" ${clist.columnName} = ${clist.columnName} + " + ${beanName}.getVariation${clist.columnUName}() + ","); + list.add(${beanName}.getVariation${clist.columnUName}()); + } else { + sql.append(" ${clist.columnName} = ?, "); + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); + list.add(${beanName}.get${clist.columnUName}()); + } + <#else> + sql.append(" ${clist.columnName} = ?, "); + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); + list.add(${beanName}.get${clist.columnUName}()); + #if> + #if> + #list> + #if> + + String where = " WHERE ${pkColumName} = ?"; + String pwhere = " WHERE ${pkColumName} = " + ${beanName}.get${pkBeanName}(); + list.add(${beanName}.get${pkBeanName}()); + int count = 0; + try { + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where, list.toArray()); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + pwhere, null); + } finally { + Date endtime = new Date(); + LogUtils.info("info", logger, + "${beanName}Dao.update${beanName}PO(${beanName}PO ${beanName})\n" + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + pwhere + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + + /** + * 根据ID修改指定的值 + */ + public int update${beanName}FieldById(List changeList, ${pkType} id) { + if (null == id) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求对象和对象ID不能为空!"), null, null); + return -1; + } + Date starttime =new Date(); + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + Map map = new HashMap(); + for (int i = 0, iLen = changeList.size(); i < iLen; i++) { + String name = (String) changeList.get(i)[0]; + Object value = changeList.get(i)[1]; + String variationOpt = "="; + if (changeList.get(i).length > 2) + variationOpt = (String)changeList.get(i)[2]; + if (variationOpt.equals("=")) { + sql.append(" " + name + " = ?,"); + list.add(value); + if (value == null) { + pql.append(" " + name + "=null,"); + } else { + pql.append(" " + name + "=\"" + value.toString() + "\","); + } + map.put(name, value); + } else { + sql.append(" " + name + " = " + name + " + ?,"); + list.add(value); + pql.append(" " + name + " = " + name + " + " + value.toString() + ","); + <#--会有问题 暂留 + map.put(name, value);--> + } + } + + String where = " WHERE ${pkColumName}=?"; + String pwhere = " WHERE ${pkColumName}=\"" + id + "\""; + list.add(id); + int count = 0; + try { + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where, list.toArray()); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + pwhere, null); + } finally { + Date endtime = new Date(); + LogUtils.info("info", logger, + "${beanName}Dao.update${beanName}PO(List changeList, ${pkType} id)\n" + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + pwhere + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + + /** + * 批量修改。 + */ + public int update${beanName}POList(List<${beanName}PO> ${beanName}list) { + int count = 0; + for (${beanName}PO ${beanName} : ${beanName}list) { + count += update${beanName}PO(${beanName}); + } + return count; + } + + /** + * List updateObj 要修改成的值,数组长度为2,第一个值为列名,第二个值是要改成的值。 + * List condition 修改的条件, 数组长度是3, 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 + */ + public int update${beanName}POByCondition(List updateObj, List condition) { + if (null == updateObj || updateObj.size() == 0) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List updateObj不能为空!"), null, null); + return -1; + } + if (null == condition || condition.size() == 0) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List condition不能为空!"), null, null); + return -1; + } + if (StringUtil.isAutowired(condition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return -1; + } + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + JdbcUtil.appendSql(sql, pql, list, updateObj); + StringBuffer where = new StringBuffer(""); + StringBuffer pwhere = new StringBuffer(""); + JdbcUtil.appendWhereCondition(where, pwhere, list, condition); + int count = 0; + try { + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where.toString(), list.toArray()); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString())+pwhere.toString(), null, null); + } finally { + Date endtime = new Date(); + LogUtils.info("info", logger, + "${beanName}Dao.update${beanName}POByCondition(List updateObj, List condition)\n" + + "执行SQL:" + StringUtil.removeLast(pql.toString())+pwhere.toString() + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } + + /** + * List updateObj 要修改成的值,数组长度为2,第一个值为列名,第二个值是要改成的值。 + * String sqlCondition 修改的条件。 + */ + public int update${beanName}POBySql(List updateObj, String sqlCondition) { + if (null == updateObj || updateObj.size() == 0) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List updateObj不能为空!"), null, null); + return -1; + } + if (StringUtil.isEmpty(sqlCondition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件sqlCondition不能为空!"), null, null); + return -1; + } + if (StringUtil.isAutowired(sqlCondition)) { + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); + return -1; + } + Date starttime = new Date(); + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); + StringBuffer pql = new StringBuffer(sql.toString()); + List list = new ArrayList(); + JdbcUtil.appendSql(sql, pql, list, updateObj); + int count = 0; + try { + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + " WHERE "+sqlCondition, list.toArray()); + return count; + } catch (Exception e) { + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + " WHERE " + sqlCondition, null, null); + } finally { + Date endtime = new Date(); + LogUtils.info("info", logger, + "${beanName}Dao.update${beanName}POBySql(List updateObj, String sqlCondition)\n" + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + " WHERE " + sqlCondition + "\n" + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") + + "*-*" + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") + + ")"); + } + return -1; + } +} \ No newline at end of file diff --git a/out/production/code-generater/com/taover/base/template/EntityTemplate.ftl b/out/production/code-generater/com/taover/base/template/EntityTemplate.ftl new file mode 100644 index 0000000..f6ec33e --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/EntityTemplate.ftl @@ -0,0 +1,51 @@ +<#--包名 --> +package ${packages} + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Id; +import javax.persistence.Column; + +/** + <#if version?exists> + * @version ${version} + #if> + */ +@Entity +@Table(name="${tablemodel.tableName}") +public class ${name}Entity implements Serializable { + + <#--变量 ,get,set方法--> +<#if tablemodel.columnlist?exists> + <#list tablemodel.columnlist as clist> + + <#if clist.columnRemarks?exists> + /** + * ${clist.columnRemarks} + */ + #if> + <#if clist.primaryKey == true> + @Id + #if> + @Column(name="${clist.columnUName}") + private ${clist.columnJAVAType} ${clist.columnName}; + + public ${clist.columnJAVAType} get${clist.columnMethodName}(){ + return ${clist.columnName}; + } + public void set${clist.columnMethodName}(${clist.columnJAVAType} ${clist.columnName}){ + this.${clist.columnName} = ${clist.columnName}; + } + #list> +#if> + + @Override + public String toString() { + return "${name}Entity: ${toStringMethodBody}; + } + } \ No newline at end of file diff --git a/out/production/code-generater/com/taover/base/template/HtmlTemplate.ftl b/out/production/code-generater/com/taover/base/template/HtmlTemplate.ftl new file mode 100644 index 0000000..59963f9 --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/HtmlTemplate.ftl @@ -0,0 +1,88 @@ + + + + + + + + + + + 操作人 + 操作名称 + 操作日期 + 操作备注 + + + + + + + + + + + 店铺名称 + + 全部 + 京东店铺 + 淘宝店铺 + 试吃店铺 + 爱仕达 + + + + 状态 + + 全部 + 正常 + 停用 + + + + 查询 + + + + 添加 + 删除 + + + + + + + <#list fields as tempField> + <#if (tempField["name"]!="id")> + + ${tempField["cnName"]}: + + + #if> + #list> + + + + + + <#list fields as tempField> + + ${tempField["cnName"]}: + + + #list> + + + + diff --git a/out/production/code-generater/com/taover/base/template/JsTemplate.ftl b/out/production/code-generater/com/taover/base/template/JsTemplate.ftl new file mode 100644 index 0000000..f114621 --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/JsTemplate.ftl @@ -0,0 +1,33 @@ +$(function(){ + var controllerPathMap = "${controllerPathMap}"; + var addDialogId = controllerPathMap+"_add"; + var editDialogId = controllerPathMap+"_edit"; + var gridId = controllerPathMap+"_list"; + var gridToolbarId = controllerPathMap+"_toolbar" + var gridColumns = [{ + field: 'selectedItem', + checkbox: true + }, + <#list fields as tempField> + <#if tempField["name"] != "id"> + { + field: '${tempField["name"]}', + title: '${tempField["cnName"]}', + sortable: true, + }, + #if> + #list> + { + field : 'id', + title : '操作', + width : 10, + formatter : function(value, rows, index){ + return '修改 | ' + + '删除'; + }, + }, + ]; + + ${controllerPathMap}Page = tabInit(controllerPathMap, addDialogId, editDialogId, gridId, gridToolbarId, gridColumns); +}); + diff --git a/out/production/code-generater/com/taover/base/template/POTemplate.ftl b/out/production/code-generater/com/taover/base/template/POTemplate.ftl new file mode 100644 index 0000000..5f43059 --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/POTemplate.ftl @@ -0,0 +1,75 @@ +<#--包名 --> +package ${packages} +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +/** + <#if version?exists> + * @version ${version} + #if> + */ + + public class ${name}PO implements Serializable { + + <#--变量 ,get,set方法--> +<#if tablemodel.columnlist?exists> + <#list tablemodel.columnlist as clist> + private ${clist.columnJAVAType} ${clist.columnName}; + + <#if clist.columnRemarks?exists> + /** + * ${clist.columnRemarks} + */ + <#else> + #if> + <#if clist.columnJAVAType = "java.sql.Timestamp" > + @org.codehaus.jackson.map.annotate.JsonSerialize(using = com.taover.tools.DateTimeSerializer.class) + #if> + <#if clist.columnJAVAType = "java.util.Date" > + @org.codehaus.jackson.map.annotate.JsonSerialize(using = com.taover.tools.DateSerializer.class) + #if> + public ${clist.columnJAVAType} get${clist.columnMethodName}(){ + return ${clist.columnName}; + } + + public void set${clist.columnMethodName}(${clist.columnJAVAType} ${clist.columnName}){ + this.${clist.columnName} = ${clist.columnName}; + } + + <#if clist.columnJAVAType = "Long" || clist.columnJAVAType = "java.math.BigDecimal" || clist.columnJAVAType = "Integer" || clist.columnJAVAType = "Short" || clist.columnJAVAType = "Float" || clist.columnJAVAType = "Double"> + <#if clist.columnJAVAType = "Long"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0L; + #if> + <#if clist.columnJAVAType = "java.math.BigDecimal"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = new java.math.BigDecimal(0.0); + #if> + <#if clist.columnJAVAType = "Integer"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0; + #if> + <#if clist.columnJAVAType = "Short"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0; + #if> + <#if clist.columnJAVAType = "Double"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0d; + #if> + <#if clist.columnJAVAType = "Float"> + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0f; + #if> + public ${clist.columnJAVAType} getVariation${clist.columnMethodName}(){ + return variation${clist.columnMethodName}; + } + + public void setVariation${clist.columnMethodName}(${clist.columnJAVAType} variation${clist.columnName}){ + this.variation${clist.columnMethodName} = variation${clist.columnName}; + } + + #if> + + #list> +#if> + + @Override + public String toString() { + return "${name}PO: ${toStringMethodBody}; + } + } \ No newline at end of file diff --git a/out/production/code-generater/com/taover/base/template/ServiceImplTemplate.ftl b/out/production/code-generater/com/taover/base/template/ServiceImplTemplate.ftl new file mode 100644 index 0000000..9be6757 --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/ServiceImplTemplate.ftl @@ -0,0 +1,291 @@ +package ${packageInfo}.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.commons.lang.StringUtils; +import org.springframework.stereotype.Service; +import com.taover.base.ResultInfo; + +import ${poPackageInfo}.${beanClassName}Dao; +import ${poPackageInfo}.${beanClassName}PO; +import ${packageInfo}.${beanClassName}Service; +import ${utilPackageInfo}.ObjectUtil; + +@Service +public class ${beanClassName}ServiceImpl implements ${beanClassName}Service{ + @Resource + private ${beanClassName}Dao ${beanFieldName}Dao; + + @Override + public ResultInfo add(${beanClassName}PO ${beanFieldName}PO){ + //创建返回对象 + ResultInfo result = new ResultInfo(); + + //调用Service方法 + ${beanClassName}PO addResult = this.add${beanClassName}PO(${beanFieldName}PO); + if(addResult == null){ + result.setResultId("failure"); + result.setResultMessage("添加失败!"); + //添加失败,将提交的对象信息放入 data.node + result.addData("node", ${beanFieldName}PO); + }else{ + result.setResultId("success"); + result.setResultMessage("添加成功!"); + //添加成功,将添加成功的对象信息放入 data.node + result.addData("node", addResult); + } + return result; + } + + @Override + public ResultInfo delete(Integer id){ + //创建返回对象 + ResultInfo result = new ResultInfo(); + + //参数检验 + if(id==null || id<0){ + result.setResultId("failure"); + result.setResultMessage("删除失败,缺少主键信息或者主键错误!"); + //添加失败,将提交的对象信息放入 data.node + result.addData("node", id); + return result; + } + + //调用Service方法 + boolean deleteResult = this.delete${beanClassName}PO(id); + if(!deleteResult){ + result.setResultId("failure"); + result.setResultMessage("删除失败!"); + //添加失败,将id信息放入 data.node + result.addData("node", id); + }else{ + result.setResultId("success"); + result.setResultMessage("删除成功!"); + //添加成功,将id信息放入 data.node + result.addData("node", id); + } + return result; + } + + @Override + public ResultInfo update(${beanClassName}PO ${beanFieldName}PO){ + //创建返回对象 + ResultInfo result = new ResultInfo(); + + //参数检验 + if(${beanFieldName}PO==null || ${beanFieldName}PO.getId()==null){ + result.setResultId("failure"); + result.setResultMessage("更新失败,缺少主键信息!"); + //添加失败,将提交的对象信息放入 data.node + result.addData("node", ${beanFieldName}PO); + return result; + } + + //调用Service方法 + ${beanClassName}PO updateResult = this.update${beanClassName}PO(${beanFieldName}PO.getId(), ${beanFieldName}PO); + if(updateResult == null){ + result.setResultId("failure"); + result.setResultMessage("更新失败!"); + //添加失败,将提交的对象信息放入 data.node + result.addData("node", ${beanFieldName}PO); + }else{ + result.setResultId("success"); + result.setResultMessage("更新成功!"); + //添加成功,将添加成功的对象信息放入 data.node + result.addData("node", updateResult); + } + return result; + } + + @Override + public ${beanClassName}PO add${beanClassName}PO(${beanClassName}PO ${beanFieldName}PO) { + //参数检验 + if(${beanFieldName}PO == null){ + return null; + } + ${beanFieldName}PO.setId(null); + + //调用DAO方法添加实体 + int result = this.${beanFieldName}Dao.add${beanClassName}PO(${beanFieldName}PO); + + //依据SQL执行结果返回数据 + if(result > 0){ + ${beanFieldName}PO.setId(result); + return ${beanFieldName}PO; + }else{ + return null; + } + } + + @Override + public boolean delete${beanClassName}PO(Integer id) { + //参数检验 + if(id==null || id<=0){ + return false; + } + + //执行DAO删除方法 + int result = this.${beanFieldName}Dao.delete${beanClassName}POByID(id); + + //依据SQL执行结果返回数据 + if(result==0 || result==1){ + return true; + }else{ + return false; + } + } + + @Override + public ${beanClassName}PO update${beanClassName}PO(Integer id, ${beanClassName}PO ${beanFieldName}PO) { + //参数检验 + if(${beanFieldName}PO==null || id==null){ + return null; + } + + //获取数据库中的对应记录 + ${beanClassName}PO dest = this.${beanFieldName}Dao.findPOByID(id); + if(dest == null){ + return null; + } + + //将erpShopListPO中不为null的字段拷贝到dest中 + ObjectUtil.fieldCopy(${beanFieldName}PO, dest, false, new String[]{"id"}, false); + //执行DAO操作方法 + int result = this.${beanFieldName}Dao.update${beanClassName}PO(dest); + + //依据SQL执行结果返回数据 + if(result==1){ + return dest; + }else{ + return null; + } + } + + @Override + public Map query${beanClassName}POList(List arrayCondition, String sort, String order, int page, int pageSize) { + //参数检验 + if(page==0 || pageSize<=0){ + return new HashMap(); + } + + //参数解析 + if(arrayCondition==null || arrayCondition.size()==0){ + arrayCondition = new ArrayList(); + arrayCondition.add(new Object[]{"1=1", null}); + } + + //构造排序内容 + String sortCondition = " "; + if(!StringUtils.isEmpty(sort)){ + sortCondition = " order by "; + String[] sortArr = sort.split(","); + if(StringUtils.isEmpty(order)){ + sortCondition += sortArr[0]+" DESC "; + for(int i=1; i result = new HashMap(); + if(page == -1){ + List<${beanClassName}PO> ${beanFieldName}POList = this.${beanFieldName}Dao.findListByCondition(arrayCondition, sortCondition, false); + result.put("page", 1); + result.put("total", ${beanFieldName}POList.size()); + result.put("rows", ${beanFieldName}POList); + }else{ + result = this.${beanFieldName}Dao.findPageByCondition(arrayCondition, sortCondition, page, pageSize, false); + } + + return result; + } + + @Override + public Map query${beanClassName}POList(String sqlCondition, String sort, String order, int page, int pageSize) { + //参数检验 + if(page==0 || pageSize<=0){ + return new HashMap(); + } + + //参数解析 + if(sqlCondition==null || sqlCondition.length()==0){ + sqlCondition = " 1=1 "; + } + + //构造排序内容 + String sortCondition = ErpSQLUtil.getSortCondition(sort, order, null); + sqlCondition += sortCondition; + + //调用DAO查询 + Map result = new HashMap(); + if(page == -1){ + List<${beanClassName}PO> ${beanFieldName}POList = this.${beanFieldName}Dao.findListBySql(sqlCondition); + result.put("page", 1); + result.put("total", ${beanFieldName}POList.size()); + result.put("rows", ${beanFieldName}POList); + }else{ + result = this.${beanFieldName}Dao.findPageBySql(sqlCondition, page, pageSize); + } + return result; + } + + @Override + public ${beanClassName}PO query${beanClassName}PO(Integer id) { + //参数检验 + if(id == null){ + return null; + } + + //调用DAO方法查询 + return this.${beanFieldName}Dao.findPOByID(id); + } + + @Override + public ${beanClassName}PO query${beanClassName}PO(String sqlCondition) { + //参数检验 + if(sqlCondition==null || sqlCondition.length()==0){ + return null; + } + + //调用DAO方法 + List<${beanClassName}PO> resultList = this.${beanFieldName}Dao.findListBySql(sqlCondition); + if(resultList==null || resultList.size()==0){ + return null; + }else{ + return resultList.get(0); + } + } + + @Override + public ${beanClassName}PO query${beanClassName}PO(List arrayCondition) { + //参数检验 + if(arrayCondition==null || arrayCondition.size()==0){ + return null; + } + + //调用DAO方法 + List<${beanClassName}PO> resultList = this.${beanFieldName}Dao.findListByCondition(arrayCondition); + if(resultList==null || resultList.size()==0){ + return null; + }else{ + return resultList.get(0); + } + } +} diff --git a/out/production/code-generater/com/taover/base/template/ServiceTemplate.ftl b/out/production/code-generater/com/taover/base/template/ServiceTemplate.ftl new file mode 100644 index 0000000..8db8fe2 --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/ServiceTemplate.ftl @@ -0,0 +1,87 @@ +package ${packageInfo}; + +import java.util.List; +import java.util.Map; + +import com.taover.base.ResultInfo; + +import ${poPackageInfo}.${beanClassName}PO; + +public interface ${beanClassName}Service { + /** + * 业务层添加接口 + */ + public ResultInfo add(${beanClassName}PO ${beanFieldName}PO); + + /** + * 业务层删除接口 + */ + public ResultInfo delete(Integer id); + + /** + * 业务层更新接口 + */ + public ResultInfo update(${beanClassName}PO ${beanFieldName}PO); + + /** + * 增加${beanClassName}PO + * @param ${beanFieldName}PO + * @return 返回增加后的实体,如果为null代表添加失败 + */ + public ${beanClassName}PO add${beanClassName}PO(${beanClassName}PO ${beanFieldName}PO); + + /** + * 依据${beanClassName}PO id删除记录 + * @param id + * @return 返回删除是否成功 + */ + public boolean delete${beanClassName}PO(Integer id); + + /** + * 依据${beanClassName}PO id更新记录,修改除id以外的其他字段 + * @param id + * @param ${beanFieldName} + * @return 返回修改后的实体,如果为null代表修改失败 + */ + public ${beanClassName}PO update${beanClassName}PO(Integer id, ${beanClassName}PO ${beanFieldName}PO); + + /** + * 依据arrayCondition,sqlCondition查询记录列表 + * @param arrayCondition List类型,如果为null,表示不存在该条件约束 + * @param page int类型,如果-1代表查询所有记录,0代表不取数据,>0代表所取页码 + * @param pageSize int类型,>0时,该值有效,否则查询无效 + * @return 返回实体列表 + */ + public Map query${beanClassName}POList(List arrayCondition, String sort, String order, int page, int pageSize); + + /** + * 依据arrayCondition,sqlCondition查询记录列表 + * @param sqlCondition String类型,如果为null,表示不存在该条件约束 + * @param page int类型,如果-1代表查询所有记录,0代表不取数据,>0代表所取页码 + * @param pageSize int类型,>0时,该值有效,否则查询无效 + * @return 返回实体列表 + */ + public Map query${beanClassName}POList(String sqlCondition, String sort, String order, int page, int pageSize); + + /** + * 依据id查询单条记录 + * @param id + * @return 返回实体引用,如果未找到返回null + */ + public ${beanClassName}PO query${beanClassName}PO(Integer id); + + /** + * 依据sqlCondition查询条件查询单条记录,如果存在多条记录,则取第一条 + * @param sqlCondition + * @return 返回实体引用,如果未找到返回null + */ + public ${beanClassName}PO query${beanClassName}PO(String sqlCondition); + + /** + * 依据arrayCondition查询条件查询单条记录,如果存在多条记录,则取第一条 + * @param arrayCondition + * @return 返回实体引用,如果未找到返回null + */ + public ${beanClassName}PO query${beanClassName}PO(List arrayCondition); + +} diff --git a/out/production/code-generater/com/taover/base/template/Temp.ftl b/out/production/code-generater/com/taover/base/template/Temp.ftl new file mode 100644 index 0000000..847844e --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/Temp.ftl @@ -0,0 +1,8 @@ +//${cnFunc} +//${enFunc} +<#list propertyList as property > +var ${property} = getNumberBoxValue('${property}', 0); +#list> + +var ${enFunc}; +$('#${result}').numberbox('setValue', ${result}); \ No newline at end of file diff --git a/out/production/code-generater/com/taover/base/template/createTableTemplate.ftl b/out/production/code-generater/com/taover/base/template/createTableTemplate.ftl new file mode 100644 index 0000000..eb8e89f --- /dev/null +++ b/out/production/code-generater/com/taover/base/template/createTableTemplate.ftl @@ -0,0 +1,31 @@ +-- Create table +create table ${tableName} +( +<#list columnlist as clist> + ${clist.columnName} ${clist.columnSQLType}<#if clist.columnSize?exists>${clist.columnSize}#if><#if clist.columnDefaults?exists && clist.columnDefaults != '' && clist.columnDefaults != 'null'> default ${clist.columnDefaults}#if><#if !clist.nullable> not null#if><#if clist_has_next>,#if> +#list> +); +<#if tableRemarks?exists> +-- Add comments to the table +comment on table ${tableName} is '${tableRemarks}'; +#if> +-- Add comments to the columns +<#list columnlist as clist> + <#if clist.columnRemarks?exists && clist.columnRemarks != clist.columnName> +comment on column ${tableName}.${clist.columnName} is '${clist.columnRemarks}'; + #if> +#list> +<#if tablePk?exists> +-- Create index +CREATE UNIQUE INDEX PK_${tableName} ON ${tableName}(${tablePk}); +ALTER TABLE ${tableName} ADD + PRIMARY KEY (${tablePk}) + USING INDEX PK_${tableName}; +#if> +-- Create sequence +create sequence SEQ_${tableName}<#if tableName?length lt 24>_PK#if> +minvalue 1 +maxvalue 99999999999999999 +start with 1 +increment by 1 +cache 20; diff --git a/out/production/code-generater/com/taover/base/template/model/bussiness/ControllerModel.class b/out/production/code-generater/com/taover/base/template/model/bussiness/ControllerModel.class new file mode 100644 index 0000000..8d0eda5 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/bussiness/ControllerModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/bussiness/EnvironmentModel.class b/out/production/code-generater/com/taover/base/template/model/bussiness/EnvironmentModel.class new file mode 100644 index 0000000..b466fa7 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/bussiness/EnvironmentModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/bussiness/ServiceModel.class b/out/production/code-generater/com/taover/base/template/model/bussiness/ServiceModel.class new file mode 100644 index 0000000..a7db8ef Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/bussiness/ServiceModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/bussiness/ViewModel.class b/out/production/code-generater/com/taover/base/template/model/bussiness/ViewModel.class new file mode 100644 index 0000000..5a5803a Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/bussiness/ViewModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/createTable/ColumnModel.class b/out/production/code-generater/com/taover/base/template/model/createTable/ColumnModel.class new file mode 100644 index 0000000..b3af306 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/createTable/ColumnModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/createTable/TableModel.class b/out/production/code-generater/com/taover/base/template/model/createTable/TableModel.class new file mode 100644 index 0000000..468e515 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/createTable/TableModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/dao/BaseModel.class b/out/production/code-generater/com/taover/base/template/model/dao/BaseModel.class new file mode 100644 index 0000000..ff815b0 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/dao/BaseModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/dao/DaoModel.class b/out/production/code-generater/com/taover/base/template/model/dao/DaoModel.class new file mode 100644 index 0000000..2ed0050 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/dao/DaoModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/dao/FunctionModel.class b/out/production/code-generater/com/taover/base/template/model/dao/FunctionModel.class new file mode 100644 index 0000000..d540f59 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/dao/FunctionModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/po/ColumnModel.class b/out/production/code-generater/com/taover/base/template/model/po/ColumnModel.class new file mode 100644 index 0000000..28698e5 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/po/ColumnModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/po/PoModel.class b/out/production/code-generater/com/taover/base/template/model/po/PoModel.class new file mode 100644 index 0000000..4856657 Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/po/PoModel.class differ diff --git a/out/production/code-generater/com/taover/base/template/model/po/TableModel.class b/out/production/code-generater/com/taover/base/template/model/po/TableModel.class new file mode 100644 index 0000000..5c3e8db Binary files /dev/null and b/out/production/code-generater/com/taover/base/template/model/po/TableModel.class differ diff --git a/out/production/code-generater/com/taover/business/Constants.class b/out/production/code-generater/com/taover/business/Constants.class new file mode 100644 index 0000000..1d84b50 Binary files /dev/null and b/out/production/code-generater/com/taover/business/Constants.class differ diff --git a/out/production/code-generater/com/taover/business/GenerateCS.class b/out/production/code-generater/com/taover/business/GenerateCS.class new file mode 100644 index 0000000..ab3403f Binary files /dev/null and b/out/production/code-generater/com/taover/business/GenerateCS.class differ diff --git a/out/production/code-generater/com/taover/business/GenerateController.class b/out/production/code-generater/com/taover/business/GenerateController.class new file mode 100644 index 0000000..13a5b07 Binary files /dev/null and b/out/production/code-generater/com/taover/business/GenerateController.class differ diff --git a/out/production/code-generater/com/taover/business/GenerateService.class b/out/production/code-generater/com/taover/business/GenerateService.class new file mode 100644 index 0000000..f5202f9 Binary files /dev/null and b/out/production/code-generater/com/taover/business/GenerateService.class differ diff --git a/out/production/code-generater/com/taover/business/GenerateVCSDP.class b/out/production/code-generater/com/taover/business/GenerateVCSDP.class new file mode 100644 index 0000000..a0d9308 Binary files /dev/null and b/out/production/code-generater/com/taover/business/GenerateVCSDP.class differ diff --git a/out/production/code-generater/com/taover/business/GenerateView.class b/out/production/code-generater/com/taover/business/GenerateView.class new file mode 100644 index 0000000..852a868 Binary files /dev/null and b/out/production/code-generater/com/taover/business/GenerateView.class differ diff --git a/out/production/code-generater/com/taover/business/Utils.class b/out/production/code-generater/com/taover/business/Utils.class new file mode 100644 index 0000000..645ec85 Binary files /dev/null and b/out/production/code-generater/com/taover/business/Utils.class differ diff --git a/out/production/code-generater/com/taover/business/util/TempVelocity.class b/out/production/code-generater/com/taover/business/util/TempVelocity.class new file mode 100644 index 0000000..111411f Binary files /dev/null and b/out/production/code-generater/com/taover/business/util/TempVelocity.class differ diff --git a/out/production/code-generater/com/taover/db/Constants.class b/out/production/code-generater/com/taover/db/Constants.class new file mode 100644 index 0000000..601a85f Binary files /dev/null and b/out/production/code-generater/com/taover/db/Constants.class differ diff --git a/out/production/code-generater/com/taover/db/GenerateDao.class b/out/production/code-generater/com/taover/db/GenerateDao.class new file mode 100644 index 0000000..d6b212f Binary files /dev/null and b/out/production/code-generater/com/taover/db/GenerateDao.class differ diff --git a/out/production/code-generater/com/taover/db/GenerateDaoPO.class b/out/production/code-generater/com/taover/db/GenerateDaoPO.class new file mode 100644 index 0000000..24a7259 Binary files /dev/null and b/out/production/code-generater/com/taover/db/GenerateDaoPO.class differ diff --git a/out/production/code-generater/com/taover/db/GenerateEntity.class b/out/production/code-generater/com/taover/db/GenerateEntity.class new file mode 100644 index 0000000..e28a89a Binary files /dev/null and b/out/production/code-generater/com/taover/db/GenerateEntity.class differ diff --git a/out/production/code-generater/com/taover/db/GeneratePO.class b/out/production/code-generater/com/taover/db/GeneratePO.class new file mode 100644 index 0000000..f5f61be Binary files /dev/null and b/out/production/code-generater/com/taover/db/GeneratePO.class differ diff --git a/out/production/code-generater/com/taover/db/MainGenerateEntity.class b/out/production/code-generater/com/taover/db/MainGenerateEntity.class new file mode 100644 index 0000000..9296837 Binary files /dev/null and b/out/production/code-generater/com/taover/db/MainGenerateEntity.class differ diff --git a/out/production/code-generater/com/taover/db/TableColumn.class b/out/production/code-generater/com/taover/db/TableColumn.class new file mode 100644 index 0000000..6cdeae8 Binary files /dev/null and b/out/production/code-generater/com/taover/db/TableColumn.class differ diff --git a/out/production/code-generater/com/taover/db/Tools.class b/out/production/code-generater/com/taover/db/Tools.class new file mode 100644 index 0000000..583744a Binary files /dev/null and b/out/production/code-generater/com/taover/db/Tools.class differ diff --git a/out/production/code-generater/com/taover/tools/StringUtil.class b/out/production/code-generater/com/taover/tools/StringUtil.class new file mode 100644 index 0000000..3341c68 Binary files /dev/null and b/out/production/code-generater/com/taover/tools/StringUtil.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow$1.class b/out/production/code-generater/com/taover/ui/EntityGenWindow$1.class new file mode 100644 index 0000000..81a961f Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow$1.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow$2.class b/out/production/code-generater/com/taover/ui/EntityGenWindow$2.class new file mode 100644 index 0000000..6408449 Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow$2.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow$3.class b/out/production/code-generater/com/taover/ui/EntityGenWindow$3.class new file mode 100644 index 0000000..897da14 Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow$3.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow$4.class b/out/production/code-generater/com/taover/ui/EntityGenWindow$4.class new file mode 100644 index 0000000..0a430e0 Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow$4.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow$5.class b/out/production/code-generater/com/taover/ui/EntityGenWindow$5.class new file mode 100644 index 0000000..f1d200f Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow$5.class differ diff --git a/out/production/code-generater/com/taover/ui/EntityGenWindow.class b/out/production/code-generater/com/taover/ui/EntityGenWindow.class new file mode 100644 index 0000000..7d3f32c Binary files /dev/null and b/out/production/code-generater/com/taover/ui/EntityGenWindow.class differ diff --git a/out/production/code-generater/com/taover/ui/UiUtils.class b/out/production/code-generater/com/taover/ui/UiUtils.class new file mode 100644 index 0000000..f77e093 Binary files /dev/null and b/out/production/code-generater/com/taover/ui/UiUtils.class differ diff --git a/out/production/code-generater/default.properties b/out/production/code-generater/default.properties new file mode 100644 index 0000000..a786df9 --- /dev/null +++ b/out/production/code-generater/default.properties @@ -0,0 +1,48 @@ +#顶层po、dao文件生成总目录 +OutputPath=\\D:\\dblist\\ +#OutputPath=\\D:\\workproject\\suan-taover-com\\src\\main\\java\\com\\taover\\db\\ +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ +#数据库名 +SchameName=songshuyun_stat +#SchameName=taoverprinter +CreateSchame=false +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods +#TableName=erp_log_name,erp_order_log,erp_delivery_log,erp_base_log +#TableName=chl_payment,chl_payment_goods,chl_payment_log,chl_payment_batch,chl_payment_batch_confirm,chl_payment_batch_notice,chl_payment_batch_overdue +#chl_quotation_channel,chl_quotation_contact,chl_quotation_contact_recommend +TableName=message_group_task +#数据库库连接信息 +User=tylife +Password=lexi365 +#Password=qwe123!@# +DBLikeStr=% +#数据库驱动类型 +driver=com.mysql.jdbc.Driver +#数据库连接url +URL=jdbc\:mysql\://127.0.0.1\:3306/songshuyun_stat +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter +#数据库类型 +dbtype=mysql +#数据库顶层包名 +#packageName=com.taover.printer.db +packageName=com.ssy.java.entity + +#----------------------------- +# 生成 Controller和Service所需参数 - +#----------------------------- +#模块包全名,controller、service包名都会由此生成 +modulePackageInfo=com.taover.settlement.chlpayment +#modulePackageInfo=com.taover.printer +#模块本地文件夹路径 +moduleFilePath=\\D:\\workproject\\suan-taover-com\\src\\main\\java\\com\\taover\\settlement\\chlpayment\\ +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ +#db包,同上面的packageName +dbPackageInfo=com.taover.db +#dbPackageInfo=com.taover.printer.db + +#----------------------------- +# 生成View的HTML、JS所需参数 - +#----------------------------- +#WebRoot的本地路径 +WebRootPath=\\D:\\workproject\\suan-taover-com\\WebRoot\\ +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ \ No newline at end of file diff --git a/out/production/code-generater/erp.default.properties b/out/production/code-generater/erp.default.properties new file mode 100644 index 0000000..db32840 --- /dev/null +++ b/out/production/code-generater/erp.default.properties @@ -0,0 +1,44 @@ +#顶层po、dao文件生成总目录 +OutputPath=\\D:\\workproject\\erp-taover-com\\src\\com\\taover\\erp\\db\\ +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ +#数据库名 +SchameName=erp +#SchameName=taoverprinter +CreateSchame=false +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods +TableName=erp_delivery_goods +#数据库库连接信息 +User=tylife +Password=lexi365 +#Password=qwe123!@# +DBLikeStr=% +#数据库驱动类型 +driver=com.mysql.jdbc.Driver +#数据库连接url +URL=jdbc\:mysql\://127.0.0.1\:3306/erp +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter +#数据库类型 +dbtype=mysql +#数据库顶层包名 +#packageName=com.taover.printer.db +packageName=com.taover.erp.db + +#----------------------------- +# 生成 Controller和Service所需参数 - +#----------------------------- +#模块包全名,controller、service包名都会由此生成 +modulePackageInfo=com.taover.erp +#modulePackageInfo=com.taover.printer +#模块本地文件夹路径 +moduleFilePath=\\D:\\workproject\\erp-taover-com\\src\\com\\taover\\erp\\ +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ +#db包,同上面的packageName +dbPackageInfo=com.taover.erp.db +#dbPackageInfo=com.taover.printer.db + +#----------------------------- +# 生成View的HTML、JS所需参数 - +#----------------------------- +#WebRoot的本地路径 +WebRootPath=\\D:\\workproject\\erp-taover-com\\WebRoot\\ +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ diff --git a/out/production/code-generater/evaluate.default.properties b/out/production/code-generater/evaluate.default.properties new file mode 100644 index 0000000..d388901 --- /dev/null +++ b/out/production/code-generater/evaluate.default.properties @@ -0,0 +1,36 @@ +#顶层po、dao文件生成总目录 +OutputPath=\\D:\\workproject\\taover-evaluate\\src\\com\\taover\\evaluate\\db\\ +#数据库名 +SchameName=evaluate +CreateSchame=false +TableName=eva_brand +#如果文件存在,是否覆盖 +coverWhenFileExists=false +#数据库库连接信息 +User=tylife +Password=lexi365 +DBLikeStr=% +#数据库驱动类型 +driver=com.mysql.jdbc.Driver +#数据库连接url +URL=jdbc\:mysql\://127.0.0.1\:3306/evaluate +#数据库类型 +dbtype=mysql +#数据库顶层包名 +packageName=com.taover.evaluate.db + +#----------------------------- +# 生成 Controller和Service所需参数 - +#----------------------------- +#模块包全名,controller、service包名都会由此生成 +modulePackageInfo=com.taover.evaluate +#模块本地文件夹路径 +moduleFilePath=\\D:\\workproject\\taover-evaluate\\src\\com\\taover\\evaluate\\ +#db包,同上面的packageName +dbPackageInfo=com.taover.evaluate.db + +#----------------------------- +# 生成View的HTML、JS所需参数 - +#----------------------------- +#WebRoot的本地路径 +WebRootPath=\\D:\\workproject\\taover-evaluate\\WebRoot\\ \ No newline at end of file diff --git a/out/production/code-generater/print.default.properties b/out/production/code-generater/print.default.properties new file mode 100644 index 0000000..4028faa --- /dev/null +++ b/out/production/code-generater/print.default.properties @@ -0,0 +1,37 @@ +#顶层po、dao文件生成总目录 +OutputPath=\\D:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ +#数据库名 +SchameName=taoverprinter +CreateSchame=false +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods +#TableName=erp_order,erp_delivery +TableName=dy_queue +#数据库库连接信息 +User=tylife +Password=lexi365 +#Password=qwe123!@# +DBLikeStr=% +#数据库驱动类型 +driver=com.mysql.jdbc.Driver +#数据库连接url +URL=jdbc\:mysql\://localhost\:3306/taoverprinter +#数据库类型 +dbtype=mysql +#数据库顶层包名 +packageName=com.taover.printer.db + +#----------------------------- +# 生成 Controller和Service所需参数 - +#----------------------------- +#模块包全名,controller、service包名都会由此生成 +modulePackageInfo=com.taover.printer +#模块本地文件夹路径 +moduleFilePath=\\D:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ +#db包,同上面的packageName +dbPackageInfo=com.taover.printer.db + +#----------------------------- +# 生成View的HTML、JS所需参数 - +#----------------------------- +#WebRoot的本地路径 +WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ \ No newline at end of file diff --git a/out/production/code-generater/schedule.default.properties b/out/production/code-generater/schedule.default.properties new file mode 100644 index 0000000..9ebdafd --- /dev/null +++ b/out/production/code-generater/schedule.default.properties @@ -0,0 +1,45 @@ +#顶层po、dao文件生成总目录 +OutputPath=\\D:\\workproject\\soa-schedule\\src\\com\\taover\\erp\\db\\ +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ +#数据库名 +SchameName=tylife +#SchameName=taoverprinter +CreateSchame=false +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods +#TableName=erp_log_name,erp_order_log,erp_delivery_log,erp_base_log +TableName=ecs_users +#数据库库连接信息 +User=tylife +Password=lexi365 +#Password=qwe123!@# +DBLikeStr=% +#数据库驱动类型 +driver=com.mysql.jdbc.Driver +#数据库连接url +URL=jdbc\:mysql\://127.0.0.1\:3306/tylife +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter +#数据库类型 +dbtype=mysql +#数据库顶层包名 +#packageName=com.taover.printer.db +packageName=com.taover.erp.db + +#----------------------------- +# 生成 Controller和Service所需参数 - +#----------------------------- +#模块包全名,controller、service包名都会由此生成 +modulePackageInfo=com.taover.erp +#modulePackageInfo=com.taover.printer +#模块本地文件夹路径 +moduleFilePath=\\D:\\workproject\\soa-schedule\\src\\com\\taover\\ +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ +#db包,同上面的packageName +dbPackageInfo=com.taover.db +#dbPackageInfo=com.taover.printer.db + +#----------------------------- +# 生成View的HTML、JS所需参数 - +#----------------------------- +#WebRoot的本地路径 +WebRootPath=\\D:\\workproject\\esoa-schedule\\WebRoot\\ +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ \ No newline at end of file diff --git a/src/com/taover/ui/EntityGenWindow.java b/src/com/taover/ui/EntityGenWindow.java index b309d40..d85b550 100644 --- a/src/com/taover/ui/EntityGenWindow.java +++ b/src/com/taover/ui/EntityGenWindow.java @@ -177,7 +177,7 @@ public class EntityGenWindow { } private void initPropCombobox(JComboBox comboBox){ - String binDirPath = Tools.getPath(); + String binDirPath = UiUtils.getProjectRoot(); File binDir = new File(binDirPath); File[] sonFileArr = binDir.listFiles(); for(int i=0; i