导出工具类,以及代码优化
This commit is contained in:
parent
9d503f89e3
commit
942ecfc8f0
2
pom.xml
2
pom.xml
|
|
@ -166,7 +166,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.7</version>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.imgTool.imageUpload.dto.CoordinatePhotoReqVo;
|
|||
import com.bonus.imgTool.imageUpload.dto.CoordinatePhotoVo;
|
||||
import com.bonus.imgTool.imageUpload.service.CoordinatePhotoService;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ExcelUtil;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协调照片
|
||||
|
|
@ -86,4 +89,17 @@ public class CoordinatePhotoController {
|
|||
public ServerResponse getCoordinatePhotoById(EncryptedReq<CoordinatePhotoReqVo> data) {
|
||||
return coordinatePhotoService.getCoordinatePhotoById(data.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 协调照片--导出
|
||||
*/
|
||||
@PostMapping(value = "/coordinatePhotoExport")
|
||||
@DecryptAndVerify(decryptedClass = CoordinatePhotoReqVo.class)
|
||||
@LogAnnotation(operModul = "协调照片--导出", operation = "查询照片", operDesc = "系统级事件",operType="导出")
|
||||
public void coordinatePhotoExport(HttpServletResponse response, EncryptedReq<CoordinatePhotoReqVo> data) {
|
||||
|
||||
List<CoordinatePhotoVo> coordinatePhotoVoList = (List<CoordinatePhotoVo>) coordinatePhotoService.getCoordinatePhotoList(data.getData()).getData();
|
||||
ExcelUtil<CoordinatePhotoVo> util = new ExcelUtil<CoordinatePhotoVo>(CoordinatePhotoVo.class);
|
||||
util.exportExcel(response, coordinatePhotoVoList, "协调照片");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@ package com.bonus.imgTool.imageUpload.controller;
|
|||
|
||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.annotation.LogAnnotation;
|
||||
import com.bonus.imgTool.imageUpload.dto.CoordinatePhotoReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.CoordinatePhotoVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.ImportantMatterReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.ImportantMatterVo;
|
||||
import com.bonus.imgTool.imageUpload.service.ImportantMatterService;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ExcelUtil;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -14,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 重要事项及宣传照片
|
||||
|
|
@ -86,4 +91,17 @@ public class ImportantMatterController {
|
|||
public ServerResponse getImportantMatterById(EncryptedReq<ImportantMatterReqVo> data) {
|
||||
return importantMatterService.getImportantMatterById(data.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 重要事项及宣传照片--导出
|
||||
*/
|
||||
@PostMapping(value = "/importantMatterExport")
|
||||
@DecryptAndVerify(decryptedClass = ImportantMatterReqVo.class)
|
||||
@LogAnnotation(operModul = "协调照片--导出", operation = "查询照片", operDesc = "系统级事件",operType="导出")
|
||||
public void importantMatterExport(HttpServletResponse response, EncryptedReq<ImportantMatterReqVo> data) {
|
||||
|
||||
List<ImportantMatterVo> coordinatePhotoVoList = (List<ImportantMatterVo>) importantMatterService.getImportantMatterList(data.getData()).getData();
|
||||
ExcelUtil<ImportantMatterVo> util = new ExcelUtil<ImportantMatterVo>(ImportantMatterVo.class);
|
||||
util.exportExcel(response, coordinatePhotoVoList, "重要事项及宣传照片");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.imgTool.imageUpload.dto;
|
||||
|
||||
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import com.bonus.imgTool.utils.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -22,6 +24,7 @@ public class CoordinatePhotoVo {
|
|||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", sort = 1)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
@ -42,26 +45,31 @@ public class CoordinatePhotoVo {
|
|||
/**
|
||||
* 工序名称
|
||||
*/
|
||||
@Excel(name = "工序名称", sort = 2)
|
||||
private String gxName;
|
||||
|
||||
/**
|
||||
* 建设地点
|
||||
*/
|
||||
@Excel(name = "建设地点", sort = 3)
|
||||
private String buildPlace;
|
||||
|
||||
/**
|
||||
* 建设前描述
|
||||
*/
|
||||
@Excel(name = "建设前描述", sort = 4)
|
||||
private String buildBeforeDesc;
|
||||
|
||||
/**
|
||||
* 建设中描述
|
||||
*/
|
||||
@Excel(name = "建设中描述", sort = 5)
|
||||
private String buildUnderDesc;
|
||||
|
||||
/**
|
||||
* 恢复后描述
|
||||
*/
|
||||
@Excel(name = "恢复后描述", sort = 6)
|
||||
private String buildAfterDesc;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.imgTool.imageUpload.dto;
|
||||
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import com.bonus.imgTool.utils.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -22,6 +23,7 @@ public class ImportantMatterVo {
|
|||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", sort = 1)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
@ -32,6 +34,7 @@ public class ImportantMatterVo {
|
|||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
@Excel(name = "专业名称", sort = 2)
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
|
|
@ -42,21 +45,25 @@ public class ImportantMatterVo {
|
|||
/**
|
||||
* 工序名称
|
||||
*/
|
||||
@Excel(name = "工序名称", sort = 3)
|
||||
private String gxName;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@Excel(name = "时间", sort = 4)
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Excel(name = "标题", sort = 5)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Excel(name = "内容", sort = 6)
|
||||
private String content;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.imgTool.imageUpload.dto;
|
||||
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import com.bonus.imgTool.utils.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -22,6 +23,7 @@ public class SafetyMeasuresVo {
|
|||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", sort = 1)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
@ -32,6 +34,7 @@ public class SafetyMeasuresVo {
|
|||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
@Excel(name = "专业名称", sort = 2)
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
|
|
@ -42,26 +45,31 @@ public class SafetyMeasuresVo {
|
|||
/**
|
||||
* 工序名称
|
||||
*/
|
||||
@Excel(name = "工序名称", sort = 3)
|
||||
private String gxName;
|
||||
|
||||
/**
|
||||
* 检查人
|
||||
*/
|
||||
@Excel(name = "检查人", sort = 4)
|
||||
private String checkUserName;
|
||||
|
||||
/**
|
||||
* 检查时间
|
||||
*/
|
||||
@Excel(name = "检查时间", sort = 5)
|
||||
private String checkDate;
|
||||
|
||||
/**
|
||||
* 检查地点
|
||||
*/
|
||||
@Excel(name = "检查地点", sort = 6)
|
||||
private String checkPlace;
|
||||
|
||||
/**
|
||||
* 违章描述
|
||||
*/
|
||||
@Excel(name = "违章描述", sort = 7)
|
||||
private String checkDesc;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ public class CoordinatePhotoServiceImpl implements CoordinatePhotoService {
|
|||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
}
|
||||
return ServerResponse.createSuccess();
|
||||
return ServerResponse.createSuccess("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -145,7 +145,7 @@ public class CoordinatePhotoServiceImpl implements CoordinatePhotoService {
|
|||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
return ServerResponse.createSuccess();
|
||||
return ServerResponse.createSuccess("修改成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
|
|||
synthesisQueryService.addComprehensiveQuery(comprehensiveQueryVo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
}
|
||||
return ServerResponse.createSuccess();
|
||||
return ServerResponse.createSuccess("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,7 +139,7 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
|
|||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
return ServerResponse.createSuccess();
|
||||
return ServerResponse.createSuccess("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,185 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 时间工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
{
|
||||
public static String YYYY = "yyyy";
|
||||
|
||||
public static String YYYY_MM = "yyyy-MM";
|
||||
|
||||
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||
|
||||
/**
|
||||
* 获取当前Date型日期
|
||||
*
|
||||
* @return Date() 当前日期
|
||||
*/
|
||||
public static Date getNowDate()
|
||||
{
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String getDate()
|
||||
{
|
||||
return dateTimeNow(YYYY_MM_DD);
|
||||
}
|
||||
|
||||
public static final String getTime()
|
||||
{
|
||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow()
|
||||
{
|
||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow(final String format)
|
||||
{
|
||||
return parseDateToStr(format, new Date());
|
||||
}
|
||||
|
||||
public static final String dateTime(final Date date)
|
||||
{
|
||||
return parseDateToStr(YYYY_MM_DD, date);
|
||||
}
|
||||
|
||||
public static final String parseDateToStr(final String format, final Date date)
|
||||
{
|
||||
return new SimpleDateFormat(format).format(date);
|
||||
}
|
||||
|
||||
public static final Date dateTime(final String format, final String ts)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new SimpleDateFormat(format).parse(ts);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期路径 即年/月/日 如2018/08/08
|
||||
*/
|
||||
public static final String datePath()
|
||||
{
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期路径 即年/月/日 如20180808
|
||||
*/
|
||||
public static final String dateTime()
|
||||
{
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||
}
|
||||
|
||||
public static final String getDateTimeString(Date date)
|
||||
{
|
||||
return DateFormatUtils.format(date, "yyyyMMdd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期型字符串转化为日期 格式
|
||||
*/
|
||||
public static Date parseDate(Object str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
return parseDate(str.toString(), parsePatterns);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器启动时间
|
||||
*/
|
||||
public static Date getServerStartDate()
|
||||
{
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
return new Date(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间差
|
||||
*
|
||||
* @param endDate 最后时间
|
||||
* @param startTime 开始时间
|
||||
* @return 时间差(天/小时/分钟)
|
||||
*/
|
||||
public static String timeDistance(Date endDate, Date startTime)
|
||||
{
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long nh = 1000 * 60 * 60;
|
||||
long nm = 1000 * 60;
|
||||
// long ns = 1000;
|
||||
// 获得两个时间的毫秒时间差异
|
||||
long diff = endDate.getTime() - startTime.getTime();
|
||||
// 计算差多少天
|
||||
long day = diff / nd;
|
||||
// 计算差多少小时
|
||||
long hour = diff % nd / nh;
|
||||
// 计算差多少分钟
|
||||
long min = diff % nd % nh / nm;
|
||||
// 计算差多少秒//输出结果
|
||||
// long sec = diff % nd % nh % nm / ns;
|
||||
return day + "天" + hour + "小时" + min + "分钟";
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加 LocalDateTime ==> Date
|
||||
*/
|
||||
public static Date toDate(LocalDateTime temporalAccessor)
|
||||
{
|
||||
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加 LocalDate ==> Date
|
||||
*/
|
||||
public static Date toDate(LocalDate temporalAccessor)
|
||||
{
|
||||
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
|
||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Excel
|
||||
{
|
||||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度
|
||||
*/
|
||||
public double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽度
|
||||
*/
|
||||
public double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||
*/
|
||||
public boolean needMerge() default false;
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串)
|
||||
*/
|
||||
public ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景颜色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景颜色
|
||||
*/
|
||||
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type() default Type.ALL;
|
||||
|
||||
|
||||
public enum Type
|
||||
{
|
||||
/**
|
||||
* ALL(0), EXPORT(1), IMPORT(2);
|
||||
*/
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
/**
|
||||
* NUMERIC(0), STRING(1), IMAGE(2);
|
||||
*/
|
||||
NUMERIC(0), STRING(1), IMAGE(2);
|
||||
private final int value;
|
||||
|
||||
ColumnType(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* Excel数据格式处理适配器
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ExcelHandlerAdapter
|
||||
{
|
||||
/**
|
||||
* 格式化
|
||||
*
|
||||
* @param value 单元格数据值
|
||||
* @param args excel注解args参数组
|
||||
* @param cell 单元格对象
|
||||
* @param wb 工作簿对象
|
||||
*
|
||||
* @return 处理后的值
|
||||
*/
|
||||
Object format(Object value, String[] args, Cell cell, Workbook wb);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Excel注解集
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Excels
|
||||
{
|
||||
Excel[] value();
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 图片处理工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ImageUtils
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
|
||||
|
||||
public static byte[] getImage(String imagePath)
|
||||
{
|
||||
InputStream is = getFile(imagePath);
|
||||
try
|
||||
{
|
||||
return IOUtils.toByteArray(is);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("图片加载异常 {}", e);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(is);
|
||||
}
|
||||
}
|
||||
|
||||
public static InputStream getFile(String imagePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] result = readFile(imagePath);
|
||||
result = Arrays.copyOf(result, result.length);
|
||||
return new ByteArrayInputStream(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("获取图片异常 {}", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件为字节数据
|
||||
*
|
||||
* @param url 地址
|
||||
* @return 字节数据
|
||||
*/
|
||||
public static byte[] readFile(String url)
|
||||
{
|
||||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
// 网络地址
|
||||
URL urlObj = new URL(url);
|
||||
URLConnection urlConnection = urlObj.openConnection();
|
||||
urlConnection.setConnectTimeout(30 * 1000);
|
||||
urlConnection.setReadTimeout(60 * 1000);
|
||||
urlConnection.setDoInput(true);
|
||||
in = urlConnection.getInputStream();
|
||||
return IOUtils.toByteArray(in);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("访问文件异常 {}", e);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,402 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
|
||||
import com.bonus.imgTool.webResult.Convert;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ReflectUtils
|
||||
{
|
||||
private static final String SETTER_PREFIX = "set";
|
||||
|
||||
private static final String GETTER_PREFIX = "get";
|
||||
|
||||
private static final String CGLIB_CLASS_SEPARATOR = "$$";
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
|
||||
|
||||
/**
|
||||
* 调用Getter方法.
|
||||
* 支持多级,如:对象名.对象名.方法
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> E invokeGetter(Object obj, String propertyName)
|
||||
{
|
||||
Object object = obj;
|
||||
for (String name : StringUtils.split(propertyName, "."))
|
||||
{
|
||||
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
|
||||
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
|
||||
}
|
||||
return (E) object;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用Setter方法, 仅匹配方法名。
|
||||
* 支持多级,如:对象名.对象名.方法
|
||||
*/
|
||||
public static <E> void invokeSetter(Object obj, String propertyName, E value)
|
||||
{
|
||||
Object object = obj;
|
||||
String[] names = StringUtils.split(propertyName, ".");
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
if (i < names.length - 1)
|
||||
{
|
||||
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
|
||||
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
|
||||
}
|
||||
else
|
||||
{
|
||||
String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
|
||||
invokeMethodByName(object, setterMethodName, new Object[] { value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> E getFieldValue(final Object obj, final String fieldName)
|
||||
{
|
||||
Field field = getAccessibleField(obj, fieldName);
|
||||
if (field == null)
|
||||
{
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
return null;
|
||||
}
|
||||
E result = null;
|
||||
try
|
||||
{
|
||||
result = (E) field.get(obj);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
logger.error("不可能抛出的异常{}", e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数.
|
||||
*/
|
||||
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value)
|
||||
{
|
||||
Field field = getAccessibleField(obj, fieldName);
|
||||
if (field == null)
|
||||
{
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
field.set(obj, value);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
logger.error("不可能抛出的异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接调用对象方法, 无视private/protected修饰符.
|
||||
* 用于一次性调用的情况,否则应使用getAccessibleMethod()函数获得Method后反复调用.
|
||||
* 同时匹配方法名+参数类型,
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
|
||||
final Object[] args)
|
||||
{
|
||||
if (obj == null || methodName == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
|
||||
if (method == null)
|
||||
{
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
return (E) method.invoke(obj, args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接调用对象方法, 无视private/protected修饰符,
|
||||
* 用于一次性调用的情况,否则应使用getAccessibleMethodByName()函数获得Method后反复调用.
|
||||
* 只匹配函数名,如果有多个同名函数调用第一个。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args)
|
||||
{
|
||||
Method method = getAccessibleMethodByName(obj, methodName, args.length);
|
||||
if (method == null)
|
||||
{
|
||||
// 如果为空不报错,直接返回空。
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
// 类型转换(将参数数据类型转换为目标方法参数类型)
|
||||
Class<?>[] cs = method.getParameterTypes();
|
||||
for (int i = 0; i < cs.length; i++)
|
||||
{
|
||||
if (args[i] != null && !args[i].getClass().equals(cs[i]))
|
||||
{
|
||||
if (cs[i] == String.class)
|
||||
{
|
||||
args[i] = Convert.toStr(args[i]);
|
||||
if (StringUtils.endsWith((String) args[i], ".0"))
|
||||
{
|
||||
args[i] = StringUtils.substringBefore((String) args[i], ".0");
|
||||
}
|
||||
}
|
||||
else if (cs[i] == Integer.class)
|
||||
{
|
||||
args[i] = Convert.toInt(args[i]);
|
||||
}
|
||||
else if (cs[i] == Long.class)
|
||||
{
|
||||
args[i] = Convert.toLong(args[i]);
|
||||
}
|
||||
else if (cs[i] == Double.class)
|
||||
{
|
||||
args[i] = Convert.toDouble(args[i]);
|
||||
}
|
||||
else if (cs[i] == Float.class)
|
||||
{
|
||||
args[i] = Convert.toFloat(args[i]);
|
||||
}
|
||||
else if (cs[i] == Date.class)
|
||||
{
|
||||
if (args[i] instanceof String)
|
||||
{
|
||||
args[i] = DateUtils.parseDate(args[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
args[i] = DateUtil.getJavaDate((Double) args[i]);
|
||||
}
|
||||
}
|
||||
else if (cs[i] == boolean.class || cs[i] == Boolean.class)
|
||||
{
|
||||
args[i] = Convert.toBool(args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (E) method.invoke(obj, args);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问.
|
||||
* 如向上转型到Object仍无法找到, 返回null.
|
||||
*/
|
||||
public static Field getAccessibleField(final Object obj, final String fieldName)
|
||||
{
|
||||
// 为空不报错。直接返回 null
|
||||
if (obj == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Validate.notBlank(fieldName, "fieldName can't be blank");
|
||||
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass())
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = superClass.getDeclaredField(fieldName);
|
||||
makeAccessible(field);
|
||||
return field;
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问.
|
||||
* 如向上转型到Object仍无法找到, 返回null.
|
||||
* 匹配函数名+参数类型。
|
||||
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
|
||||
*/
|
||||
public static Method getAccessibleMethod(final Object obj, final String methodName,
|
||||
final Class<?>... parameterTypes)
|
||||
{
|
||||
// 为空不报错。直接返回 null
|
||||
if (obj == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Validate.notBlank(methodName, "methodName can't be blank");
|
||||
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = searchType.getDeclaredMethod(methodName, parameterTypes);
|
||||
makeAccessible(method);
|
||||
return method;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问.
|
||||
* 如向上转型到Object仍无法找到, 返回null.
|
||||
* 只匹配函数名。
|
||||
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
|
||||
*/
|
||||
public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum)
|
||||
{
|
||||
// 为空不报错。直接返回 null
|
||||
if (obj == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Validate.notBlank(methodName, "methodName can't be blank");
|
||||
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
|
||||
{
|
||||
Method[] methods = searchType.getDeclaredMethods();
|
||||
for (Method method : methods)
|
||||
{
|
||||
if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum)
|
||||
{
|
||||
makeAccessible(method);
|
||||
return method;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||
*/
|
||||
public static void makeAccessible(Method method) {
|
||||
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))) {
|
||||
if (!method.isAccessible()){
|
||||
method.setAccessible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。
|
||||
*/
|
||||
public static void makeAccessible(Field field) {
|
||||
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers()))) {
|
||||
if (!field.isAccessible()){
|
||||
field.setAccessible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过反射, 获得Class定义中声明的泛型参数的类型, 注意泛型必须定义在父类处
|
||||
* 如无法找到, 返回Object.class.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Class<T> getClassGenricType(final Class clazz)
|
||||
{
|
||||
return getClassGenricType(clazz, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过反射, 获得Class定义中声明的父类的泛型参数的类型.
|
||||
* 如无法找到, 返回Object.class.
|
||||
*/
|
||||
public static Class getClassGenricType(final Class clazz, final int index)
|
||||
{
|
||||
Type genType = clazz.getGenericSuperclass();
|
||||
|
||||
if (!(genType instanceof ParameterizedType))
|
||||
{
|
||||
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
|
||||
|
||||
if (index >= params.length || index < 0)
|
||||
{
|
||||
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
|
||||
+ params.length);
|
||||
return Object.class;
|
||||
}
|
||||
if (!(params[index] instanceof Class))
|
||||
{
|
||||
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
return (Class) params[index];
|
||||
}
|
||||
|
||||
public static Class<?> getUserClass(Object instance)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
throw new RuntimeException("Instance must not be null");
|
||||
}
|
||||
Class clazz = instance.getClass();
|
||||
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR))
|
||||
{
|
||||
Class<?> superClass = clazz.getSuperclass();
|
||||
if (superClass != null && !Object.class.equals(superClass))
|
||||
{
|
||||
return superClass;
|
||||
}
|
||||
}
|
||||
return clazz;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将反射时的checked exception转换为unchecked exception.
|
||||
*/
|
||||
public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e)
|
||||
{
|
||||
if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException
|
||||
|| e instanceof NoSuchMethodException)
|
||||
{
|
||||
return new IllegalArgumentException(msg, e);
|
||||
}
|
||||
else if (e instanceof InvocationTargetException)
|
||||
{
|
||||
return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException());
|
||||
}
|
||||
return new RuntimeException(msg, e);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ public class StrUtil {
|
|||
|
||||
/**
|
||||
* 字符串转为驼峰
|
||||
*
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<if test="createUserId != null">create_user_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createUserName != null">create_user_name,</if>
|
||||
<if test="updateUserid != null">update_user_id,</if>
|
||||
<if test="updateUserId != null">update_user_id,</if>
|
||||
<if test="updateUserName != null">update_user_name,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="dataSource != null">data_source,</if>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<if test="createUserId != null">#{createUserId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUserName != null">#{createUserName},</if>
|
||||
<if test="updateUserid != null">#{updateUserid},</if>
|
||||
<if test="updateUserId != null">#{updateUserid},</if>
|
||||
<if test="updateUserName != null">#{updateUserName},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="dataSource != null">#{dataSource},</if>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
</insert>
|
||||
|
||||
<update id="updateCoordinatePhoto">
|
||||
update tb_safety_measure
|
||||
update tb_coordinate_photo
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="proId != null">pro_id = #{proId},</if>
|
||||
<if test="proName != null">pro_name = #{proName},</if>
|
||||
|
|
@ -72,7 +72,10 @@
|
|||
</delete>
|
||||
|
||||
<select id="getCoordinatePhotoList" resultType="com.bonus.imgTool.imageUpload.dto.CoordinatePhotoVo">
|
||||
select * from tb_coordinate_photo
|
||||
select id as id, pro_id as proId, pro_name as proName,build_place as buildPlace, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, build_before_desc as buildBeforeDesc, build_under_desc as buildUnderDesc,
|
||||
build_after_desc as buildAfterDesc, create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName from tb_coordinate_photo
|
||||
where is_active = '1'
|
||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||
|
|
@ -81,12 +84,16 @@
|
|||
and (
|
||||
build_before_desc like concat('%', #{keyWord}, '%') or
|
||||
build_under_desc like concat('%', #{keyWord}, '%') or
|
||||
build_after_desc like concat('%', #{keyWord}, '%')
|
||||
build_after_desc like concat('%', #{keyWord}, '%') or
|
||||
build_place like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="getCoordinatePhotoById" resultType="com.bonus.imgTool.imageUpload.dto.CoordinatePhotoVo">
|
||||
select * from tb_coordinate_photo
|
||||
select id as id, pro_id as proId, pro_name as proName,build_place as buildPlace, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, build_before_desc as buildBeforeDesc, build_under_desc as buildUnderDesc,
|
||||
build_after_desc as buildAfterDesc, create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName from tb_coordinate_photo
|
||||
where id = #{id} and is_active = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<mapper namespace="com.bonus.imgTool.imageUpload.mapper.ImportantMatterMapper">
|
||||
|
||||
<insert id="addImportantMatter" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_coordinate_photo
|
||||
insert into tb_main_matter_publicize_photo
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="proId != null and proId != ''">pro_id,</if>
|
||||
<if test="proName != null">pro_name,</if>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<if test="createUserId != null">create_user_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createUserName != null">create_user_name,</if>
|
||||
<if test="updateUserid != null">update_user_id,</if>
|
||||
<if test="updateUserId != null">update_user_id,</if>
|
||||
<if test="updateUserName != null">update_user_name,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="dataSource != null">data_source,</if>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<if test="createUserId != null">#{createUserId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUserName != null">#{createUserName},</if>
|
||||
<if test="updateUserid != null">#{updateUserid},</if>
|
||||
<if test="updateUserId != null">#{updateUserid},</if>
|
||||
<if test="updateUserName != null">#{updateUserName},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="dataSource != null">#{dataSource},</if>
|
||||
|
|
@ -64,12 +64,15 @@
|
|||
</update>
|
||||
|
||||
<delete id="deleteImportantMatter">
|
||||
update tb_coordinate_photo set is_active ='0'
|
||||
update tb_main_matter_publicize_photo set is_active ='0'
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getImportantMatterList" resultType="com.bonus.imgTool.imageUpload.dto.ImportantMatterVo">
|
||||
select * from tb_main_matter_publicize_photo
|
||||
select id as id, pro_id as proId, pro_name as proName, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, time as time, title as title, content as content,create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName
|
||||
from tb_main_matter_publicize_photo
|
||||
where is_active = '1'
|
||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||
|
|
@ -82,7 +85,9 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="getImportantMatterById" resultType="com.bonus.imgTool.imageUpload.dto.ImportantMatterVo">
|
||||
select * from tb_main_matter_publicize_photo
|
||||
select id as id, pro_id as proId, pro_name as proName, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, time as time, title as title, content as content,create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName from tb_main_matter_publicize_photo
|
||||
where id =#{id} and is_active = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@
|
|||
|
||||
|
||||
<select id="getSafetyMeasuresList" resultType="com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo">
|
||||
select * from tb_safety_measure
|
||||
select id as id, pro_id as proId, pro_name as proName, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, check_user_name as checkUserName, check_date as checkDate,
|
||||
check_place as checkPlace, check_desc as checkDesc,create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName from tb_safety_measure
|
||||
where is_active = '1'
|
||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||
|
|
@ -88,7 +91,10 @@
|
|||
|
||||
</select>
|
||||
<select id="getSafetyMeasuresById" resultType="com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo">
|
||||
select * from tb_safety_measure
|
||||
select id as id, pro_id as proId, pro_name as proName, major_id as majorId, major_name as majorName,
|
||||
gx_id as gxId, gx_name as gxName, check_user_name as checkUserName, check_date as checkDate,
|
||||
check_place as checkPlace, check_desc as checkDesc,create_user_id as createUserId,
|
||||
create_time as createTime, create_user_name as createUserName from tb_safety_measure
|
||||
where id =#{id} and is_active = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@
|
|||
where source_id = #{id}
|
||||
</delete>
|
||||
<select id="getSysFileResourceList" resultType="com.bonus.imgTool.system.vo.SysFileResourceVo">
|
||||
select * from sys_file_resource where source_id = #{id} and upload_type =#{uploadType} and is_active ='1'
|
||||
select id as id, file_name as fileName,file_suffix as fileSuffix,file_size as fileSize,
|
||||
original_file_path as originalFilePath,compress_file_path as compressFilePath,
|
||||
watermark_file_path as watermarkFilePath, file_type as fileType, source_id as sourceId,
|
||||
upload_type as uploadType, source_type as sourceType, source_type_name as sourceTypeName
|
||||
from sys_file_resource where source_id = #{id} and upload_type =#{uploadType} and is_active ='1'
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue