Commit 69698d27 by WOSHINPC Committed by 独孤求胜

!1 修复BigDecimal未导包问题,添加moduleName、mainPath配置

Merge pull request !1 from WOSHINPC/dev
parents f1bbec38 4bdfca59
#\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F #\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F
mainPath=io.renren
#\u5305\u540D #\u5305\u540D
package=io.renren.modules.generator package=io.renren.modules
moduleName=generator
#\u4F5C\u8005 #\u4F5C\u8005
author=chenshun author=chenshun
#Email #Email
......
package ${package}.controller; package ${package}.${moduleName}.controller;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import ${package}.entity.${className}Entity; import ${package}.${moduleName}.entity.${className}Entity;
import ${package}.service.${className}Service; import ${package}.${moduleName}.service.${className}Service;
import io.renren.common.utils.PageUtils; import ${mainPath}.common.utils.PageUtils;
import io.renren.common.utils.Query; import ${mainPath}.common.utils.Query;
import io.renren.common.utils.R; import ${mainPath}.common.utils.R;
...@@ -28,7 +28,7 @@ import io.renren.common.utils.R; ...@@ -28,7 +28,7 @@ import io.renren.common.utils.R;
* @date ${datetime} * @date ${datetime}
*/ */
@RestController @RestController
@RequestMapping("${pathName}") @RequestMapping("/${moduleName}/${pathName}")
public class ${className}Controller { public class ${className}Controller {
@Autowired @Autowired
private ${className}Service ${classname}Service; private ${className}Service ${classname}Service;
...@@ -37,7 +37,7 @@ public class ${className}Controller { ...@@ -37,7 +37,7 @@ public class ${className}Controller {
* 列表 * 列表
*/ */
@RequestMapping("/list") @RequestMapping("/list")
@RequiresPermissions("${pathName}:list") @RequiresPermissions("${moduleName}:${pathName}:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
//查询列表数据 //查询列表数据
Query query = new Query(params); Query query = new Query(params);
...@@ -55,7 +55,7 @@ public class ${className}Controller { ...@@ -55,7 +55,7 @@ public class ${className}Controller {
* 信息 * 信息
*/ */
@RequestMapping("/info/{${pk.attrname}}") @RequestMapping("/info/{${pk.attrname}}")
@RequiresPermissions("${pathName}:info") @RequiresPermissions("${moduleName}:${pathName}:info")
public R info(@PathVariable("${pk.attrname}") ${pk.attrType} ${pk.attrname}){ public R info(@PathVariable("${pk.attrname}") ${pk.attrType} ${pk.attrname}){
${className}Entity ${classname} = ${classname}Service.queryObject(${pk.attrname}); ${className}Entity ${classname} = ${classname}Service.queryObject(${pk.attrname});
...@@ -66,7 +66,7 @@ public class ${className}Controller { ...@@ -66,7 +66,7 @@ public class ${className}Controller {
* 保存 * 保存
*/ */
@RequestMapping("/save") @RequestMapping("/save")
@RequiresPermissions("${pathName}:save") @RequiresPermissions("${moduleName}:${pathName}:save")
public R save(@RequestBody ${className}Entity ${classname}){ public R save(@RequestBody ${className}Entity ${classname}){
${classname}Service.save(${classname}); ${classname}Service.save(${classname});
...@@ -77,7 +77,7 @@ public class ${className}Controller { ...@@ -77,7 +77,7 @@ public class ${className}Controller {
* 修改 * 修改
*/ */
@RequestMapping("/update") @RequestMapping("/update")
@RequiresPermissions("${pathName}:update") @RequiresPermissions("${moduleName}:${pathName}:update")
public R update(@RequestBody ${className}Entity ${classname}){ public R update(@RequestBody ${className}Entity ${classname}){
${classname}Service.update(${classname}); ${classname}Service.update(${classname});
...@@ -88,7 +88,7 @@ public class ${className}Controller { ...@@ -88,7 +88,7 @@ public class ${className}Controller {
* 删除 * 删除
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
@RequiresPermissions("${pathName}:delete") @RequiresPermissions("${moduleName}:${pathName}:delete")
public R delete(@RequestBody ${pk.attrType}[] ${pk.attrname}s){ public R delete(@RequestBody ${pk.attrType}[] ${pk.attrname}s){
${classname}Service.deleteBatch(${pk.attrname}s); ${classname}Service.deleteBatch(${pk.attrname}s);
......
package ${package}.dao; package ${package}.${moduleName}.dao;
import ${package}.entity.${className}Entity; import ${package}.${moduleName}.entity.${className}Entity;
import io.renren.modules.sys.dao.BaseDao; import ${mainPath}.modules.sys.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package}.dao.${className}Dao"> <mapper namespace="${package}.${moduleName}.dao.${className}Dao">
<!-- 可根据自己的需求,是否要使用 --> <!-- 可根据自己的需求,是否要使用 -->
<resultMap type="${package}.entity.${className}Entity" id="${classname}Map"> <resultMap type="${package}.${moduleName}.entity.${className}Entity" id="${classname}Map">
#foreach($column in $columns) #foreach($column in $columns)
<result property="${column.attrname}" column="${column.columnName}"/> <result property="${column.attrname}" column="${column.columnName}"/>
#end #end
</resultMap> </resultMap>
<select id="queryObject" resultType="${package}.entity.${className}Entity"> <select id="queryObject" resultType="${package}.${moduleName}.entity.${className}Entity">
select * from ${tableName} where ${pk.columnName} = #{value} select * from ${tableName} where ${pk.columnName} = #{value}
</select> </select>
<select id="queryList" resultType="${package}.entity.${className}Entity"> <select id="queryList" resultType="${package}.${moduleName}.entity.${className}Entity">
select * from ${tableName} select * from ${tableName}
<choose> <choose>
<when test="sidx != null and sidx.trim() != ''"> <when test="sidx != null and sidx.trim() != ''">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
select count(*) from ${tableName} select count(*) from ${tableName}
</select> </select>
<insert id="save" parameterType="${package}.entity.${className}Entity"#if($pk.extra == 'auto_increment') useGeneratedKeys="true" keyProperty="$pk.attrname"#end> <insert id="save" parameterType="${package}.${moduleName}.entity.${className}Entity"#if($pk.extra == 'auto_increment') useGeneratedKeys="true" keyProperty="$pk.attrname"#end>
insert into ${tableName} insert into ${tableName}
( (
#foreach($column in $columns) #foreach($column in $columns)
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
) )
</insert> </insert>
<update id="update" parameterType="${package}.entity.${className}Entity"> <update id="update" parameterType="${package}.${moduleName}.entity.${className}Entity">
update ${tableName} update ${tableName}
<set> <set>
#foreach($column in $columns) #foreach($column in $columns)
......
package ${package}.entity; package ${package}.${moduleName}.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
#if(${hasBigDecimal}) #if(${hasBigDecimal})
import java.math.BigDecimal; import java.math.BigDecimal;
#end #end
......
package ${package}.service; package ${package}.${moduleName}.service;
import ${package}.entity.${className}Entity; import ${package}.${moduleName}.entity.${className}Entity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
package ${package}.service.impl; package ${package}.${moduleName}.service.impl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -6,9 +6,9 @@ import org.springframework.stereotype.Service; ...@@ -6,9 +6,9 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import ${package}.dao.${className}Dao; import ${package}.${moduleName}.dao.${className}Dao;
import ${package}.entity.${className}Entity; import ${package}.${moduleName}.entity.${className}Entity;
import ${package}.service.${className}Service; import ${package}.${moduleName}.service.${className}Service;
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
<div id="rrapp" v-cloak> <div id="rrapp" v-cloak>
<div v-show="showList"> <div v-show="showList">
<div class="grid-btn"> <div class="grid-btn">
<a v-if="hasPermission('${pathName}:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a> <a v-if="hasPermission('${moduleName}:${pathName}:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
<a v-if="hasPermission('${pathName}:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a> <a v-if="hasPermission('${moduleName}:${pathName}:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
<a v-if="hasPermission('${pathName}:delete')" class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a> <a v-if="hasPermission('${moduleName}:${pathName}:delete')" class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
</div> </div>
<table id="jqGrid"></table> <table id="jqGrid"></table>
<div id="jqGridPager"></div> <div id="jqGridPager"></div>
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
</div> </div>
</div> </div>
<script src="../../js/modules/generator/${pathName}.js"></script> <script src="../../js/modules/${moduleName}/${pathName}.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
$(function () { $(function () {
$("#jqGrid").jqGrid({ $("#jqGrid").jqGrid({
url: baseURL + '${pathName}/list', url: baseURL + '${moduleName}/${pathName}/list',
datatype: "json", datatype: "json",
colModel: [ colModel: [
#foreach($column in $columns) #foreach($column in $columns)
...@@ -66,7 +66,7 @@ var vm = new Vue({ ...@@ -66,7 +66,7 @@ var vm = new Vue({
vm.getInfo(${pk.attrname}) vm.getInfo(${pk.attrname})
}, },
saveOrUpdate: function (event) { saveOrUpdate: function (event) {
var url = vm.${classname}.${pk.attrname} == null ? "${pathName}/save" : "${pathName}/update"; var url = vm.${classname}.${pk.attrname} == null ? "${moduleName}/${pathName}/save" : "${moduleName}/${pathName}/update";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: baseURL + url, url: baseURL + url,
...@@ -92,7 +92,7 @@ var vm = new Vue({ ...@@ -92,7 +92,7 @@ var vm = new Vue({
confirm('确定要删除选中的记录?', function(){ confirm('确定要删除选中的记录?', function(){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: baseURL + "${pathName}/delete", url: baseURL + "${moduleName}/${pathName}/delete",
contentType: "application/json", contentType: "application/json",
data: JSON.stringify(${pk.attrname}s), data: JSON.stringify(${pk.attrname}s),
success: function(r){ success: function(r){
...@@ -108,7 +108,7 @@ var vm = new Vue({ ...@@ -108,7 +108,7 @@ var vm = new Vue({
}); });
}, },
getInfo: function(${pk.attrname}){ getInfo: function(${pk.attrname}){
$.get(baseURL + "${pathName}/info/"+${pk.attrname}, function(r){ $.get(baseURL + "${moduleName}/${pathName}/info/"+${pk.attrname}, function(r){
vm.${classname} = r.${classname}; vm.${classname} = r.${classname};
}); });
}, },
......
-- 菜单SQL -- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '${comments}', 'modules/generator/${pathName}.html', NULL, '1', 'fa fa-file-code-o', '6'); VALUES ('1', '${comments}', 'modules/${moduleName}/${pathName}.html', NULL, '1', 'fa fa-file-code-o', '6');
-- 按钮父菜单ID -- 按钮父菜单ID
set @parentId = @@identity; set @parentId = @@identity;
-- 菜单对应按钮SQL -- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, '${pathName}:list,${pathName}:info', '2', null, '6'; SELECT @parentId, '查看', null, '${moduleName}:${pathName}:list,${pathName}:info', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, '${pathName}:save', '2', null, '6'; SELECT @parentId, '新增', null, '${moduleName}:${pathName}:save', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, '${pathName}:update', '2', null, '6'; SELECT @parentId, '修改', null, '${moduleName}:${pathName}:update', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, '${pathName}:delete', '2', null, '6'; SELECT @parentId, '删除', null, '${moduleName}:${pathName}:delete', '2', null, '6';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment