master
面包骑士 2024-08-21 19:58:50 +08:00
parent 8084e20948
commit 31cb0ab120
5 changed files with 18 additions and 14 deletions

View File

@ -13,10 +13,11 @@ import com.muyu.gen.service.IGenTableColumnService;
import com.muyu.gen.service.IGenTableService;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@ -31,10 +32,13 @@ import java.util.Map;
@RestController
public class GenController extends BaseController
{
@Autowired
@Resource
private IGenTableService genTableService;
@Autowired
@Resource
private HttpServletResponse response;
@Resource
private IGenTableColumnService genTableColumnService;
/**
@ -149,7 +153,7 @@ public class GenController extends BaseController
@RequiresPermissions("tool:gen:code")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/download/{tableName}")
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
public void download(@PathVariable("tableName") String tableName) throws IOException
{
byte[] data = genTableService.downloadCode(tableName);
genCode(response, data);
@ -185,7 +189,7 @@ public class GenController extends BaseController
@RequiresPermissions("tool:gen:code")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/batchGenCode")
public void batchGenCode(HttpServletResponse response, String tables) throws IOException
public void batchGenCode(@RequestParam("tables") String tables) throws IOException
{
String[] tableNames = Convert.toStrArray(tables);
byte[] data = genTableService.downloadCode(tableNames);

View File

@ -3,7 +3,7 @@ package com.muyu.gen.service;
import com.muyu.common.core.text.Convert;
import com.muyu.gen.domain.GenTableColumn;
import com.muyu.gen.mapper.GenTableColumnMapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
@ -16,7 +16,7 @@ import java.util.List;
@Service
public class GenTableColumnServiceImpl implements IGenTableColumnService
{
@Autowired
@Resource
private GenTableColumnMapper genTableColumnMapper;
/**

View File

@ -22,7 +22,7 @@ import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,10 +48,10 @@ public class GenTableServiceImpl implements IGenTableService
{
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
@Autowired
@Resource
private GenTableMapper genTableMapper;
@Autowired
@Resource
private GenTableColumnMapper genTableColumnMapper;
/**

View File

@ -3,7 +3,7 @@ package ${packageName}.controller;
import java.util.List;
import java.io.IOException;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -35,7 +35,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
@RequestMapping("/${businessName}")
public class ${ClassName}Controller extends BaseController
{
@Autowired
@Resource
private I${ClassName}Service ${className}Service;
/**

View File

@ -7,7 +7,7 @@ import com.muyu.common.core.utils.DateUtils;
#break
#end
#end
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
#if($table.sub)
import java.util.ArrayList;
@ -28,7 +28,7 @@ import ${packageName}.service.I${ClassName}Service;
@Service
public class ${ClassName}ServiceImpl implements ${ClassName}Service
{
@Autowired
@Resource
private ${ClassName}Mapper ${className}Mapper;
/**