第三次提交

xuhongjie
董丁丁 2 years ago
parent f213391e0c
commit ac3aa60eb2

@ -39,7 +39,7 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:list')")
@GetMapping("/list")
public TableDataInfo list(TcDataSource tcDataSource)
{
@ -51,7 +51,7 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:export')")
@Log(title = "数据来源", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TcDataSource tcDataSource)
@ -64,7 +64,7 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@ -74,8 +74,6 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:add')")
@Log(title = "数据来源", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TcDataSource tcDataSource)
{
@ -85,8 +83,7 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:edit')")
@Log(title = "数据来源", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TcDataSource tcDataSource)
{
@ -96,8 +93,8 @@ public class TcDataSourceController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('zongzhi:source:remove')")
@Log(title = "数据来源", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{

@ -22,6 +22,7 @@ import com.ruoyi.zongzhi.domain.TcTown;
import com.ruoyi.zongzhi.service.ITcTownService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -62,6 +63,7 @@ public class TcTownController extends BaseController
util.exportExcel(response, list, "区域数据");
}
/**
*
*/
@ -104,4 +106,17 @@ public class TcTownController extends BaseController
{
return toAjax(tcTownService.deleteTcTownByIds(ids));
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception
{
ExcelUtil<TcTown> util = new ExcelUtil<TcTown>(TcTown.class);
List<TcTown> tcTownList = util.importExcel(file.getInputStream());
String message = tcTownService.importUser(tcTownList);
return AjaxResult.success(message);
}
}

@ -58,4 +58,8 @@ public interface TcTownMapper
* @return
*/
public int deleteTcTownByIds(Long[] ids);
}

@ -58,4 +58,14 @@ public interface ITcTownService
* @return
*/
public int deleteTcTownById(Long id);
/**
*
*
* @return
*/
public String importUser(List<TcTown> tcTownList);
}

@ -92,4 +92,20 @@ public class TcTownServiceImpl implements ITcTownService
{
return tcTownMapper.deleteTcTownById(id);
}
@Override
public String importUser(List<TcTown> tcTownList) {
StringBuilder successMsg = new StringBuilder();
if (!tcTownList.isEmpty()) {
for (TcTown tcTown : tcTownList) {
tcTownMapper.insertTcTown(tcTown);
}
successMsg.append("导入成功");
} else {
successMsg.append("导入失败,文件为空");
}
return successMsg.toString();
}
}

@ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateTcTown" parameterType="TcTown">
update tc_town
<trim prefix="SET" suffixOverrides=",">

Loading…
Cancel
Save