-
-
-
-
-
-
-
-
-
-
diff --git a/generator-web/src/main/resources/static/version.json b/generator-web/src/main/resources/static/version.json
index 4316322..1a280a3 100644
--- a/generator-web/src/main/resources/static/version.json
+++ b/generator-web/src/main/resources/static/version.json
@@ -1 +1 @@
-{"version": "20200306"}
\ No newline at end of file
+{"version": "20200522"}
\ No newline at end of file
diff --git a/generator-web/src/main/resources/template.json b/generator-web/src/main/resources/template.json
new file mode 100644
index 0000000..ca98f76
--- /dev/null
+++ b/generator-web/src/main/resources/template.json
@@ -0,0 +1,164 @@
+[
+ {
+ "id": "10",
+ "name": "swagger-ui",
+ "group": "ui",
+ "description": "swagger-ui"
+ },
+ {
+ "id": "11",
+ "name": "element-ui",
+ "group": "ui",
+ "description": "element-ui"
+ },
+ {
+ "id": "12",
+ "name": "bootstrap-ui",
+ "group": "ui",
+ "description": "bootstrap-ui"
+ },
+ {
+ "id": "13",
+ "name": "layui-edit",
+ "group": "ui",
+ "description": "layui-edit"
+ },
+ {
+ "id": "14",
+ "name": "layui-list",
+ "group": "ui",
+ "description": "layui-list"
+ },
+ {
+ "id": "20",
+ "name": "controller",
+ "group": "mybatis",
+ "description": "controller"
+ },
+ {
+ "id": "21",
+ "name": "service",
+ "group": "mybatis",
+ "description": "service"
+ },
+ {
+ "id": "22",
+ "name": "service_impl",
+ "group": "mybatis",
+ "description": "service_impl"
+ },
+ {
+ "id": "23",
+ "name": "mapper",
+ "group": "mybatis",
+ "description": "mapper"
+ },
+ {
+ "id": "24",
+ "name": "mybatis",
+ "group": "mybatis",
+ "description": "mybatis"
+ },
+ {
+ "id": "25",
+ "name": "model",
+ "group": "mybatis",
+ "description": "model"
+ },
+ {
+ "id": "26",
+ "name": "mapper2",
+ "group": "mybatis",
+ "description": "mapper annotation"
+ },
+ {
+ "id": "30",
+ "name": "entity",
+ "group": "jpa",
+ "description": "entity"
+ },
+ {
+ "id": "31",
+ "name": "repository",
+ "group": "jpa",
+ "description": "repository"
+ },
+ {
+ "id": "32",
+ "name": "jpacontroller",
+ "group": "jpa",
+ "description": "jpacontroller"
+ },
+ {
+ "id": "40",
+ "name": "jtdao",
+ "group": "jdbc-template",
+ "description": "jtdao"
+ },
+ {
+ "id": "41",
+ "name": "jtdaoimpl",
+ "group": "jdbc-template",
+ "description": "jtdaoimpl"
+ },
+ {
+ "id": "50",
+ "name": "beetlmd",
+ "group": "beetlsql",
+ "description": "beetlmd"
+ },
+ {
+ "id": "51",
+ "name": "beetlentity",
+ "group": "beetlsql",
+ "description": "beetlentity"
+ },
+ {
+ "id": "52",
+ "name": "beetlcontroller",
+ "group": "beetlsql",
+ "description": "beetlcontroller"
+ },
+ {
+ "id": "60",
+ "name": "pluscontroller",
+ "group": "mybatis-plus",
+ "description": "pluscontroller"
+ },
+ {
+ "id": "61",
+ "name": "plusmapper",
+ "group": "mybatis-plus",
+ "description": "plusmapper"
+ },
+ {
+ "id": "62",
+ "name": "plusentity",
+ "group": "mybatis-plus",
+ "description": "plusentity"
+ },
+ {
+ "id": "70",
+ "name": "beanutil",
+ "group": "util",
+ "description": "beanutil"
+ },
+ {
+ "id": "71",
+ "name": "json",
+ "group": "util",
+ "description": "json"
+ },
+ {
+ "id": "72",
+ "name": "xml",
+ "group": "util",
+ "description": "xml"
+ },
+ {
+ "id": "73",
+ "name": "sql",
+ "group": "util",
+ "description": "sql"
+ }
+]
\ No newline at end of file
diff --git a/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlcontroller.ftl b/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlcontroller.ftl
index a9604ed..ab7cdb6 100644
--- a/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlcontroller.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlcontroller.ftl
@@ -9,7 +9,7 @@ import java.util.Map;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@RestController
@RequestMapping("/${classInfo.className?uncap_first}")
diff --git a/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlentity.ftl b/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlentity.ftl
index e20de00..77e2dc3 100644
--- a/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlentity.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/beetlsql/beetlentity.ftl
@@ -6,7 +6,7 @@ import java.util.List;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@Data<#if swagger?exists && swagger==true>
@ApiModel("${classInfo.classComment}")#if>
diff --git a/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdao.ftl b/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdao.ftl
index 14bc245..ba92731 100644
--- a/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdao.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdao.ftl
@@ -4,7 +4,7 @@ import java.util.List;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
public interface I${classInfo.className}DAO {
diff --git a/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdaoimpl.ftl b/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdaoimpl.ftl
index a3b62c0..4e0da92 100644
--- a/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdaoimpl.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/jdbc-template/jtdaoimpl.ftl
@@ -8,7 +8,7 @@ import java.util.List;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@Repository
public class ${classInfo.className}DaoImpl implements I${classInfo.className}Dao{
diff --git a/generator-web/src/main/resources/templates/code-generator/jpa/entity.ftl b/generator-web/src/main/resources/templates/code-generator/jpa/entity.ftl
index 7a80dbd..ac86bab 100644
--- a/generator-web/src/main/resources/templates/code-generator/jpa/entity.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/jpa/entity.ftl
@@ -15,7 +15,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@Entity
@Data
diff --git a/generator-web/src/main/resources/templates/code-generator/jpa/jpacontroller.ftl b/generator-web/src/main/resources/templates/code-generator/jpa/jpacontroller.ftl
index bbe7ff2..6371e17 100644
--- a/generator-web/src/main/resources/templates/code-generator/jpa/jpacontroller.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/jpa/jpacontroller.ftl
@@ -17,7 +17,7 @@ import java.util.Map;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@RestController
@RequestMapping("/${classInfo.className?uncap_first}")
diff --git a/generator-web/src/main/resources/templates/code-generator/jpa/repository.ftl b/generator-web/src/main/resources/templates/code-generator/jpa/repository.ftl
index dbfb469..7573fad 100644
--- a/generator-web/src/main/resources/templates/code-generator/jpa/repository.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/jpa/repository.ftl
@@ -16,7 +16,7 @@ import org.springframework.stereotype.Repository;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@Repository
public interface ${classInfo.className}Repository extends JpaRepository<${classInfo.className},Integer> {
diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/pluscontroller.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/pluscontroller.ftl
index ce1d950..a9b1338 100644
--- a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/pluscontroller.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/pluscontroller.ftl
@@ -20,7 +20,7 @@ import java.util.Map;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
-* @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+* @date ${.now?string('yyyy-MM-dd')}
*/
@Slf4j
@RestController
@@ -37,17 +37,17 @@ public class ${classInfo.className}Controller {
public Object save(@RequestBody ${classInfo.className} ${classInfo.className?uncap_first}){
log.info("${classInfo.className?uncap_first}:"+JSON.toJSONString(${classInfo.className?uncap_first}));
${classInfo.className} old${classInfo.className} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",${classInfo.className?uncap_first}.get${classInfo.className}Id()));
- ${classInfo.className?uncap_first}.setModifyDate(new Date());
+ ${classInfo.className?uncap_first}.setUpdateTime(new Date());
if(old${classInfo.className}!=null){
${classInfo.className?uncap_first}Mapper.updateById(${classInfo.className?uncap_first});
}else{
if(${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_name",${classInfo.className?uncap_first}.get${classInfo.className}Name()))!=null){
- return new ReturnT<>(ReturnT.FAIL_CODE,"保存失败,名字重复");
+ return ${returnUtil}.ERROR("保存失败,名字重复");
}
- ${classInfo.className?uncap_first}.setCreateDate(new Date());
+ ${classInfo.className?uncap_first}.setCreateTime(new Date());
${classInfo.className?uncap_first}Mapper.insert(${classInfo.className?uncap_first});
}
- return new ReturnT<>(ReturnT.SUCCESS_CODE,"保存成功");
+ return ${returnUtil}.SUCCESS("保存成功");
}
/**
@@ -58,9 +58,9 @@ public class ${classInfo.className}Controller {
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
if(${classInfo.className?uncap_first}!=null){
${classInfo.className?uncap_first}Mapper.deleteById(id);
- return new ReturnT<>(ReturnT.SUCCESS_CODE,"删除成功");
+ return ${returnUtil}.SUCCESS("删除成功");
}else{
- return new ReturnT<>(ReturnT.FAIL_CODE,"没有找到该对象");
+ return ${returnUtil}.ERROR("没有找到该对象");
}
}
@@ -71,14 +71,14 @@ public class ${classInfo.className}Controller {
public Object find(int id){
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
if(${classInfo.className?uncap_first}!=null){
- return new ReturnT<>(${classInfo.className?uncap_first});
+ return ${returnUtil}.SUCCESS(${classInfo.className?uncap_first});
}else{
- return new ReturnT<>(ReturnT.FAIL_CODE,"没有找到该对象");
+ return ${returnUtil}.ERROR("没有找到该对象");
}
}
/**
- * 分页查询
+ * 自动分页查询
*/
@PostMapping("/list")
public Object list(String searchParams,
@@ -96,17 +96,57 @@ public class ${classInfo.className}Controller {
//执行分页
IPage<${classInfo.className}> pageList = ${classInfo.className?uncap_first}Mapper.selectPage(buildPage, queryWrapper);
//返回结果
- return new ReturnT<>(pageList.getRecords(),Integer.parseInt(pageList.getTotal()+""));
+ return ${returnUtil}.PAGE(pageList.getRecords(),pageList.getTotal());
+ }
+ /**
+ * 手工分页查询(按需使用)
+ */
+ @PostMapping("/list2")
+ public ReturnT list2(String searchParams,
+ @RequestParam(required = false, defaultValue = "0") int page,
+ @RequestParam(required = false, defaultValue = "10") int limit) {
+ log.info("searchParams:"+ JSON.toJSONString(searchParams));
+ //通用模式
+ ${classInfo.className} queryParamDTO = JSON.parseObject(searchParams, ${classInfo.className}.class);
+ //专用DTO模式
+ //QueryParamDTO queryParamDTO = JSON.parseObject(searchParams, QueryParamDTO.class);
+ //queryParamDTO.setPage((page - 1)* limit);
+ //queryParamDTO.setLimit(limit);
+ //(page - 1) * limit, limit
+ List<${classInfo.className}> itemList = ${classInfo.className?uncap_first}Mapper.pageAll(queryParamDTO,(page - 1)* limit,limit);
+ Integer itemCount = ${classInfo.className?uncap_first}Mapper.countAll(queryParamDTO);
+ //返回结果
+ return ReturnT.PAGE(itemList,itemCount);
}
@GetMapping("/list")
public ModelAndView listPage(){
return new ModelAndView("cms/${classInfo.className?uncap_first}-list");
}
+
@GetMapping("/edit")
public ModelAndView editPage(int id){
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
return new ModelAndView("cms/${classInfo.className?uncap_first}-edit","${classInfo.className?uncap_first}",${classInfo.className?uncap_first});
}
+
+ /**
+ * 发布/暂停(如不需要请屏蔽)
+ */
+ @PostMapping("/publish")
+ public Object publish(int id,Integer status){
+ ${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
+ if(${classInfo.className?uncap_first}!=null){
+ ${classInfo.className?uncap_first}.setUpdateTime(new Date());
+ ${classInfo.className?uncap_first}.setStatus(status);
+ ${classInfo.className?uncap_first}Mapper.updateById(${classInfo.className?uncap_first});
+ return ReturnT.SUCCESS((status==1)?"已发布":"已暂停");
+ }else if(status.equals(${classInfo.className?uncap_first}.getStatus())){
+ return ReturnT.SUCCESS("状态不正确");
+ }else{
+ return ReturnT.ERROR();
+ }
+ }
+
}
diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl
index 887dd2a..ed01b9d 100644
--- a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusentity.ftl
@@ -10,10 +10,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
-@Data
-<#if swagger?exists && swagger==true>@ApiModel("${classInfo.classComment}")#if>
+@Data<#if swagger?exists && swagger==true>
+@ApiModel("${classInfo.classComment}")#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusmapper.ftl b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusmapper.ftl
index 1b7901b..321b76a 100644
--- a/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusmapper.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/mybatis-plus/plusmapper.ftl
@@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import ${packageName}.entity.${classInfo.className};
+import java.util.List;
/**
* @description ${classInfo.classComment}
* @author ${authorName}
- * @date ${.now?string('yyyy-MM-dd HH:mm:ss')}
+ * @date ${.now?string('yyyy-MM-dd')}
*/
@Mapper
public interface ${classInfo.className}Mapper extends BaseMapper<${classInfo.className}> {
@@ -23,7 +24,7 @@ public interface ${classInfo.className}Mapper extends BaseMapper<${classInfo.cla
//add here if need page limit
//" limit ¥{page},¥{limit} " +
" ")
- List<${classInfo.className}> pageAll(${classInfo.className} queryParamDTO);
+ List<${classInfo.className}> pageAll(${classInfo.className} queryParamDTO,int page,int limit);
@Select("
@@ -52,11 +52,20 @@
删除
-
+
@@ -66,8 +75,7 @@
layui.use(['form', 'table'], function () {
var $ = layui.jquery,
form = layui.form,
- table = layui.table,
- layuimini = layui.layuimini;
+ table = layui.table;
table.render({
elem: '#currentTableId',
@@ -83,23 +91,26 @@
{type: "checkbox", width: 50, fixed: "left"},
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
<#list classInfo.fieldList as fieldItem >
- {field: '${fieldItem.fieldName}', width: 150, title: '${fieldItem.fieldComment}', sort: true}, <#if fieldItem_has_next> #if>
+ {field: '${fieldItem.fieldName}', title: '${fieldItem.fieldComment}', sort: true}, <#if fieldItem_has_next> #if>
#list>
#if>
- {title: '操作', minWidth: 50, templet: '#currentTableBar', fixed: "right", align: "center"}
+ /* 需要时间请自行解封
+ {title: '创建时间', sort: true,templet: "{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd')}}
"},
+ {title: '修改时间', sort: true,templet: "{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd')}}
"},
+ */
+ {title: '操作', minWidth: 400, templet: '#currentTableBar', fixed: "right", align: "center"}
]],
- limits: [10, 20, 50 , 100],
- limit: 10,
+ limits: [20 , 50 , 100],
+ limit: 20,
page: true
});
var result;
- // 监听搜索操作
+ /**
+ * submit(data-search-btn):监听搜索操作
+ */
form.on('submit(data-search-btn)', function (data) {
result = JSON.stringify(data.field);
- // layer.alert(result, {
- // title: '最终的搜索信息'
- // });
//执行搜索重载
table.reload('currentTableId', {
@@ -113,51 +124,54 @@
return false;
});
+
var searchBtn = $("#searchBtn");
- // 监听添加操作
- $(".data-add-btn").on("click", function () {
- var index = layer.open({
- title: '添加${classInfo.classComment}',
- type: 2,
- shade: 0.2,
- maxmin:true,
- shadeClose: true,
- area: ['800px', '500px'],
- content: '¥{request.contextPath}/${classInfo.className?uncap_first}/edit?id=0',
- });
- layer.full(index);
- return false;
- });
-
- // 监听删除操作
- $(".data-delete-btn").on("click", function () {
- var checkStatus = table.checkStatus('currentTableId')
- , data = checkStatus.data;
- layer.alert(JSON.stringify(data));
- });
-
- //监听表格复选框选择
- table.on('checkbox(currentTableFilter)', function (obj) {
- console.log(obj)
- });
-
- //监听表格编辑删除等功能按钮
- table.on('tool(currentTableFilter)', function (obj) {
- var data = obj.data;
- if (obj.event === 'edit') {
+ /**
+ * toolbar监听事件:表格添加按钮
+ */
+ table.on('toolbar(currentTableFilter)', function (obj) {
+ if (obj.event === 'add') {
var index = layer.open({
- title: '编辑${classInfo.classComment}',
+ title: '添加',
type: 2,
shade: 0.2,
maxmin:true,
shadeClose: true,
- area: ['800px', '500px'],
+ area: ['1000px', '700px'],
+ content: '¥{request.contextPath}/${classInfo.className?uncap_first}/edit?id=0',
+ });
+ return false;
+ }else if(obj.event === 'del') {
+ var checkStatus = table.checkStatus('currentTableId')
+ , data = checkStatus.data;
+ layer.alert(JSON.stringify(data));
+ }
+ });
+ /**
+ * checkbox(currentTableFilter):表格复选框选择
+ */
+ table.on('checkbox(currentTableFilter)', function (obj) {
+ //console.log(obj)
+ });
+
+ /**
+ * tool监听事件:表格编辑删除等功能按钮
+ */
+ table.on('tool(currentTableFilter)', function (obj) {
+ var data = obj.data;
+ if (obj.event === 'edit') {
+ var index = layer.open({
+ title: '编辑',
+ type: 2,
+ shade: 0.2,
+ maxmin:true,
+ shadeClose: true,
+ area: ['1000px', '700px'],
content: '¥{request.contextPath}/${classInfo.className?uncap_first}/edit?id='+obj.data.${classInfo.className?uncap_first}Id,
});
- layer.full(index);
return false;
} else if (obj.event === 'delete') {
- layer.confirm('真的删除行么', function (index) {
+ layer.confirm('确认删除该记录吗?', function (index) {
$.ajax({
type: 'POST',
url: "¥{request.contextPath}/${classInfo.className?uncap_first}/delete",
@@ -169,13 +183,40 @@
});
} else {
layer.msg(responseData.msg, function () {
- //window.location = '/index.html';
});
}
}
});
layer.close(index);
});
+ }else if (obj.event === 'publish') {
+ layer.confirm('确定要发布吗?', function (index) {
+ $.ajax({
+ type: 'POST',
+ url: "¥{request.contextPath}/${classInfo.className?uncap_first}/publish",
+ data:{"id":obj.data.${classInfo.className?uncap_first}Id,"status":"1"},
+ success: function (responseData) {
+ searchBtn.click();
+ layer.msg(responseData.msg, function () {
+ });
+ }
+ });
+ layer.close(index);
+ });
+ }else if (obj.event === 'unpublish') {
+ layer.confirm('确定要停止吗?', function (index) {
+ $.ajax({
+ type: 'POST',
+ url: "¥{request.contextPath}/${classInfo.className?uncap_first}/publish",
+ data:{"id":obj.data.${classInfo.className?uncap_first}Id,"status":"0"},
+ success: function (responseData) {
+ searchBtn.click();
+ layer.msg(responseData.msg, function () {
+ });
+ }
+ });
+ layer.close(index);
+ });
}
});
diff --git a/generator-web/src/main/resources/templates/code-generator/util/beanutil.ftl b/generator-web/src/main/resources/templates/code-generator/util/beanutil.ftl
new file mode 100644
index 0000000..b293944
--- /dev/null
+++ b/generator-web/src/main/resources/templates/code-generator/util/beanutil.ftl
@@ -0,0 +1,41 @@
+/**
+* ${classInfo.classComment}对象Get Set
+* @author ${authorName} ${.now?string('yyyy-MM-dd')}
+*/
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+${fieldItem.fieldClass} ${fieldItem.fieldName} = ${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}();
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}();
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}());
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+map.put("${fieldItem.columnName}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+map.put("${fieldItem.fieldComment}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
+#list>
+
+<#list classInfo.fieldList as fieldItem>
+// ${fieldItem.fieldComment}
+map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
+#list>
+
+#if>
diff --git a/generator-web/src/main/resources/templates/code-generator/util/json.ftl b/generator-web/src/main/resources/templates/code-generator/util/json.ftl
index a0be13a..8de14f6 100644
--- a/generator-web/src/main/resources/templates/code-generator/util/json.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/util/json.ftl
@@ -1,7 +1,7 @@
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
{
<#list classInfo.fieldList as fieldItem>
- "${fieldItem.fieldName}":""<#if fieldItem_has_next>,#if>
+ "${fieldItem.fieldName}":"${fieldItem.fieldComment}"<#if fieldItem_has_next>,#if>
#list>
}
#if>
diff --git a/generator-web/src/main/resources/templates/code-generator/util/sql.ftl b/generator-web/src/main/resources/templates/code-generator/util/sql.ftl
new file mode 100644
index 0000000..848f6e8
--- /dev/null
+++ b/generator-web/src/main/resources/templates/code-generator/util/sql.ftl
@@ -0,0 +1,58 @@
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+ SELECT
+ <#list classInfo.fieldList as fieldItem >
+ ${fieldItem.columnName}<#if fieldItem_has_next>,#if>
+ #list>
+ FROM
+ ${classInfo.tableName}
+ WHERE
+ <#list classInfo.fieldList as fieldItem >
+ <#if fieldItem_index != 0>AND #if>${fieldItem.columnName} = ''
+ #list>;
+#if>
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+ SELECT
+ *
+ FROM
+ ${classInfo.tableName} t1
+ LEFT JOIN xxx t2
+ ON t1.${classInfo.tableName}_id=t2.${classInfo.tableName}_id
+ WHERE 1=1;
+#if>
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+ INSERT INTO ${classInfo.tableName} ( <#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,#if>#list> )
+ VALUES
+ (
+ <#list classInfo.fieldList as fieldItem >
+ ''<#if fieldItem_has_next>,#if>
+ #list>
+ );
+#if>
+
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+ UPDATE ${classInfo.tableName}
+ SET
+ <#list classInfo.fieldList as fieldItem >
+ ${fieldItem.columnName} = ''<#if fieldItem_has_next>,#if>
+ #list>
+ WHERE
+ <#list classInfo.fieldList as fieldItem >
+ ${fieldItem.columnName} = ''<#if fieldItem_has_next>,#if>
+ #list>;
+#if>
+
+
+
+<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
+ DELETE
+ FROM
+ ${classInfo.tableName}
+ WHERE
+ <#list classInfo.fieldList as fieldItem >
+ ${fieldItem.columnName} = ''<#if fieldItem_has_next>,#if>
+ #list>;
+#if>
diff --git a/generator-web/src/main/resources/templates/code-generator/util/util.ftl b/generator-web/src/main/resources/templates/code-generator/util/util.ftl
deleted file mode 100644
index 13da0ab..0000000
--- a/generator-web/src/main/resources/templates/code-generator/util/util.ftl
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
-* ${classInfo.classComment}对象Get Set
-* @author ${authorName} ${.now?string('yyyy-MM-dd')}
-*/
-
-<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
-<#list classInfo.fieldList as fieldItem>
-// ${fieldItem.fieldComment}
-${fieldItem.fieldClass} ${fieldItem.fieldName} = ${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}();
-#list>
-
-<#list classInfo.fieldList as fieldItem>
-// ${fieldItem.fieldComment}
-${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}();
-#list>
-
-<#list classInfo.fieldList as fieldItem>
-// ${fieldItem.fieldComment}
-${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}(););
-#list>
-#if>
diff --git a/generator-web/src/main/resources/templates/code-generator/util/xml.ftl b/generator-web/src/main/resources/templates/code-generator/util/xml.ftl
index d815657..3959cfc 100644
--- a/generator-web/src/main/resources/templates/code-generator/util/xml.ftl
+++ b/generator-web/src/main/resources/templates/code-generator/util/xml.ftl
@@ -5,7 +5,7 @@
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
<${classInfo.className}>
<#list classInfo.fieldList as fieldItem>
- <${fieldItem.fieldName}>${fieldItem.fieldName}>
+ <${fieldItem.fieldName}>${fieldItem.fieldComment}${fieldItem.fieldName}>
#list>
${classInfo.className}>
#if>
diff --git a/generator-web/src/main/resources/templates/index.ftl b/generator-web/src/main/resources/templates/index.ftl
index 7eecedc..c50975f 100644
--- a/generator-web/src/main/resources/templates/index.ftl
+++ b/generator-web/src/main/resources/templates/index.ftl
@@ -154,7 +154,7 @@
*/
function donate(){
if($("#donate").attr("show")=="no"){
- $("#donate").html('
');
+ $("#donate").html('
');
$("#donate").attr("show","yes");
}else{
$("#donate").html('谢谢赞赏!
');
@@ -206,7 +206,7 @@
BeJSON在线工具站
@@ -217,7 +217,9 @@
@@ -386,28 +388,16 @@ CREATE TABLE 'userinfo' (
-
-
diff --git a/pom.xml b/pom.xml
index de80f1b..0c7f77c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,14 +74,6 @@
1.2.8.RELEASE
-->
-
-
-
- cn.hutool
- hutool-all
- 5.3.2
-
-
org.projectlombok
@@ -89,41 +81,12 @@
1.18.12
-
-
- org.apache.commons
- commons-lang3
- 3.8
-
-
org.springframework.boot
spring-boot-starter-freemarker
-
-
-
@@ -186,7 +149,6 @@
org.springframework.boot
spring-boot-maven-plugin
- 2.0.4.RELEASE