新增订单模块
This commit is contained in:
@@ -3,7 +3,7 @@ gen:
|
||||
# 作者
|
||||
author: admin
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
packageName: com.starry.modules.system
|
||||
packageName: com.starry.play
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: false
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.starry.common.annotation.Log;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -18,9 +18,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ${packageName}.entity.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.starry.common.page.TableDataInfo;
|
||||
|
||||
#elseif($table.tree)
|
||||
@@ -41,13 +38,12 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:list')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:list')")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
public TableDataInfo list(${ClassName} ${className}) {
|
||||
startPage();
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
return getDataTable(list);
|
||||
public R list(${ClassName} ${className}) {
|
||||
IPage<${ClassName}> list = ${className}Service.select${ClassName}ByPage(${className});
|
||||
return R.ok(list);
|
||||
}
|
||||
#elseif($table.tree)
|
||||
public R list(${ClassName} ${className}) {
|
||||
@@ -59,7 +55,7 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 导出${functionName}列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:export')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:export')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className}) {
|
||||
@@ -71,7 +67,7 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 获取${functionName}详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:query')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:query')")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
public R getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
return R.ok(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
||||
@@ -80,7 +76,7 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:create')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:create')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody ${ClassName} ${className}) {
|
||||
@@ -94,10 +90,10 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:edit')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:edit')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update/{${pkColumn.javaField}}")
|
||||
public R update(@PathVariable ${pkColumn.javaType} ${pkColumn.javaField}, @RequestBody ${ClassName} ${className}) {
|
||||
public R update(@PathVariable ${pkColumn.javaType} ${pkColumn.javaField}, @RequestBody ${ClassName}Entity ${className}) {
|
||||
${className}.set${pkColumn.javaField}(${pkColumn.javaField});
|
||||
boolean success = ${className}Service.update(${className});
|
||||
if (success) {
|
||||
@@ -109,7 +105,7 @@ public class ${ClassName}Controller {
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermi('${permissionPrefix}:remove')")
|
||||
@PreAuthorize("@customSs.hasPermission('${permissionPrefix}:remove')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public R remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import java.util.Date;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
@@ -28,11 +28,10 @@ import com.starry.common.domain.TreeEntity;
|
||||
#end
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("$table.tableName")
|
||||
public class ${ClassName} extends ${Entity}{
|
||||
public class ${ClassName}Entity extends BaseEntity<${ClassName}Entity>{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
|
||||
@@ -15,19 +15,7 @@ import ${packageName}.entity .${subClassName};
|
||||
* @since ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
|
||||
/**
|
||||
* 查询${functionName}
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
|
||||
#if($table.sub)
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package ${packageName}.entity;
|
||||
|
||||
#foreach ($import in $importList)
|
||||
import ${import};
|
||||
#end
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
#elseif($table.tree)
|
||||
import com.starry.common.domain.TreeEntity;
|
||||
#end
|
||||
|
||||
/**
|
||||
* ${functionName}对象 ${tableName}
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
#if($table.crud || $table.sub)
|
||||
#set($Entity="BasePageEntity")
|
||||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ${ClassName} extends ${Entity}{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
/** $column.columnComment */
|
||||
#if($column.list)
|
||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||
#if($parentheseIndex != -1)
|
||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||
#else
|
||||
#set($comment=$column.columnComment)
|
||||
#end
|
||||
#if($parentheseIndex != -1)
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
#elseif($column.javaType == 'Date')
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
#else
|
||||
@Excel(name = "${comment}")
|
||||
#end
|
||||
#end
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
/** $table.subTable.functionName信息 */
|
||||
private List<${subClassName}> ${subclassName}List;
|
||||
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package ${packageName}.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import ${packageName}.entity .${ClassName};
|
||||
|
||||
@@ -11,7 +11,7 @@ import ${packageName}.entity .${ClassName};
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service extends IService<${ClassName}> {
|
||||
public interface I${ClassName}Service extends IService<${ClassName}Entity> {
|
||||
/**
|
||||
* 查询${functionName}
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
@@ -24,21 +24,21 @@ public interface I${ClassName}Service extends IService<${ClassName}> {
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
IPage<${ClassName}Entity> select${ClassName}ByPage(${ClassName}Entity ${className});
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(${ClassName} ${className});
|
||||
boolean create(${ClassName}Entity ${className});
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(${ClassName} ${className});
|
||||
boolean update(${ClassName}Entity ${className});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
|
||||
@@ -2,9 +2,9 @@ package ${packageName}.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -26,7 +26,7 @@ import ${packageName}.service.I${ClassName}Service;
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service {
|
||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}Entity> implements I${ClassName}Service {
|
||||
@Resource
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
||||
@@ -36,8 +36,8 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||
* @return ${functionName}
|
||||
*/
|
||||
@Override
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||
public ${ClassName}Entity select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,8 +46,9 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||
* @return ${functionName}
|
||||
*/
|
||||
@Override
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) {
|
||||
return ${className}Mapper.select${ClassName}List(${className});
|
||||
public IPage<${ClassName}Entity> select${ClassName}ByPage(${ClassName}Entity ${className}) {
|
||||
Page<${ClassName}Entity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<${ClassName}Entity>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,12 +60,15 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
#end
|
||||
@Override
|
||||
public boolean create(${ClassName} ${className}) {
|
||||
public boolean create(${ClassName}Entity ${className}) {
|
||||
#if($table.sub)
|
||||
int rows = ${className}Mapper.insert${ClassName}(${className});
|
||||
insert${subClassName}(${className});
|
||||
return rows;
|
||||
#else
|
||||
if (StrUtil.isBlankIfStr(${className}.getId())) {
|
||||
${className}.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(${className});
|
||||
#end
|
||||
}
|
||||
@@ -78,7 +82,7 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
#end
|
||||
@Override
|
||||
public boolean update(${ClassName} ${className}) {
|
||||
public boolean update(${ClassName}Entity ${className}) {
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}())
|
||||
;
|
||||
@@ -124,7 +128,7 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||
* 新增${subTable.functionName}信息
|
||||
* @param ${className} ${functionName}对象
|
||||
*/
|
||||
public void insert${subClassName}(${ClassName} ${className}) {
|
||||
public void insert${subClassName}(${ClassName}Entity ${className}) {
|
||||
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
|
||||
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
|
||||
if (StringUtils.isNotNull(${subclassName}List)) {
|
||||
|
||||
Reference in New Issue
Block a user