代码生成器
parent
10341472e9
commit
49845c93b5
|
@ -0,0 +1,65 @@
|
||||||
|
package com.muyu.common.core.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 对象工具类
|
||||||
|
* @Date 2023-10-9 下午 04:56
|
||||||
|
*/
|
||||||
|
public class ObjUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容
|
||||||
|
* CharSequence: 如果长度为零,则认为为空。
|
||||||
|
* Array: 如果长度为零,则认为为空。
|
||||||
|
* Collection: 如果元素为零,则认为为空。
|
||||||
|
* Map: 如果键值映射为零,则认为为空。
|
||||||
|
* @param o 对象
|
||||||
|
* @return 如果对象具有受支持的类型并且为空或null,则为true,否则为false
|
||||||
|
*/
|
||||||
|
public static boolean notNull(Object o){
|
||||||
|
return ObjectUtils.isNotEmpty(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断long类型不为0
|
||||||
|
* @param val 值
|
||||||
|
* @return 返回值不为0
|
||||||
|
*/
|
||||||
|
public static boolean notNull(Long val){
|
||||||
|
return ObjectUtils.isNotEmpty(val) && val != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断Integer类型不为0
|
||||||
|
* @param val 值
|
||||||
|
* @return 返回值不为0
|
||||||
|
*/
|
||||||
|
public static boolean notNull(Integer val){
|
||||||
|
return ObjectUtils.isNotEmpty(val) && val != 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 判断BigDecimal类型不为0
|
||||||
|
* @param val 值
|
||||||
|
* @return 返回值不为0
|
||||||
|
*/
|
||||||
|
public static boolean notNull(BigDecimal val){
|
||||||
|
return ObjectUtils.isNotEmpty(val) && val.doubleValue() == 0.00;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 判断BigDecimal类型不为0
|
||||||
|
* @param val 值
|
||||||
|
* @return 返回值不为0
|
||||||
|
*/
|
||||||
|
public static boolean notChildNull(Object[] val){
|
||||||
|
for (Object o : val) {
|
||||||
|
if (!notNull(o)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.common.security.config.mybatisplus;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类字段填充
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
public MyMetaObjectHandler () {
|
||||||
|
log.info("mybatis-plus 系统字段填充拦截器 初始化成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("createBy", SecurityUtils.getUsername(), metaObject);
|
||||||
|
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
|
||||||
|
this.setFieldValByName("updateTime", new Date(),metaObject);
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,9 +15,9 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板工具类
|
* 模板处理工具类
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class VelocityUtils {
|
public class VelocityUtils {
|
||||||
/**
|
/**
|
||||||
|
@ -70,9 +70,6 @@ public class VelocityUtils {
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
setTreeVelocityContext(velocityContext, genTable);
|
setTreeVelocityContext(velocityContext, genTable);
|
||||||
}
|
}
|
||||||
if (GenConstants.TPL_SUB.equals(tplCategory)) {
|
|
||||||
setSubVelocityContext(velocityContext, genTable);
|
|
||||||
}
|
|
||||||
return velocityContext;
|
return velocityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,22 +99,6 @@ public class VelocityUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSubVelocityContext (VelocityContext context, GenTable genTable) {
|
|
||||||
GenTable subTable = genTable.getSubTable();
|
|
||||||
String subTableName = genTable.getSubTableName();
|
|
||||||
String subTableFkName = genTable.getSubTableFkName();
|
|
||||||
String subClassName = genTable.getSubTable().getClassName();
|
|
||||||
String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
|
|
||||||
|
|
||||||
context.put("subTable", subTable);
|
|
||||||
context.put("subTableName", subTableName);
|
|
||||||
context.put("subTableFkName", subTableFkName);
|
|
||||||
context.put("subTableFkClassName", subTableFkClassName);
|
|
||||||
context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName));
|
|
||||||
context.put("subClassName", subClassName);
|
|
||||||
context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
|
||||||
context.put("subImportList", getImportList(genTable.getSubTable()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取模板信息
|
* 获取模板信息
|
||||||
|
@ -127,10 +108,13 @@ public class VelocityUtils {
|
||||||
public static List<String> getTemplateList (String tplCategory) {
|
public static List<String> getTemplateList (String tplCategory) {
|
||||||
List<String> templates = new ArrayList<String>();
|
List<String> templates = new ArrayList<String>();
|
||||||
templates.add("vm/java/domain.java.vm");
|
templates.add("vm/java/domain.java.vm");
|
||||||
templates.add("vm/java/mapper.java.vm");
|
templates.add("vm/java/query.java.vm");
|
||||||
|
templates.add("vm/java/save.java.vm");
|
||||||
|
templates.add("vm/java/edit.java.vm");
|
||||||
|
templates.add("vm/java/controller.java.vm");
|
||||||
templates.add("vm/java/service.java.vm");
|
templates.add("vm/java/service.java.vm");
|
||||||
templates.add("vm/java/serviceImpl.java.vm");
|
templates.add("vm/java/serviceImpl.java.vm");
|
||||||
templates.add("vm/java/controller.java.vm");
|
templates.add("vm/java/mapper.java.vm");
|
||||||
templates.add("vm/xml/mapper.xml.vm");
|
templates.add("vm/xml/mapper.xml.vm");
|
||||||
templates.add("vm/sql/sql.vm");
|
templates.add("vm/sql/sql.vm");
|
||||||
templates.add("vm/js/api.js.vm");
|
templates.add("vm/js/api.js.vm");
|
||||||
|
@ -138,9 +122,6 @@ public class VelocityUtils {
|
||||||
templates.add("vm/vue/index.vue.vm");
|
templates.add("vm/vue/index.vue.vm");
|
||||||
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
templates.add("vm/vue/index-tree.vue.vm");
|
templates.add("vm/vue/index-tree.vue.vm");
|
||||||
} else if (GenConstants.TPL_SUB.equals(tplCategory)) {
|
|
||||||
templates.add("vm/vue/index.vue.vm");
|
|
||||||
templates.add("vm/java/sub-domain.java.vm");
|
|
||||||
}
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
@ -167,12 +148,19 @@ public class VelocityUtils {
|
||||||
if (template.contains("domain.java.vm")) {
|
if (template.contains("domain.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
||||||
}
|
}
|
||||||
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) {
|
if (template.contains("query.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
fileName = StringUtils.format("{}/domain/req/{}QueryReq.java", javaPath, className);
|
||||||
} else if (template.contains("mapper.java.vm")) {
|
}
|
||||||
|
if (template.contains("save.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/domain/req/{}SaveReq.java", javaPath, className);
|
||||||
|
}
|
||||||
|
if (template.contains("edit.java.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/domain/req/{}EditReq.java", javaPath, className);
|
||||||
|
}
|
||||||
|
if (template.contains("mapper.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||||
} else if (template.contains("service.java.vm")) {
|
} else if (template.contains("service.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
fileName = StringUtils.format("{}/service/{}Service.java", javaPath, className);
|
||||||
} else if (template.contains("serviceImpl.java.vm")) {
|
} else if (template.contains("serviceImpl.java.vm")) {
|
||||||
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||||
} else if (template.contains("controller.java.vm")) {
|
} else if (template.contains("controller.java.vm")) {
|
||||||
|
@ -212,11 +200,7 @@ public class VelocityUtils {
|
||||||
*/
|
*/
|
||||||
public static HashSet<String> getImportList (GenTable genTable) {
|
public static HashSet<String> getImportList (GenTable genTable) {
|
||||||
List<GenTableColumn> columns = genTable.getColumns();
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
GenTable subGenTable = genTable.getSubTable();
|
|
||||||
HashSet<String> importList = new HashSet<String>();
|
HashSet<String> importList = new HashSet<String>();
|
||||||
if (StringUtils.isNotNull(subGenTable)) {
|
|
||||||
importList.add("java.util.List");
|
|
||||||
}
|
|
||||||
for (GenTableColumn column : columns) {
|
for (GenTableColumn column : columns) {
|
||||||
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
|
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
|
||||||
importList.add("java.util.Date");
|
importList.add("java.util.Date");
|
||||||
|
@ -239,10 +223,6 @@ public class VelocityUtils {
|
||||||
List<GenTableColumn> columns = genTable.getColumns();
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
Set<String> dicts = new HashSet<String>();
|
Set<String> dicts = new HashSet<String>();
|
||||||
addDicts(dicts, columns);
|
addDicts(dicts, columns);
|
||||||
if (StringUtils.isNotNull(genTable.getSubTable())) {
|
|
||||||
List<GenTableColumn> subColumns = genTable.getSubTable().getColumns();
|
|
||||||
addDicts(dicts, subColumns);
|
|
||||||
}
|
|
||||||
return StringUtils.join(dicts, ", ");
|
return StringUtils.join(dicts, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package ${packageName}.controller;
|
package ${packageName}.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -12,15 +13,18 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.log.annotation.Log;
|
import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.domain.req.${ClassName}QueryReq;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import ${packageName}.domain.req.${ClassName}SaveReq;
|
||||||
import com.muyu.common.core.domain.Result;
|
import ${packageName}.domain.req.${ClassName}EditReq;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import ${packageName}.service.${ClassName}Service;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud)
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#end
|
#end
|
||||||
|
@ -31,42 +35,41 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "${functionName}")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/${businessName}")
|
@RequestMapping("/${businessName}")
|
||||||
public class ${ClassName}Controller extends BaseController
|
public class ${ClassName}Controller extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private I${ClassName}Service ${className}Service;
|
private ${ClassName}Service ${className}Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取${functionName}列表")
|
||||||
@RequiresPermissions("${permissionPrefix}:list")
|
@RequiresPermissions("${permissionPrefix}:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud)
|
||||||
public Result<TableDataInfo> list(${ClassName} ${className})
|
public Result<TableDataInfo<${ClassName}>> list(${ClassName}QueryReq ${className}QueryReq) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.list(${ClassName}.queryBuild(${className}QueryReq));
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
public Result list(${ClassName} ${className})
|
public Result<List<${ClassName}>> list(${ClassName} ${className}) {
|
||||||
{
|
List<${ClassName}> list = ${className}Service.list(${className});
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
return Result.success(list);
|
||||||
return success(list);
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出${functionName}列表
|
* 导出${functionName}列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("导出${functionName}列表")
|
||||||
@RequiresPermissions("${permissionPrefix}:export")
|
@RequiresPermissions("${permissionPrefix}:export")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, ${ClassName} ${className})
|
public void export(HttpServletResponse response, ${ClassName} ${className}) {
|
||||||
{
|
List<${ClassName}> list = ${className}Service.list(${className});
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
|
||||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||||
util.exportExcel(response, list, "${functionName}数据");
|
util.exportExcel(response, list, "${functionName}数据");
|
||||||
}
|
}
|
||||||
|
@ -74,11 +77,12 @@ public class ${ClassName}Controller extends BaseController
|
||||||
/**
|
/**
|
||||||
* 获取${functionName}详细信息
|
* 获取${functionName}详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取${functionName}详细信息")
|
||||||
@RequiresPermissions("${permissionPrefix}:query")
|
@RequiresPermissions("${permissionPrefix}:query")
|
||||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||||
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
@ApiImplicitParam(name = "${pkColumn.javaField}", value = "${pkColumn.javaField}", required = true, dataType = "${pkColumn.javaType}", paramType = "path", dataTypeClass = ${pkColumn.javaType}.class)
|
||||||
{
|
public Result<${ClassName}> getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||||
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
return Result.success(${className}Service.getById(${pkColumn.javaField}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,9 +91,9 @@ public class ${ClassName}Controller extends BaseController
|
||||||
@RequiresPermissions("${permissionPrefix}:add")
|
@RequiresPermissions("${permissionPrefix}:add")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add(@RequestBody ${ClassName} ${className})
|
@ApiOperation("新增${functionName}")
|
||||||
{
|
public Result<String> add(@RequestBody ${ClassName}SaveReq ${className}SaveReq) {
|
||||||
return toAjax(${className}Service.insert${ClassName}(${className}));
|
return toAjax(${className}Service.save(${ClassName}.saveBuild(${className}SaveReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,10 +101,10 @@ public class ${ClassName}Controller extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("${permissionPrefix}:edit")
|
@RequiresPermissions("${permissionPrefix}:edit")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping("/{${pkColumn.javaField}}")
|
||||||
public Result edit(@RequestBody ${ClassName} ${className})
|
@ApiOperation("修改${functionName}")
|
||||||
{
|
public Result<String> edit(@PathVariable ${pkColumn.javaType} ${pkColumn.javaField}, @RequestBody ${ClassName}EditReq ${className}EditReq) {
|
||||||
return toAjax(${className}Service.update${ClassName}(${className}));
|
return toAjax(${className}Service.updateById(${ClassName}.editBuild(${pkColumn.javaField},${className}EditReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,8 +113,9 @@ public class ${ClassName}Controller extends BaseController
|
||||||
@RequiresPermissions("${permissionPrefix}:remove")
|
@RequiresPermissions("${permissionPrefix}:remove")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||||
public Result remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
@ApiOperation("删除${functionName}")
|
||||||
{
|
@ApiImplicitParam(name = "${pkColumn.javaField}", value = "${pkColumn.javaField}", required = true, dataType = "${pkColumn.javaType}", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
|
public Result<String> remove(@PathVariable List<${pkColumn.javaType}> ${pkColumn.javaField}s) {
|
||||||
|
return toAjax(${className}Service.removeBatchByIds(${pkColumn.javaField}s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,20 @@ package ${packageName}.domain;
|
||||||
#foreach ($import in $importList)
|
#foreach ($import in $importList)
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
#if($table.crud || $table.sub)
|
import ${packageName}.domain.req.${ClassName}QueryReq;
|
||||||
|
import ${packageName}.domain.req.${ClassName}SaveReq;
|
||||||
|
import ${packageName}.domain.req.${ClassName}EditReq;
|
||||||
|
#if($table.crud)
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.muyu.common.core.web.domain.TreeEntity;
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
@ -18,13 +28,20 @@ import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud)
|
||||||
#set($Entity="BaseEntity")
|
#set($Entity="BaseEntity")
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#set($Entity="TreeEntity")
|
#set($Entity="TreeEntity")
|
||||||
#end
|
#end
|
||||||
public class ${ClassName} extends ${Entity}
|
@Data
|
||||||
{
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("${tableName}")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "${ClassName}", description = "${functionName}")
|
||||||
|
public class ${ClassName} extends ${Entity} {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
@ -46,60 +63,77 @@ public class ${ClassName} extends ${Entity}
|
||||||
@Excel(name = "${comment}")
|
@Excel(name = "${comment}")
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#if($column.javaField == $pkColumn.javaField)
|
||||||
|
@TableId(value = "${pkColumn.columnName}",type = IdType.AUTO)
|
||||||
|
#end
|
||||||
|
#set($comment='')
|
||||||
|
#if($column.isRequired == '1')
|
||||||
|
#set($comment=', required = true')
|
||||||
|
#end
|
||||||
|
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}"$comment)
|
||||||
private $column.javaType $column.javaField;
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if($table.sub)
|
/**
|
||||||
/** $table.subTable.functionName信息 */
|
* 查询构造器
|
||||||
private List<${subClassName}> ${subclassName}List;
|
*/
|
||||||
|
public static ${ClassName} queryBuild( ${ClassName}QueryReq ${className}QueryReq){
|
||||||
#end
|
return ${ClassName}.builder()
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
#if($column.isQuery == '1')
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
#set($AttrName=$column.javaField)
|
#set($AttrName=$column.javaField)
|
||||||
#else
|
#else
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
#end
|
||||||
public void set${AttrName}($column.javaType $column.javaField)
|
.${column.javaField}(${className}QueryReq.get${AttrName}())
|
||||||
{
|
|
||||||
this.$column.javaField = $column.javaField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public $column.javaType get${AttrName}()
|
|
||||||
{
|
|
||||||
return $column.javaField;
|
|
||||||
}
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if($table.sub)
|
|
||||||
public List<${subClassName}> get${subClassName}List()
|
|
||||||
{
|
|
||||||
return ${subclassName}List;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
|
||||||
{
|
|
||||||
this.${subclassName}List = ${subclassName}List;
|
|
||||||
}
|
|
||||||
|
|
||||||
#end
|
#end
|
||||||
@Override
|
.build();
|
||||||
public String toString() {
|
}
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static ${ClassName} saveBuild(${ClassName}SaveReq ${className}SaveReq){
|
||||||
|
return ${ClassName}.builder()
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
#if($column.isEdit == '1')
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
#set($AttrName=$column.javaField)
|
#set($AttrName=$column.javaField)
|
||||||
#else
|
#else
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
#end
|
||||||
.append("${column.javaField}", get${AttrName}())
|
.${column.javaField}(${className}SaveReq.get${AttrName}())
|
||||||
#end
|
#end
|
||||||
#if($table.sub)
|
|
||||||
.append("${subclassName}List", get${subClassName}List())
|
|
||||||
#end
|
#end
|
||||||
.toString();
|
#end
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static ${ClassName} editBuild(${pkColumn.javaType} ${pkColumn.javaField}, ${ClassName}EditReq ${className}EditReq){
|
||||||
|
return ${ClassName}.builder()
|
||||||
|
.${pkColumn.javaField}(${pkColumn.javaField})
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.isEdit == '1')
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
|
#set($AttrName=$column.javaField)
|
||||||
|
#else
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#end
|
||||||
|
.${column.javaField}(${className}EditReq.get${AttrName}())
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package ${packageName}.domain.req;
|
||||||
|
|
||||||
|
#foreach ($import in $importList)
|
||||||
|
import ${import};
|
||||||
|
#end
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
#if($table.crud)
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
#elseif($table.tree)
|
||||||
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
#end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}对象 ${tableName}
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
#if($table.crud)
|
||||||
|
#set($Entity="BaseEntity")
|
||||||
|
#elseif($table.tree)
|
||||||
|
#set($Entity="TreeEntity")
|
||||||
|
#end
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "${ClassName}EditReq", description = "${functionName}")
|
||||||
|
public class ${ClassName}EditReq extends ${Entity} {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
#if($column.isEdit == '1')
|
||||||
|
/** $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($column.javaType == 'Date')
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#set($isRequired='')
|
||||||
|
#if($column.isRequired == '1')
|
||||||
|
#set($isRequired=', required = true')
|
||||||
|
#end
|
||||||
|
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}"$isRequired)
|
||||||
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
|
@ -1,10 +1,8 @@
|
||||||
package ${packageName}.mapper;
|
package ${packageName}.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
#if($table.sub)
|
|
||||||
import ${packageName}.domain.${subClassName};
|
|
||||||
#end
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Mapper接口
|
* ${functionName}Mapper接口
|
||||||
|
@ -12,80 +10,6 @@ import ${packageName}.domain.${subClassName};
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
public interface ${ClassName}Mapper
|
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询${functionName}列表
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return ${functionName}集合
|
|
||||||
*/
|
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insert${ClassName}(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int update${ClassName}(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
|
||||||
#if($table.sub)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除${subTable.functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增${subTable.functionName}
|
|
||||||
*
|
|
||||||
* @param ${subclassName}List ${subTable.functionName}列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过${functionName}主键删除${subTable.functionName}信息
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
#end
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package ${packageName}.domain.req;
|
||||||
|
|
||||||
|
#foreach ($import in $importList)
|
||||||
|
import ${import};
|
||||||
|
#end
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
#if($table.crud)
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
#elseif($table.tree)
|
||||||
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
#end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}对象 ${tableName}
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
#if($table.crud)
|
||||||
|
#set($Entity="BaseEntity")
|
||||||
|
#elseif($table.tree)
|
||||||
|
#set($Entity="TreeEntity")
|
||||||
|
#end
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "${ClassName}QueryReq", description = "${functionName}")
|
||||||
|
public class ${ClassName}QueryReq extends ${Entity} {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
#if($column.isQuery == '1')
|
||||||
|
/** $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($column.javaType == 'Date')
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($column.javaField == $pkColumn.javaField)
|
||||||
|
@TableId(value = "${pkColumn.javaField}",type = IdType.AUTO)
|
||||||
|
#end
|
||||||
|
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}")
|
||||||
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package ${packageName}.domain.req;
|
||||||
|
|
||||||
|
#foreach ($import in $importList)
|
||||||
|
import ${import};
|
||||||
|
#end
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
#if($table.crud)
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
#elseif($table.tree)
|
||||||
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
#end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}对象 ${tableName}
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
#if($table.crud)
|
||||||
|
#set($Entity="BaseEntity")
|
||||||
|
#elseif($table.tree)
|
||||||
|
#set($Entity="TreeEntity")
|
||||||
|
#end
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "${ClassName}SaveReq", description = "${functionName}")
|
||||||
|
public class ${ClassName}SaveReq extends ${Entity} {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
#if($column.isInsert == '1')
|
||||||
|
/** $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($column.javaType == 'Date')
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
#set($isRequired='')
|
||||||
|
#if($column.isRequired == '1')
|
||||||
|
#set($isRequired=', required = true')
|
||||||
|
#end
|
||||||
|
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}"$isRequired)
|
||||||
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package ${packageName}.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service接口
|
* ${functionName}Service接口
|
||||||
|
@ -9,53 +10,13 @@ import ${packageName}.domain.${ClassName};
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
public interface I${ClassName}Service
|
public interface ${ClassName}Service extends IService<${ClassName}> {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*
|
*
|
||||||
* @param ${className} ${functionName}
|
* @param ${className} ${functionName}
|
||||||
* @return ${functionName}集合
|
* @return ${functionName}集合
|
||||||
*/
|
*/
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
public List<${ClassName}> list(${ClassName} ${className});
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insert${ClassName}(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int update${ClassName}(${ClassName} ${className});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除${functionName}信息
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,15 @@
|
||||||
package ${packageName}.service.impl;
|
package ${packageName}.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
#break
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
#if($table.sub)
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import ${packageName}.domain.${subClassName};
|
|
||||||
#end
|
|
||||||
import ${packageName}.mapper.${ClassName}Mapper;
|
import ${packageName}.mapper.${ClassName}Mapper;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.${ClassName}Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service业务层处理
|
* ${functionName}Service业务层处理
|
||||||
|
@ -25,23 +17,9 @@ import ${packageName}.service.I${ClassName}Service;
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements ${ClassName}Service {
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ${ClassName}Mapper ${className}Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询${functionName}
|
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return ${functionName}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
|
||||||
{
|
|
||||||
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
|
@ -50,120 +28,49 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||||
* @return ${functionName}
|
* @return ${functionName}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
|
public List<${ClassName}> list(${ClassName} ${className}) {
|
||||||
{
|
LambdaQueryWrapper<${ClassName}> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
return ${className}Mapper.select${ClassName}List(${className});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增${functionName}
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
#if($table.sub)
|
|
||||||
@Transactional
|
|
||||||
#end
|
|
||||||
@Override
|
|
||||||
public int insert${ClassName}(${ClassName} ${className})
|
|
||||||
{
|
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.javaField == 'createTime')
|
#set($queryType=$column.queryType)
|
||||||
${className}.setCreateTime(DateUtils.getNowDate());
|
#set($javaField=$column.javaField)
|
||||||
#end
|
#set($JavaField=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
int rows = ${className}Mapper.insert${ClassName}(${className});
|
|
||||||
insert${subClassName}(${className});
|
|
||||||
return rows;
|
|
||||||
#else
|
|
||||||
return ${className}Mapper.insert${ClassName}(${className});
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
#if($column.query)
|
||||||
* 修改${functionName}
|
#if($queryType == "EQ")
|
||||||
*
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
* @param ${className} ${functionName}
|
queryWrapper.eq(${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
#if($table.sub)
|
|
||||||
@Transactional
|
|
||||||
#end
|
|
||||||
@Override
|
|
||||||
public int update${ClassName}(${ClassName} ${className})
|
|
||||||
{
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if($column.javaField == 'updateTime')
|
|
||||||
${className}.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
|
||||||
insert${subClassName}(${className});
|
|
||||||
#end
|
|
||||||
return ${className}Mapper.update${ClassName}(${className});
|
|
||||||
}
|
}
|
||||||
|
#elseif($queryType == "NE")
|
||||||
/**
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
* 批量删除${functionName}
|
queryWrapper.ne(${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
#if($table.sub)
|
|
||||||
@Transactional
|
|
||||||
#end
|
|
||||||
@Override
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
|
||||||
{
|
|
||||||
#if($table.sub)
|
|
||||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
|
||||||
#end
|
|
||||||
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
|
|
||||||
}
|
}
|
||||||
|
#elseif($queryType == "GT")
|
||||||
/**
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
* 删除${functionName}信息
|
queryWrapper.gt(${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
*
|
|
||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
#if($table.sub)
|
|
||||||
@Transactional
|
|
||||||
#end
|
|
||||||
@Override
|
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
|
||||||
{
|
|
||||||
#if($table.sub)
|
|
||||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
|
||||||
#end
|
|
||||||
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
|
||||||
}
|
}
|
||||||
#if($table.sub)
|
#elseif($queryType == "GTE")
|
||||||
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
/**
|
queryWrapper.ge(${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
* 新增${subTable.functionName}信息
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}对象
|
|
||||||
*/
|
|
||||||
public void insert${subClassName}(${ClassName} ${className})
|
|
||||||
{
|
|
||||||
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
|
|
||||||
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
|
|
||||||
if (StringUtils.isNotNull(${subclassName}List))
|
|
||||||
{
|
|
||||||
List<${subClassName}> list = new ArrayList<${subClassName}>();
|
|
||||||
for (${subClassName} ${subclassName} : ${subclassName}List)
|
|
||||||
{
|
|
||||||
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
|
|
||||||
list.add(${subclassName});
|
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
#elseif($queryType == "LT")
|
||||||
{
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
${className}Mapper.batch${subClassName}(list);
|
queryWrapper.lt()${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
}
|
}
|
||||||
|
#elseif($queryType == "LTE")
|
||||||
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
|
queryWrapper.le()${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
}
|
}
|
||||||
|
#elseif($queryType == "LIKE")
|
||||||
|
if (ObjUtils.notNull(${className}.get$JavaField())){
|
||||||
|
queryWrapper.like(${ClassName}::get$JavaField, ${className}.get$JavaField());
|
||||||
|
}
|
||||||
|
#elseif($queryType == "BETWEEN")
|
||||||
|
if (ObjUtils.notChildNull(${className}.getBetween("$JavaField"))){
|
||||||
|
queryWrapper.between(${ClassName}::get$JavaField, ${className}.getBeginParam("$JavaField"),${className}.getEndParam("$JavaField"));
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
package ${packageName}.domain;
|
|
||||||
|
|
||||||
#foreach ($import in $subImportList)
|
|
||||||
import ${import};
|
|
||||||
#end
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${subTable.functionName}对象 ${subTableName}
|
|
||||||
*
|
|
||||||
* @author ${author}
|
|
||||||
* @date ${datetime}
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ${subClassName} extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
#foreach ($column in $subTable.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
|
|
||||||
#foreach ($column in $subTable.columns)
|
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
|
||||||
#set($AttrName=$column.javaField)
|
|
||||||
#else
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
||||||
#end
|
|
||||||
public void set${AttrName}($column.javaType $column.javaField)
|
|
||||||
{
|
|
||||||
this.$column.javaField = $column.javaField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public $column.javaType get${AttrName}()
|
|
||||||
{
|
|
||||||
return $column.javaField;
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
#foreach ($column in $subTable.columns)
|
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
|
||||||
#set($AttrName=$column.javaField)
|
|
||||||
#else
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
||||||
#end
|
|
||||||
.append("${column.javaField}", get${AttrName}())
|
|
||||||
#end
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,7 +29,7 @@ export function add${BusinessName}(data) {
|
||||||
// 修改${functionName}
|
// 修改${functionName}
|
||||||
export function update${BusinessName}(data) {
|
export function update${BusinessName}(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/${moduleName}/${businessName}',
|
url: '/${moduleName}/${businessName}/'+data.${pkColumn.javaField},
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
-- 菜单 SQL
|
-- 菜单 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单');
|
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 1, sysdate(), null, null, '${functionName}菜单');
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
-- 按钮父菜单ID
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
-- 按钮 SQL
|
-- 按钮 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 1, sysdate(), null, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 1, sysdate(), null, null, '');
|
|
@ -453,7 +453,7 @@ export default {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
this.form.${treeParentCode} = row.${treeCode};
|
this.form.${treeParentCode} = row.${treeParentCode};
|
||||||
}
|
}
|
||||||
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
|
|
@ -283,65 +283,6 @@
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
|
||||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
|
||||||
#foreach($column in $subTable.columns)
|
|
||||||
#set($javaField=$column.javaField)
|
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#if($column.pk || $javaField == ${subTableFkclassName})
|
|
||||||
#elseif($column.list && $column.htmlType == "input")
|
|
||||||
<el-table-column label="$comment" prop="${javaField}" width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
#elseif($column.list && $column.htmlType == "datetime")
|
|
||||||
<el-table-column label="$comment" prop="${javaField}" width="240">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="请选择$comment" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
|
|
||||||
<el-table-column label="$comment" prop="${javaField}" width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.$column.dictType"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
|
|
||||||
<el-table-column label="$comment" prop="${javaField}" width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</el-table>
|
|
||||||
#end
|
#end
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
@ -366,10 +307,6 @@ export default {
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
#if($table.sub)
|
|
||||||
// 子表选中数据
|
|
||||||
checked${subClassName}: [],
|
|
||||||
#end
|
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
|
@ -380,10 +317,6 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
// ${functionName}表格数据
|
// ${functionName}表格数据
|
||||||
${businessName}List: [],
|
${businessName}List: [],
|
||||||
#if($table.sub)
|
|
||||||
// ${subTable.functionName}表格数据
|
|
||||||
${subclassName}List: [],
|
|
||||||
#end
|
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
|
@ -448,8 +381,8 @@ export default {
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
list${BusinessName}(this.queryParams).then(response => {
|
list${BusinessName}(this.queryParams).then(response => {
|
||||||
this.${businessName}List = response.rows;
|
this.${businessName}List = response.data.rows;
|
||||||
this.total = response.total;
|
this.total = response.data.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -469,9 +402,6 @@ export default {
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
};
|
};
|
||||||
#if($table.sub)
|
|
||||||
this.${subclassName}List = [];
|
|
||||||
#end
|
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
|
@ -512,9 +442,6 @@ export default {
|
||||||
#if($column.htmlType == "checkbox")
|
#if($column.htmlType == "checkbox")
|
||||||
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
||||||
#end
|
#end
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
this.${subclassName}List = response.data.${subclassName}List;
|
|
||||||
#end
|
#end
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改${functionName}";
|
this.title = "修改${functionName}";
|
||||||
|
@ -528,9 +455,6 @@ export default {
|
||||||
#if($column.htmlType == "checkbox")
|
#if($column.htmlType == "checkbox")
|
||||||
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
||||||
#end
|
#end
|
||||||
#end
|
|
||||||
#if($table.sub)
|
|
||||||
this.form.${subclassName}List = this.${subclassName}List;
|
|
||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
|
@ -558,39 +482,6 @@ export default {
|
||||||
this.#[[$modal]]#.msgSuccess("删除成功");
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
#if($table.sub)
|
|
||||||
/** ${subTable.functionName}序号 */
|
|
||||||
row${subClassName}Index({ row, rowIndex }) {
|
|
||||||
row.index = rowIndex + 1;
|
|
||||||
},
|
|
||||||
/** ${subTable.functionName}添加按钮操作 */
|
|
||||||
handleAdd${subClassName}() {
|
|
||||||
let obj = {};
|
|
||||||
#foreach($column in $subTable.columns)
|
|
||||||
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
|
||||||
#elseif($column.list && "" != $javaField)
|
|
||||||
obj.$column.javaField = "";
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
this.${subclassName}List.push(obj);
|
|
||||||
},
|
|
||||||
/** ${subTable.functionName}删除按钮操作 */
|
|
||||||
handleDelete${subClassName}() {
|
|
||||||
if (this.checked${subClassName}.length == 0) {
|
|
||||||
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
|
||||||
} else {
|
|
||||||
const ${subclassName}List = this.${subclassName}List;
|
|
||||||
const checked${subClassName} = this.checked${subClassName};
|
|
||||||
this.${subclassName}List = ${subclassName}List.filter(function(item) {
|
|
||||||
return checked${subClassName}.indexOf(item.index) == -1
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/** 复选框选中数据 */
|
|
||||||
handle${subClassName}SelectionChange(selection) {
|
|
||||||
this.checked${subClassName} = selection.map(item => item.index)
|
|
||||||
},
|
|
||||||
#end
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('${moduleName}/${businessName}/export', {
|
this.download('${moduleName}/${businessName}/export', {
|
||||||
|
|
|
@ -4,132 +4,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
||||||
|
|
||||||
<resultMap type="${ClassName}" id="${ClassName}Result">
|
<resultMap type="${packageName}.domain.${ClassName}" id="${ClassName}Result">
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
<result property="${column.javaField}" column="${column.columnName}" />
|
<result property="${column.javaField}" column="${column.columnName}" />
|
||||||
#end
|
#end
|
||||||
</resultMap>
|
</resultMap>
|
||||||
#if($table.sub)
|
|
||||||
|
|
||||||
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
|
|
||||||
<collection property="${subclassName}List" notNullColumn="sub_${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<resultMap type="${subClassName}" id="${subClassName}Result">
|
|
||||||
#foreach ($column in $subTable.columns)
|
|
||||||
<result property="${column.javaField}" column="sub_${column.columnName}" />
|
|
||||||
#end
|
|
||||||
</resultMap>
|
|
||||||
#end
|
|
||||||
|
|
||||||
<sql id="select${ClassName}Vo">
|
<sql id="select${ClassName}Vo">
|
||||||
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
|
||||||
<include refid="select${ClassName}Vo"/>
|
|
||||||
<where>
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#set($queryType=$column.queryType)
|
|
||||||
#set($javaField=$column.javaField)
|
|
||||||
#set($javaType=$column.javaType)
|
|
||||||
#set($columnName=$column.columnName)
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
||||||
#if($column.query)
|
|
||||||
#if($column.queryType == "EQ")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
|
|
||||||
#elseif($queryType == "NE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
|
|
||||||
#elseif($queryType == "GT")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if>
|
|
||||||
#elseif($queryType == "GTE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LT")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LTE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LIKE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
|
|
||||||
#elseif($queryType == "BETWEEN")
|
|
||||||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
|
|
||||||
#if($table.crud || $table.tree)
|
|
||||||
<include refid="select${ClassName}Vo"/>
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
|
||||||
#elseif($table.sub)
|
|
||||||
select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
|
|
||||||
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
|
|
||||||
|
|
||||||
from ${tableName} a
|
|
||||||
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
|
||||||
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
|
||||||
#end
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
|
||||||
insert into ${tableName}
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="update${ClassName}" parameterType="${ClassName}">
|
|
||||||
update ${tableName}
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#if($column.columnName != $pkColumn.columnName)
|
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</trim>
|
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}">
|
|
||||||
delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String">
|
|
||||||
delete from ${tableName} where ${pkColumn.columnName} in
|
|
||||||
<foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
|
|
||||||
#{${pkColumn.javaField}}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
#if($table.sub)
|
|
||||||
|
|
||||||
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
|
|
||||||
delete from ${subTableName} where ${subTableFkName} in
|
|
||||||
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
|
|
||||||
#{${subTableFkclassName}}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
|
|
||||||
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<insert id="batch${subClassName}">
|
|
||||||
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
|
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
|
||||||
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
#end
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-product-common</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共核心包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-product-remote</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 商品模块 common 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-product-server</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 商品模块 common 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.fox.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.product;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 商品启动类
|
||||||
|
* @Date 2024-2-26 下午 04:07
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class MuYuProductApplication {
|
||||||
|
public static void main (String[] args) {
|
||||||
|
SpringApplication.run(MuYuProductApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9302
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: muyu-product
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.product.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/muyu-product"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-product</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>muyu-product-common</module>
|
||||||
|
<module>muyu-product-remote</module>
|
||||||
|
<module>muyu-product-server</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
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 com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.domain.req.BookInfoQueryReq;
|
||||||
|
import com.muyu.system.domain.req.BookInfoSaveReq;
|
||||||
|
import com.muyu.system.domain.req.BookInfoEditReq;
|
||||||
|
import com.muyu.system.service.BookInfoService;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息Controller
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Api(tags = "书籍信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/book")
|
||||||
|
public class BookInfoController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private BookInfoService bookInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询书籍信息列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取书籍信息列表")
|
||||||
|
@RequiresPermissions("system:book:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<BookInfo>> list(BookInfoQueryReq bookInfoQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<BookInfo> list = bookInfoService.list(BookInfo.queryBuild(bookInfoQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出书籍信息列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出书籍信息列表")
|
||||||
|
@RequiresPermissions("system:book:export")
|
||||||
|
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BookInfo bookInfo) {
|
||||||
|
List<BookInfo> list = bookInfoService.list(bookInfo);
|
||||||
|
ExcelUtil<BookInfo> util = new ExcelUtil<BookInfo>(BookInfo.class);
|
||||||
|
util.exportExcel(response, list, "书籍信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取书籍信息详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取书籍信息详细信息")
|
||||||
|
@RequiresPermissions("system:book:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<BookInfo> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(bookInfoService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增书籍信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:add")
|
||||||
|
@Log(title = "书籍信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增书籍信息")
|
||||||
|
public Result<String> add(@RequestBody BookInfoSaveReq bookInfoSaveReq) {
|
||||||
|
BookInfo bookInfo = BookInfo.saveBuild(bookInfoSaveReq);
|
||||||
|
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
bookInfo.setCreateTime(new Date());
|
||||||
|
return toAjax(bookInfoService.save(bookInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改书籍信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:edit")
|
||||||
|
@Log(title = "书籍信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改书籍信息")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody BookInfoEditReq bookInfoEditReq) {
|
||||||
|
return toAjax(bookInfoService.updateById(BookInfo.editBuild(id,bookInfoEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除书籍信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:remove")
|
||||||
|
@Log(title = "书籍信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除书籍信息")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(bookInfoService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.system.domain.req.BookInfoQueryReq;
|
||||||
|
import com.muyu.system.domain.req.BookInfoSaveReq;
|
||||||
|
import com.muyu.system.domain.req.BookInfoEditReq;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息对象 book_info
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("book_info")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "BookInfo", description = "书籍信息")
|
||||||
|
public class BookInfo extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 书籍名称 */
|
||||||
|
@Excel(name = "书籍名称")
|
||||||
|
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 作者 */
|
||||||
|
@Excel(name = "作者")
|
||||||
|
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@Excel(name = "类型")
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 图片 */
|
||||||
|
@Excel(name = "图片")
|
||||||
|
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
/** 书籍描述 */
|
||||||
|
@Excel(name = "书籍描述")
|
||||||
|
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** 上架时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "上架时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||||
|
private Date shelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static BookInfo queryBuild( BookInfoQueryReq bookInfoQueryReq){
|
||||||
|
return BookInfo.builder()
|
||||||
|
.title(bookInfoQueryReq.getTitle())
|
||||||
|
.author(bookInfoQueryReq.getAuthor())
|
||||||
|
.type(bookInfoQueryReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static BookInfo saveBuild(BookInfoSaveReq bookInfoSaveReq){
|
||||||
|
return BookInfo.builder()
|
||||||
|
.title(bookInfoSaveReq.getTitle())
|
||||||
|
.author(bookInfoSaveReq.getAuthor())
|
||||||
|
.type(bookInfoSaveReq.getType())
|
||||||
|
.images(bookInfoSaveReq.getImages())
|
||||||
|
.content(bookInfoSaveReq.getContent())
|
||||||
|
.shelTime(bookInfoSaveReq.getShelTime())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static BookInfo editBuild(Long id, BookInfoEditReq bookInfoEditReq){
|
||||||
|
return BookInfo.builder()
|
||||||
|
.id(id)
|
||||||
|
.title(bookInfoEditReq.getTitle())
|
||||||
|
.author(bookInfoEditReq.getAuthor())
|
||||||
|
.type(bookInfoEditReq.getType())
|
||||||
|
.images(bookInfoEditReq.getImages())
|
||||||
|
.content(bookInfoEditReq.getContent())
|
||||||
|
.shelTime(bookInfoEditReq.getShelTime())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息对象 book_info
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "BookInfoEditReq", description = "书籍信息")
|
||||||
|
public class BookInfoEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 书籍名称 */
|
||||||
|
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 作者 */
|
||||||
|
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 图片 */
|
||||||
|
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
/** 书籍描述 */
|
||||||
|
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** 上架时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||||
|
private Date shelTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息对象 book_info
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "BookInfoQueryReq", description = "书籍信息")
|
||||||
|
public class BookInfoQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 书籍名称 */
|
||||||
|
@ApiModelProperty(name = "书籍名称", value = "书籍名称")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 作者 */
|
||||||
|
@ApiModelProperty(name = "作者", value = "作者")
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息对象 book_info
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "BookInfoSaveReq", description = "书籍信息")
|
||||||
|
public class BookInfoSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 书籍名称 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 作者 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 图片 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
/** 书籍描述 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** 上架时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||||
|
private Date shelTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
public interface BookInfoMapper extends BaseMapper<BookInfo> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息Service接口
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
public interface BookInfoService extends IService<BookInfo> {
|
||||||
|
/**
|
||||||
|
* 查询书籍信息列表
|
||||||
|
*
|
||||||
|
* @param bookInfo 书籍信息
|
||||||
|
* @return 书籍信息集合
|
||||||
|
*/
|
||||||
|
public List<BookInfo> list(BookInfo bookInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.system.mapper.BookInfoMapper;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.service.BookInfoService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-02-26
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements BookInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询书籍信息列表
|
||||||
|
*
|
||||||
|
* @param bookInfo 书籍信息
|
||||||
|
* @return 书籍信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BookInfo> list(BookInfo bookInfo) {
|
||||||
|
LambdaQueryWrapper<BookInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(bookInfo.getTitle())){
|
||||||
|
queryWrapper.eq(BookInfo::getTitle, bookInfo.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(bookInfo.getAuthor())){
|
||||||
|
queryWrapper.eq(BookInfo::getAuthor, bookInfo.getAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(bookInfo.getType())){
|
||||||
|
queryWrapper.eq(BookInfo::getType, bookInfo.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?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">
|
||||||
|
<mapper namespace="com.muyu.system.mapper.BookInfoMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.system.domain.BookInfo" id="BookInfoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="author" column="author" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="images" column="images" />
|
||||||
|
<result property="content" column="content" />
|
||||||
|
<result property="shelTime" column="shel_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBookInfoVo">
|
||||||
|
select id, title, author, type, images, content, shel_time, remark, create_time, create_by, update_by, update_time from book_info
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
|
@ -13,6 +13,7 @@
|
||||||
<module>muyu-gen</module>
|
<module>muyu-gen</module>
|
||||||
<module>muyu-job</module>
|
<module>muyu-job</module>
|
||||||
<module>muyu-file</module>
|
<module>muyu-file</module>
|
||||||
|
<module>muyu-product</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>muyu-modules</artifactId>
|
<artifactId>muyu-modules</artifactId>
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -206,6 +206,20 @@
|
||||||
<version>${muyu.version}</version>
|
<version>${muyu.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 商品模块 common 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product-common</artifactId>
|
||||||
|
<version>${muyu.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 商品模块 远程调用 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product-remote</artifactId>
|
||||||
|
<version>${muyu.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue