Commit 98f89d4a authored by 李成龙's avatar 李成龙

修改代码生成模板

parent d29d1971
package com.yeejoin.amos.boot.biz.common.utils; package com.yeejoin.amos.boot.biz.common.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import org.apache.commons.lang.StringUtils;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.FileOutConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.ITypeConvert;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.TemplateConfig;
import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
import com.baomidou.mybatisplus.generator.config.rules.IColumnType; import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/** /**
* @author DELL * @author DELL
...@@ -26,7 +33,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -26,7 +33,7 @@ public class MyBatisPlusCodeGenerator {
/** /**
* 项目名称缩写 * 项目名称缩写
*/ */
static String projectShortName = "jcs"; static String projectShortName = "common";
/** /**
* 项目api目录 * 项目api目录
...@@ -53,13 +60,13 @@ public class MyBatisPlusCodeGenerator { ...@@ -53,13 +60,13 @@ public class MyBatisPlusCodeGenerator {
/** /**
* 接口及实体等代码生成路径 * 接口及实体等代码生成路径
*/ */
static String interfaceCodeOutPath = System.getProperty("user.dir") + apiPath; static String interfaceCodeOutPath = System.getProperty("user.dir").replace("\\amos-boot-biz-common", "") + apiPath;
/** /**
* 控制器及接口实现等代码生成路径 * 控制器及接口实现等代码生成路径
*/ */
static String controllerCodeOutPath = System.getProperty("user.dir") + bizPath; static String controllerCodeOutPath = System.getProperty("user.dir").replace("\\amos-boot-biz-common", "") + bizPath;
/** /**
...@@ -86,11 +93,12 @@ public class MyBatisPlusCodeGenerator { ...@@ -86,11 +93,12 @@ public class MyBatisPlusCodeGenerator {
// 全局配置 // 全局配置
GlobalConfig gc = new GlobalConfig(); GlobalConfig gc = new GlobalConfig();
// 工程路径-最外层 // 工程路径-最外层
final String projectPath = System.getProperty("user.dir"); final String projectPath = System.getProperty("user.dir").replace("\\amos-boot-biz-common", "");
System.out.println("projectPath:"+projectPath);
// 代码输出目录 // 代码输出目录
//gc.setOutputDir(codeOutPath); //gc.setOutputDir(codeOutPath);
// 作者 // 作者
gc.setAuthor("tb"); gc.setAuthor("system_generator");
// 是否自动打开文件夹 建议开启 // 是否自动打开文件夹 建议开启
gc.setOpen(false); gc.setOpen(false);
// 开启Swagger2 注解支持 // 开启Swagger2 注解支持
...@@ -103,7 +111,8 @@ public class MyBatisPlusCodeGenerator { ...@@ -103,7 +111,8 @@ public class MyBatisPlusCodeGenerator {
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-jcs-biz?serverTimezone=GMT%2B8"); dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-jcs-biz?serverTimezone=GMT%2B8");
// dsc.setSchemaName("public"); // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver"); // dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root"); dsc.setUsername("root");
dsc.setPassword("root_123"); dsc.setPassword("root_123");
...@@ -135,6 +144,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -135,6 +144,7 @@ public class MyBatisPlusCodeGenerator {
pc.setService("api.service"); pc.setService("api.service");
pc.setServiceImpl("biz.service.impl"); pc.setServiceImpl("biz.service.impl");
pc.setController("biz.controller"); pc.setController("biz.controller");
pc.setXml("api.dto");
autoGenerator.setPackageInfo(pc); autoGenerator.setPackageInfo(pc);
// 自定义配置 // 自定义配置
...@@ -162,6 +172,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -162,6 +172,7 @@ public class MyBatisPlusCodeGenerator {
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = controllerCodeOutPath String filePath = controllerCodeOutPath
+ "/controller/" + tableInfo.getControllerName() + StringPool.DOT_JAVA; + "/controller/" + tableInfo.getControllerName() + StringPool.DOT_JAVA;
System.out.println("controller:"+filePath);
return filePath; return filePath;
} }
}); });
...@@ -171,6 +182,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -171,6 +182,7 @@ public class MyBatisPlusCodeGenerator {
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/entity/" + tableInfo.getEntityName() + StringPool.DOT_JAVA; + "/entity/" + tableInfo.getEntityName() + StringPool.DOT_JAVA;
System.out.println("entity:"+filePath);
return filePath; return filePath;
} }
}); });
...@@ -181,40 +193,48 @@ public class MyBatisPlusCodeGenerator { ...@@ -181,40 +193,48 @@ public class MyBatisPlusCodeGenerator {
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/dto/" + tableInfo.getEntityName() + "Dto" + StringPool.DOT_JAVA; + "/dto/" + tableInfo.getEntityName() + "Dto" + StringPool.DOT_JAVA;
System.out.println("dto:"+filePath);
return filePath; return filePath;
} }
}); });
focList.add(new FileOutConfig(vo) { // focList.add(new FileOutConfig(vo) {
@Override // @Override
public String outputFile(TableInfo tableInfo) { // public String outputFile(TableInfo tableInfo) {
String filePath = interfaceCodeOutPath // String filePath = interfaceCodeOutPath
+ "/vo/" + tableInfo.getEntityName() + "Vo" + StringPool.DOT_JAVA; // + "/vo/" + tableInfo.getEntityName() + "Vo" + StringPool.DOT_JAVA;
return filePath; // System.out.println("vo:"+filePath);
} // return filePath;
}); // }
// });
focList.add(new FileOutConfig(mapper) { focList.add(new FileOutConfig(mapper) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
return interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_JAVA; + "/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_JAVA;
System.out.println("mapper:"+filePath);
return filePath;
} }
}); });
focList.add(new FileOutConfig(service) { focList.add(new FileOutConfig(service) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
return interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/service/" + tableInfo.getServiceName() + StringPool.DOT_JAVA; + "/service/" + tableInfo.getServiceName() + StringPool.DOT_JAVA;
System.out.println("service:"+filePath);
return filePath;
} }
}); });
focList.add(new FileOutConfig(serviceImpl) { focList.add(new FileOutConfig(serviceImpl) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
return controllerCodeOutPath String filePath = controllerCodeOutPath
+ "/service/impl/" + tableInfo.getServiceImplName() + StringPool.DOT_JAVA; + "/service/impl/" + tableInfo.getServiceImplName() + StringPool.DOT_JAVA;
System.out.println("service/impl:"+filePath);
return filePath;
} }
}); });
...@@ -231,7 +251,9 @@ public class MyBatisPlusCodeGenerator { ...@@ -231,7 +251,9 @@ public class MyBatisPlusCodeGenerator {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + apiAddress + "src/main/resources/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; String filePath = projectPath + apiAddress + "src/main/resources/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
System.out.println("mapper:"+filePath);
return filePath;
} }
}); });
......
...@@ -12,11 +12,6 @@ import lombok.Data; ...@@ -12,11 +12,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
</#if> </#if>
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/** /**
* ${table.comment!} * ${table.comment!}
* *
......
...@@ -2,7 +2,6 @@ package ${package.Controller}; ...@@ -2,7 +2,6 @@ package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
<#if restControllerStyle> <#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
<#else> <#else>
...@@ -11,20 +10,17 @@ import org.springframework.stereotype.Controller; ...@@ -11,20 +10,17 @@ import org.springframework.stereotype.Controller;
<#if superControllerClassPackage??> <#if superControllerClassPackage??>
import ${superControllerClassPackage}; import ${superControllerClassPackage};
</#if> </#if>
import java.util.List;
import ${package.Service}.${table.serviceName}; import ${package.ServiceImpl}.${table.serviceImplName};
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import ${package.Entity}.${entity}; import ${package.Xml}.${entity}Dto;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Arrays;
/** /**
...@@ -50,106 +46,81 @@ public class ${table.controllerName} { ...@@ -50,106 +46,81 @@ public class ${table.controllerName} {
</#if> </#if>
@Autowired @Autowired
${table.serviceName} ${table.serviceName ?uncap_first}; ${table.serviceImplName} ${table.serviceImplName ?uncap_first};
/** /**
* 新增${table.comment} * 新增${table.comment}
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST) @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增${table.comment}", notes = "新增${table.comment}") @ApiOperation(httpMethod = "POST", value = "新增${table.comment}", notes = "新增${table.comment}")
public boolean save${entity}(HttpServletRequest request, @RequestBody ${entity} ${entity ?uncap_first}){ public ResponseModel<${entity}Dto> save(@RequestBody ${entity}Dto model)
return ${table.serviceName ?uncap_first}.save(${entity ?uncap_first}); {
model=${table.serviceImplName ?uncap_first}.createWithModel(model);
return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据id删除 * 根据sequenceNbr更新
* @param id * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新${table.comment}", notes = "根据sequenceNbr更新${table.comment}")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){ public ResponseModel<${entity}Dto> updateBySequenceNbr${entity}(@RequestBody ${entity}Dto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ${table.serviceName ?uncap_first}.removeById(id); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(${table.serviceImplName ?uncap_first}.updateWithModel(model));
} }
/** /**
* 修改${table.comment} * 根据sequenceNbr删除
* @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT) @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "修改${table.comment}", notes = "修改${table.comment}") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除${table.comment}", notes = "根据sequenceNbr删除${table.comment}")
public boolean updateById${entity}(HttpServletRequest request, @RequestBody ${entity} ${entity ?uncap_first}){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ${table.serviceName ?uncap_first}.updateById(${entity ?uncap_first}); return ResponseHelper.buildResponse(${table.serviceImplName ?uncap_first}.removeById(sequenceNbr));
} }
/** /**
* 根据id查询 * 根据sequenceNbr查询
* @param id * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个${table.comment}", notes = "根据sequenceNbr查询单个${table.comment}")
public ${entity} selectById(HttpServletRequest request, @PathVariable Long id){ public ResponseModel<${entity}Dto> seleteOne(@PathVariable Long sequenceNbr)
return ${table.serviceName ?uncap_first}.getById(id); {
return ResponseHelper.buildResponse(${table.serviceImplName ?uncap_first}.queryBySeq(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
*@param current 当前页
*@param current 每页大小
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET) @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") @ApiOperation(httpMethod = "GET",value = "${table.comment}分页查询", notes = "${table.comment}分页查询")
public IPage<${entity}> listPage(String pageNum,String pageSize, ${entity} ${entity ?uncap_first}){ public ResponseModel<Page<${entity}Dto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam(value = "size") int size)
{
Page<${entity}> pageBean; Page<${entity}Dto> page=new Page<${entity}Dto>();
QueryWrapper<${entity}> ${entity ?uncap_first}QueryWrapper = new QueryWrapper<>(); page.setCurrent(current);
Class<? extends ${entity}> aClass = ${entity ?uncap_first}.getClass(); page.setSize(size);
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> { return ResponseHelper.buildResponse(${table.serviceImplName ?uncap_first}.queryFor${entity}Page(page));
try {
field.setAccessible(true);
Object o = field.get(${entity ?uncap_first});
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(${entity ?uncap_first});
${entity ?uncap_first}QueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(${entity ?uncap_first});
${entity ?uncap_first}QueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(${entity ?uncap_first});
${entity ?uncap_first}QueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(${entity ?uncap_first});
${entity ?uncap_first}QueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<${entity}> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = ${table.serviceName ?uncap_first}.page(pageBean, ${entity ?uncap_first}QueryWrapper);
return page;
} }
/**
*列表全部数据查询
*@return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "${table.comment}列表全部数据查询", notes = "${table.comment}列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<${entity}Dto>> selectForList()
{
return ResponseHelper.buildResponse(${table.serviceImplName ?uncap_first}.queryFor${entity}List());
} }
}
</#if> </#if>
package com.yeejoin.amos.boot.module.${package.ModuleName}.api.dto; package com.yeejoin.amos.boot.module.${package.ModuleName}.api.dto;
<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
</#if> import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
<#if entityLombokModel> <#if entityLombokModel>
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
</#if> </#if>
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/** /**
* ${table.comment!} * ${table.comment!}
* *
...@@ -30,24 +20,14 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; ...@@ -30,24 +20,14 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
<#else> <#else>
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
</#if> </#if>
@Accessors(chain = true)
</#if>
<#if table.convert>
@TableName("${table.name}")
</#if> </#if>
<#if swagger2> <#if swagger2>
@ApiModel(value="${entity}Dto", description="${table.comment!}") @ApiModel(value="${entity}Dto", description="${table.comment!}")
</#if> </#if>
<#if superEntityClass??> public class ${entity}Dto extends BaseDto {
public class ${entity}Dto extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity}Dto{
<#else>
public class ${entity}Dto implements Serializable {
</#if>
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
</#if>
<#-- ---------- BEGIN 字段循环遍历 ----------> <#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field> <#list table.fields as field>
......
package com.yeejoin.amos.boot.module.${package.ModuleName}.api.service; package com.yeejoin.amos.boot.module.${package.ModuleName}.api.service;
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/** /**
* ${table.comment!} 服务 * ${table.comment!}接口
* *
* @author ${author} * @author ${author}
* @date ${date} * @date ${date}
...@@ -12,7 +10,7 @@ import ${superServiceClassPackage}; ...@@ -12,7 +10,7 @@ import ${superServiceClassPackage};
<#if kotlin> <#if kotlin>
interface ${table.serviceName} : ${superServiceClass}<${entity}> interface ${table.serviceName} : ${superServiceClass}<${entity}>
<#else> <#else>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { public interface ${table.serviceName} {
} }
</#if> </#if>
...@@ -3,22 +3,30 @@ package ${package.ServiceImpl}; ...@@ -3,22 +3,30 @@ package ${package.ServiceImpl};
import ${package.Entity}.${entity}; import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName}; import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName}; import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage}; import ${package.Xml}.${entity}Dto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/** /**
* ${table.comment!} 服务实现类 * ${table.comment!}服务实现类
* *
* @author ${author} * @author ${author}
* @date ${date} * @date ${date}
*/ */
@Service @Service
<#if kotlin> public class ${table.serviceImplName} extends BaseService<${entity}Dto,${entity},${table.mapperName}> implements ${table.serviceName} {
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { /**
* 分页查询
*/
public Page<${entity}Dto> queryFor${entity}Page(Page<${entity}Dto> page) {
return this.queryForPage(page, null, false);
} }
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
/**
* 列表查询 示例
*/
public List<${entity}Dto> queryFor${entity}List() {
return this.queryForList("" , false);
}
} }
</#if>
...@@ -67,10 +67,7 @@ public ResponseModel<${entity}Model> seleteOne(@PathVariable Long sequenceNbr) ...@@ -67,10 +67,7 @@ public ResponseModel<${entity}Model> seleteOne(@PathVariable Long sequenceNbr)
@TycloudOperation(ApiLevel = UserType.SUPER_ADMIN) @TycloudOperation(ApiLevel = UserType.SUPER_ADMIN)
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
@RequestMapping(value = "/page" , method = RequestMethod.GET) @RequestMapping(value = "/page" , method = RequestMethod.GET)
public ResponseModel<Page> queryForPage( public ResponseModel<Page> queryForPage(@RequestParam(value = "agencyCode") String agencyCode,@RequestParam(value = "current") int current,@RequestParam(value = "size") int size)
@RequestParam(value = "agencyCode") String agencyCode,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size)
{ {
Page page=new Page(); Page page=new Page();
page.setCurrent(current); page.setCurrent(current);
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
<artifactId>amos-boot-module-jcs-biz</artifactId> <artifactId>amos-boot-module-jcs-biz</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -38,7 +38,7 @@ import java.net.UnknownHostException; ...@@ -38,7 +38,7 @@ import java.net.UnknownHostException;
"org.typroject.tyboot.face.*.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*",
"org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.jcs.api.mapper"}) "com.yeejoin.amos.boot.module.*.api.mapper"})
@ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" }) @ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" })
public class AmosJcsApplication public class AmosJcsApplication
{ {
......
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
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