ureport集成
This commit is contained in:
parent
adbe071c05
commit
2e9cea666f
@ -1,8 +1,12 @@
|
||||
package com.ktg;
|
||||
|
||||
import com.bstek.ureport.console.UReportServlet;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
@ -11,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableAsync
|
||||
@ImportResource("classpath:ureport-console-context.xml")
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
@ -18,15 +23,13 @@ public class RuoYiApplication
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
System.out.println("(♥◠‿◠)ノ゙ KTM-MES启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean urportServlet(){
|
||||
ServletRegistrationBean bean = new ServletRegistrationBean(new UReportServlet());
|
||||
bean.addUrlMappings("/ureport/*");
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.ktg.web.core.config;
|
||||
|
||||
import com.bstek.ureport.definition.datasource.BuildinDatasource;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
public class UReportConfig implements BuildinDatasource {
|
||||
|
||||
@Resource
|
||||
DataSource dataSource;
|
||||
|
||||
/**
|
||||
* 返回数据源的名称
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String name() {
|
||||
return "内置数据源";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
try {
|
||||
return dataSource.getConnection();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("连接数据源失败!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -144,12 +144,19 @@
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 二维码 -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bstek.ureport</groupId>
|
||||
<artifactId>ureport2-console</artifactId>
|
||||
<version>2.2.9</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -109,6 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
"/profile/**"
|
||||
).permitAll()
|
||||
.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/ureport/**").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
|
@ -0,0 +1,98 @@
|
||||
package com.ktg.mes.report.controller;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.report.domain.UreportFileTbl;
|
||||
import com.ktg.mes.report.service.IUreportFileTblService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表管理Controller
|
||||
*
|
||||
* @author yanshikui
|
||||
* @date 2022-10-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ureportM")
|
||||
public class UreportFileTblController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUreportFileTblService ureportFileTblService;
|
||||
|
||||
/**
|
||||
* 查询报表管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
startPage();
|
||||
List<UreportFileTbl> list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出报表管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:export')")
|
||||
@Log(title = "报表管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
List<UreportFileTbl> list = ureportFileTblService.selectUreportFileTblList(ureportFileTbl);
|
||||
ExcelUtil<UreportFileTbl> util = new ExcelUtil<UreportFileTbl>(UreportFileTbl.class);
|
||||
util.exportExcel(response, list, "报表管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报表管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(ureportFileTblService.selectUreportFileTblById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报表管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:add')")
|
||||
@Log(title = "报表管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
return toAjax(ureportFileTblService.insertUreportFileTbl(ureportFileTbl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报表管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:edit')")
|
||||
@Log(title = "报表管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
return toAjax(ureportFileTblService.updateUreportFileTbl(ureportFileTbl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报表管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ureport:remove')")
|
||||
@Log(title = "报表管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(ureportFileTblService.deleteUreportFileTblByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.ktg.mes.report.domain;
|
||||
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Ureport文件 实体类
|
||||
* @author yanshikui
|
||||
* @version 2022年10月7日
|
||||
*
|
||||
*/
|
||||
|
||||
public class UreportFileEntity extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
private String name;
|
||||
private byte[] content;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public byte[] getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(byte[] content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UreportFileEntity{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", content=" + Arrays.toString(content) +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.ktg.mes.report.domain;
|
||||
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 报表管理对象 ureport_file_tbl
|
||||
*
|
||||
* @author yanshikui
|
||||
* @date 2022-10-07
|
||||
*/
|
||||
public class UreportFileTbl extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String name;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String content;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("content", getContent())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.ktg.mes.report.mapper;
|
||||
|
||||
import com.ktg.mes.report.domain.UreportFileEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Ureport文件 Mapper
|
||||
* @author yanshikui
|
||||
* @version 2022年10月7日
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface UreportFileMapper {
|
||||
|
||||
/**
|
||||
* 根据报表名称检查报表是否存在
|
||||
* @param name 报表名称
|
||||
* @return
|
||||
*/
|
||||
public int checkExistByName(String name);
|
||||
|
||||
/**
|
||||
* 根据报表名称查询报表
|
||||
* @param name 报表名称
|
||||
* @return
|
||||
*/
|
||||
public UreportFileEntity queryUreportFileEntityByName(String name);
|
||||
|
||||
/**
|
||||
* 查询全部报表
|
||||
* @return
|
||||
*/
|
||||
public List<UreportFileEntity> queryReportFileList();
|
||||
|
||||
/**
|
||||
* 根据报表名称删除报表
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public int deleteReportFileByName(String name);
|
||||
|
||||
|
||||
/**
|
||||
* 保存报表
|
||||
*/
|
||||
public int insertReportFile(UreportFileEntity entity);
|
||||
|
||||
/**
|
||||
* 更新报表
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public int updateReportFile(UreportFileEntity entity);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.ktg.mes.report.mapper;
|
||||
|
||||
import com.ktg.mes.report.domain.UreportFileTbl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表管理Mapper接口
|
||||
*
|
||||
* @author yanshikui
|
||||
* @date 2022-10-07
|
||||
*/
|
||||
public interface UreportFileTblMapper
|
||||
{
|
||||
/**
|
||||
* 查询报表管理
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 报表管理
|
||||
*/
|
||||
public UreportFileTbl selectUreportFileTblById(Long id);
|
||||
|
||||
/**
|
||||
* 查询报表管理列表
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 报表管理集合
|
||||
*/
|
||||
public List<UreportFileTbl> selectUreportFileTblList(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 新增报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUreportFileTbl(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 修改报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUreportFileTbl(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 删除报表管理
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUreportFileTblById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除报表管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUreportFileTblByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.ktg.mes.report.provider;
|
||||
|
||||
import com.bstek.ureport.provider.report.ReportFile;
|
||||
import com.bstek.ureport.provider.report.ReportProvider;
|
||||
import com.ktg.mes.report.domain.UreportFileEntity;
|
||||
import com.ktg.mes.report.mapper.UreportFileMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mysql 报表存储
|
||||
* @author yanshikui
|
||||
* @version 2022年10月7日
|
||||
*
|
||||
*/
|
||||
|
||||
@Component
|
||||
// 该注解可以利用其 prefix属性值 + 类的属性名 在yml中配置属性值
|
||||
@ConfigurationProperties(prefix = "ureport.mysql.provider")
|
||||
public class MySQLProvider implements ReportProvider{
|
||||
private static final String NAME = "数据库服务器";
|
||||
|
||||
// 特定前缀,ureport底层会调用 getPrefix 方法来获取报表操作的Provier类
|
||||
private String prefix = "mysql:";
|
||||
|
||||
// 是否禁用
|
||||
private boolean disabled;
|
||||
|
||||
@Autowired
|
||||
private UreportFileMapper ureportFileMapper;
|
||||
|
||||
@Override
|
||||
public InputStream loadReport(String file) {
|
||||
UreportFileEntity ureportFileEntity = ureportFileMapper.queryUreportFileEntityByName(getCorrectName(file));
|
||||
byte[] content = ureportFileEntity.getContent();
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(content);
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReport(String file) {
|
||||
ureportFileMapper.deleteReportFileByName(getCorrectName(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportFile> getReportFiles() {
|
||||
List<UreportFileEntity> list = ureportFileMapper.queryReportFileList();
|
||||
List<ReportFile> reportList = new ArrayList<>();
|
||||
for (UreportFileEntity ureportFileEntity : list) {
|
||||
reportList.add(new ReportFile(ureportFileEntity.getName(), ureportFileEntity.getUpdateTime()));
|
||||
}
|
||||
return reportList ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveReport(String file, String content) {
|
||||
file = getCorrectName(file);
|
||||
UreportFileEntity ureportFileEntity = ureportFileMapper.queryUreportFileEntityByName(file);
|
||||
Date currentDate = new Date();
|
||||
if(ureportFileEntity == null){
|
||||
ureportFileEntity = new UreportFileEntity();
|
||||
ureportFileEntity.setName(file);
|
||||
ureportFileEntity.setContent(content.getBytes());
|
||||
ureportFileEntity.setCreateTime(currentDate);
|
||||
ureportFileEntity.setUpdateTime(currentDate);
|
||||
ureportFileMapper.insertReportFile(ureportFileEntity);
|
||||
}else{
|
||||
ureportFileEntity.setContent(content.getBytes());
|
||||
ureportFileEntity.setUpdateTime(currentDate);
|
||||
ureportFileMapper.updateReportFile(ureportFileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public static String getNAME() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取没有前缀的文件名
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private String getCorrectName(String name){
|
||||
if(name.startsWith(prefix)){
|
||||
name = name.substring(prefix.length(), name.length());
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.ktg.mes.report.service;
|
||||
|
||||
import com.ktg.mes.report.domain.UreportFileTbl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表管理Service接口
|
||||
*
|
||||
* @author yanshikui
|
||||
* @date 2022-10-07
|
||||
*/
|
||||
public interface IUreportFileTblService
|
||||
{
|
||||
/**
|
||||
* 查询报表管理
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 报表管理
|
||||
*/
|
||||
public UreportFileTbl selectUreportFileTblById(Long id);
|
||||
|
||||
/**
|
||||
* 查询报表管理列表
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 报表管理集合
|
||||
*/
|
||||
public List<UreportFileTbl> selectUreportFileTblList(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 新增报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUreportFileTbl(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 修改报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUreportFileTbl(UreportFileTbl ureportFileTbl);
|
||||
|
||||
/**
|
||||
* 批量删除报表管理
|
||||
*
|
||||
* @param ids 需要删除的报表管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUreportFileTblByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除报表管理信息
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUreportFileTblById(Long id);
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.ktg.mes.report.service.impl;
|
||||
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.mes.report.domain.UreportFileTbl;
|
||||
import com.ktg.mes.report.mapper.UreportFileTblMapper;
|
||||
import com.ktg.mes.report.service.IUreportFileTblService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表管理Service业务层处理
|
||||
*
|
||||
* @author yanshikui
|
||||
* @date 2022-10-07
|
||||
*/
|
||||
@Service
|
||||
public class UreportFileTblServiceImpl implements IUreportFileTblService
|
||||
{
|
||||
@Autowired
|
||||
private UreportFileTblMapper ureportFileTblMapper;
|
||||
|
||||
/**
|
||||
* 查询报表管理
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 报表管理
|
||||
*/
|
||||
@Override
|
||||
public UreportFileTbl selectUreportFileTblById(Long id)
|
||||
{
|
||||
return ureportFileTblMapper.selectUreportFileTblById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报表管理列表
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 报表管理
|
||||
*/
|
||||
@Override
|
||||
public List<UreportFileTbl> selectUreportFileTblList(UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
return ureportFileTblMapper.selectUreportFileTblList(ureportFileTbl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUreportFileTbl(UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
ureportFileTbl.setCreateTime(DateUtils.getNowDate());
|
||||
return ureportFileTblMapper.insertUreportFileTbl(ureportFileTbl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报表管理
|
||||
*
|
||||
* @param ureportFileTbl 报表管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUreportFileTbl(UreportFileTbl ureportFileTbl)
|
||||
{
|
||||
ureportFileTbl.setUpdateTime(DateUtils.getNowDate());
|
||||
return ureportFileTblMapper.updateUreportFileTbl(ureportFileTbl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除报表管理
|
||||
*
|
||||
* @param ids 需要删除的报表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUreportFileTblByIds(Long[] ids)
|
||||
{
|
||||
return ureportFileTblMapper.deleteUreportFileTblByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报表管理信息
|
||||
*
|
||||
* @param id 报表管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUreportFileTblById(Long id)
|
||||
{
|
||||
return ureportFileTblMapper.deleteUreportFileTblById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?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.ktg.mes.report.mapper.UreportFileMapper">
|
||||
|
||||
<resultMap type="UreportFileEntity" id="ureportFile">
|
||||
<id column="id_" jdbcType="BIGINT" property="id"/>
|
||||
<result column="name_" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="content_" jdbcType="BLOB" property="content"/>
|
||||
<result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="checkExistByName" parameterType="java.lang.String" resultType="java.lang.Integer">
|
||||
select count(*) from ureport_file_tbl where name_ = #{name}
|
||||
</select>
|
||||
|
||||
<select id="queryReportFileList" resultMap="ureportFile">
|
||||
select * from ureport_file_tbl
|
||||
</select>
|
||||
|
||||
<select id="queryUreportFileEntityByName" resultMap="ureportFile">
|
||||
select * from ureport_file_tbl where name_ = #{name}
|
||||
</select>
|
||||
|
||||
<delete id="deleteReportFileByName" parameterType="java.lang.String">
|
||||
delete from ureport_file_tbl where name_ = #{name}
|
||||
</delete>
|
||||
|
||||
<insert id="insertReportFile" parameterType="UreportFileEntity">
|
||||
insert into ureport_file_tbl (name_, content_, create_time_, update_time_) values
|
||||
(#{name}, #{content}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateReportFile" parameterType="UreportFileEntity">
|
||||
update ureport_file_tbl set
|
||||
name_ = #{name} ,
|
||||
content_ = #{content},
|
||||
create_time_ = #{createTime},
|
||||
update_time_ = #{updateTime}
|
||||
where id_ = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,71 @@
|
||||
<?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.ktg.mes.report.mapper.UreportFileTblMapper">
|
||||
|
||||
<resultMap type="UreportFileTbl" id="UreportFileTblResult">
|
||||
<result property="id" column="id_" />
|
||||
<result property="name" column="name_" />
|
||||
<result property="content" column="content_" />
|
||||
<result property="createTime" column="create_time_" />
|
||||
<result property="updateTime" column="update_time_" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUreportFileTblVo">
|
||||
select id_, name_, content_, create_time_, update_time_ from ureport_file_tbl
|
||||
</sql>
|
||||
|
||||
<select id="selectUreportFileTblList" parameterType="UreportFileTbl" resultMap="UreportFileTblResult">
|
||||
<include refid="selectUreportFileTblVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name_ = #{name}</if>
|
||||
<if test="content != null and content != ''"> and content_ = #{content}</if>
|
||||
<if test="createTime != null "> and create_time_ = #{createTime}</if>
|
||||
<if test="updateTime != null "> and update_time_ = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUreportFileTblById" parameterType="Long" resultMap="UreportFileTblResult">
|
||||
<include refid="selectUreportFileTblVo"/>
|
||||
where id_ = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUreportFileTbl" parameterType="UreportFileTbl" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ureport_file_tbl
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name_,</if>
|
||||
<if test="content != null">content_,</if>
|
||||
<if test="createTime != null">create_time_,</if>
|
||||
<if test="updateTime != null">update_time_,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUreportFileTbl" parameterType="UreportFileTbl">
|
||||
update ureport_file_tbl
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name_ = #{name},</if>
|
||||
<if test="content != null">content_ = #{content},</if>
|
||||
<if test="createTime != null">create_time_ = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time_ = #{updateTime},</if>
|
||||
</trim>
|
||||
where id_ = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUreportFileTblById" parameterType="Long">
|
||||
delete from ureport_file_tbl where id_ = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUreportFileTblByIds" parameterType="String">
|
||||
delete from ureport_file_tbl where id_ in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user