Commit cec8a2b8 authored by 李秀明's avatar 李秀明

Merge remote-tracking branch 'origin/develop_dl_bugfix' into develop_dl_bugfix

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/FileUtils.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/util/WordConverterUtils.java
parents a7cdbee7 4bde105b
package com.yeejoin.amos.fas.core.common.request;
import java.security.SecureRandom;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
......@@ -1071,8 +1072,10 @@ public class DateUtil {
{
;
}
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
return day;
if (null != date && null != mydate) {
return (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
return 0;
}
/**
......@@ -1115,7 +1118,7 @@ public class DateUtil {
*/
private static String getRandom(int i)
{
Random jjj = new Random();
SecureRandom jjj = new SecureRandom();
// int suiJiShu = jjj.nextInt(9);
if (i == 0) return "";
String jj = "";
......
......@@ -117,9 +117,17 @@ public class FileController extends BaseController {
ResponseUtils.renderText(response, "File not exists!");
return;
}
FileInputStream fis = new FileInputStream(file);
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
ResponseUtils.downFileByInputStream(file.getName(), fis, response, open);
IOUtils.closeQuietly(fis);
} catch (IOException e) {
} finally {
if (null != fis) {
fis.close();
}
}
}
@Permission
......@@ -228,14 +236,40 @@ public class FileController extends BaseController {
}
String htmlContent = (String) processData.get("html");
FileOutputStream fileOutputStream = null;
OutputStreamWriter outputStreamWriter = null;
Writer writer = null;
try {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFileName), "UTF-8"));
fileOutputStream = new FileOutputStream(htmlFileName);
outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");
writer = new BufferedWriter(outputStreamWriter);
writer.write(htmlContent);
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (null != writer) {
writer.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if (null != outputStreamWriter) {
outputStreamWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if (null != fileOutputStream) {
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
String filePath = obj.getString("file");
processData.put("html", "/" + filePath.substring(0, filePath.lastIndexOf(".")) + ".html");
......
......@@ -69,6 +69,8 @@ public class PlanVisual3dController extends BaseController {
if (testPlan != null) {
String path = testPlan.getFilePath();
if (path != null && !"".equals(path)) {
FileInputStream inputStream = null;
InputStream fis = null;
try {
// path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path);
......@@ -79,10 +81,12 @@ public class PlanVisual3dController extends BaseController {
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));
inputStream = new FileInputStream(fileUploadDir + path);
if (null != inputStream) {
fis = new BufferedInputStream(inputStream);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
// response.reset();
// 设置response的Header
......@@ -94,11 +98,23 @@ public class PlanVisual3dController extends BaseController {
toClient.write(buffer);
toClient.flush();
toClient.close();
}
} else {
response.setStatus(404);
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
if (null != inputStream) {
inputStream.close();
}
if (null != fis) {
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
} else {
......
......@@ -35,6 +35,8 @@ public class WeatherController extends BaseController {
String result = "";
BufferedReader in = null;
BufferedReader responseReader = null;
InputStreamReader res = null;
try {
String urlNameString = weatherUrl + address;
URL realUrl = new URL(urlNameString);
......@@ -55,12 +57,13 @@ public class WeatherController extends BaseController {
StringBuffer sb = new StringBuffer();
String readLine = new String();
GZIPInputStream gZipS=new GZIPInputStream(connection.getInputStream());
InputStreamReader res = new InputStreamReader(gZipS,"UTF-8");
BufferedReader responseReader = new BufferedReader(res);
res = new InputStreamReader(gZipS,"UTF-8");
responseReader = new BufferedReader(res);
while ((readLine = responseReader.readLine()) != null) {
sb.append(readLine);
}
responseReader.close();
result = sb.toString();
System.out.println(result);
......@@ -75,6 +78,12 @@ public class WeatherController extends BaseController {
if (in != null) {
in.close();
}
if (null != responseReader) {
responseReader.close();
}
if (null != res) {
res.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
......
......@@ -161,9 +161,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
}
}
}
if (!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString());
if (null != map &&!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.getOrDefault("total", 0).toString());
Integer count = Integer.parseInt(map.getOrDefault("count", 0).toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
return total.equals(count);
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
......
......@@ -325,7 +325,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 ? equipment2.getCreateDate() : new Date());
}
preplanPictureDao.saveAndFlush(pp);
......@@ -369,8 +369,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
if(date.isPresent()){
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate() == null ? new Date() : equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 && null != equipment2.getCreateDate() ? equipment2.getCreateDate() : new Date());
}
} else {
equipment = save(equipment);
......@@ -382,7 +381,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
equipment2=date.get();
}
equipment.setCreateDate(equipment2.getCreateDate() == null ? new Date() : equipment2.getCreateDate());
equipment.setCreateDate(null != equipment2 && null != equipment2.getCreateDate() ? equipment2.getCreateDate() : new Date());
}
Long equipmentId = Long.valueOf(equipment.getId());
for (int i = 0; i < imgs.length; i++) {
......
......@@ -210,6 +210,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(FasConstant.RISK_SOURCE_STATUS_NORMAL);
riskSource.setCreateDate(new Date());
} else {// 更新
if (null != oldRiskSource) {
riskSource.setCreateDate(oldRiskSource.getCreateDate());
riskSource.setFmeaList(oldRiskSource.getFmeaList());
riskSource.setIncrement(oldRiskSource.getIncrement());
......@@ -218,6 +219,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpni(oldRiskSource.getRpni());
riskSource.setStatus(oldRiskSource.getStatus());
}
}
iRiskSourceDao.saveAndFlush(riskSource);
return riskSource;
}
......
......@@ -267,13 +267,15 @@ public class FileHelper {
public static void writeFile(String content, String path) {
OutputStream fos = null;
BufferedWriter bw = null;
OutputStreamWriter outputStreamWriter = null;
try {
File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
outputStreamWriter = new OutputStreamWriter(fos, "UTF-8");
bw = new BufferedWriter(outputStreamWriter);
bw.write(content);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
......@@ -281,11 +283,17 @@ public class FileHelper {
ioe.printStackTrace();
} finally {
try {
if (bw != null) {
if (null != bw) {
bw.close();
}
} catch (IOException ioException) {
System.err.println(ioException.getMessage());
if (null != fos) {
fos.close();
}
if (null != outputStreamWriter) {
outputStreamWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -377,9 +385,12 @@ public class FileHelper {
// 以GB2312读取文件
BufferedReader br = null;
BufferedWriter bw = null;
FileWriter fileWriter = null;
try {
br = new BufferedReader(new FileReader(htmFile));
bw = new BufferedWriter(new FileWriter(new File(outPutFile)));
FileReader fileReader = new FileReader(htmFile);
br = new BufferedReader(fileReader);
fileWriter = new FileWriter(new File(outPutFile));
bw = new BufferedWriter(fileWriter);
String result = null;
while (null != (result = br.readLine())) {
if (!"".equals(result.trim())) {
......@@ -393,11 +404,22 @@ public class FileHelper {
if (null != br) {
br.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (null != bw) {
bw.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (null != fileWriter) {
fileWriter.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
......@@ -578,37 +600,27 @@ public class FileHelper {
}
public static void nioTransferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = new FileInputStream(source);
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
try (
FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = new FileOutputStream(target);
FileChannel in = inStream.getChannel();
FileChannel out = outStream.getChannel();
) {
in.transferTo(0, in.size(), out);
} catch (IOException e) {
e.printStackTrace();
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
}
}
private static boolean nioBufferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = new FileInputStream(source);
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
try (
FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = new FileOutputStream(target);
FileChannel in = inStream.getChannel();
FileChannel out = outStream.getChannel();
) {
ByteBuffer buffer = ByteBuffer.allocate(4096);
while (in.read(buffer) != -1) {
buffer.flip();
......@@ -618,22 +630,16 @@ public class FileHelper {
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
}
return true;
}
public static void customBufferStreamCopy(File source, File target) {
InputStream fis = null;
OutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(target);
try (
InputStream fis = new FileInputStream(source);
OutputStream fos = new FileOutputStream(target);
) {
byte[] buf = new byte[4096];
int i;
while ((i = fis.read(buf)) != -1) {
......@@ -641,9 +647,6 @@ public class FileHelper {
}
} catch (Exception e) {
e.printStackTrace();
} finally {
close(fis);
close(fos);
}
}
......@@ -1190,10 +1193,7 @@ public class FileHelper {
* @Title: getExcel
* @Description: 下载指定路径的Excel文件
*/
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) {
try {
public static void getExcel(String url, String fileName, HttpServletResponse response, HttpServletRequest request) throws UnsupportedEncodingException {
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
......@@ -1204,22 +1204,17 @@ public class FileHelper {
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//通过文件路径获得File对象
File file = new File(url);
FileInputStream in = new FileInputStream(file);
try (
FileInputStream in = new FileInputStream(new File(url));
//3.通过response获取OutputStream对象(out)
OutputStream out = new BufferedOutputStream(response.getOutputStream());
) {
int b = 0;
byte[] buffer = new byte[2048];
while ((b = in.read(buffer)) != -1) {
out.write(buffer, 0, b); //4.写到输出流(out)中
}
in.close();
out.flush();
out.close();
} catch (IOException e) {
log.error("下载Excel模板异常", e);
}
......
......@@ -9,7 +9,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -67,10 +66,14 @@ public class FileUtils {
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (null != br) {
br.close();
}
if (null != out) {
out.close();
}
}
}
/**
* 通过文件服务器——>获取流——>输出——>压缩
......@@ -84,10 +87,6 @@ public class FileUtils {
throw new RuntimeException("文件名不能为空");
}
fileName = FilenameUtils.normalize(fileName);
InputStream fis = null;
BufferedInputStream bis = null;
FileOutputStream fos = null;
ZipOutputStream zos = null;
// 临时目录
String tmpdir = System.getProperty("java.io.tmpdir");
......@@ -97,48 +96,50 @@ public class FileUtils {
tmpdir = "";
}
String path = FilenameUtils.normalize(tmpdir + fileName);
try {
File zipFile = new File(path);
zipFile.deleteOnExit();
try {
zipFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
try (
FileOutputStream fos = new FileOutputStream(zipFile);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fos);
ZipOutputStream zos = new ZipOutputStream(bufferedOutputStream);
) {
fos = new FileOutputStream(zipFile);
zos = new ZipOutputStream(new BufferedOutputStream(fos));
byte[] bufs = new byte[1024 * 10];
for (String a : list) {
fis = getInputStreamFromURL(ipUrl + a);
try (
InputStream fis = getInputStreamFromURL(ipUrl + a)
) {
assert fis != null;
try (BufferedInputStream bis = new BufferedInputStream(fis, 1024 * 10)
) {
String subFileName = new File(ipUrl + a).getName();
//创建ZIP实体,并添加进压缩包
ZipEntry zipEntry = new ZipEntry(subFileName);
zos.putNextEntry(zipEntry);
bis = new BufferedInputStream(fis, 1024 * 10);
int read = 0;
while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {
zos.write(bufs, 0, read);
}
}
System.out.println("压缩成功");
} catch (FileNotFoundException e) {
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
} finally {
try {
if (null != bis) {
bis.close();
}
if (null != zos) {
zos.close();
}
System.out.println("压缩成功");
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new RuntimeException(e);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
return path;
}
......
package com.yeejoin.amos.fas.business.util;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
......@@ -12,7 +13,7 @@ public class RandomUtil {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
SecureRandom random = new SecureRandom();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
......
......@@ -402,8 +402,10 @@ public static Time formatStrToTime(String strDate){
} catch (Exception e) {
e.printStackTrace();
}
Time date = new Time(d.getTime());
return date;
if (null != d) {
return new Time(d.getTime());
}
return null;
}
/**
......
......@@ -26,10 +26,15 @@ public class FileUtil {
if (!targetFile.exists()) {
targetFile.mkdirs();
}
try (
FileOutputStream out = new FileOutputStream(filePath + fileName);
) {
out.write(file);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
......
......@@ -41,19 +41,11 @@ public class MyImageExtractor implements IImageExtractor {
imagePath = s1 + pre + s2;
File imageFile = new File(baseDir, imagePath);
imageFile.getParentFile().mkdirs();
InputStream in = null;
OutputStream out = null;
try {
in = new ByteArrayInputStream(imageData);
out = new FileOutputStream(imageFile);
try (
InputStream in = new ByteArrayInputStream(imageData);
OutputStream out = new FileOutputStream(imageFile);
) {
IOUtils.copy(in, out);
} finally {
if (in != null) {
IOUtils.closeQuietly(in);
}
if (out != null) {
IOUtils.closeQuietly(out);
}
}
}
......
......@@ -78,7 +78,10 @@ public class WordConverterUtils {
* @param readUrl html中img标签的图片存储路径
*/
private static void docToHtml(File srcFile, File targetFile, String readUrl) {
try {
try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr);
if (!imagePath.exists()) {
......@@ -86,13 +89,14 @@ public class WordConverterUtils {
}
String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try {
try (
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
) {
out.write(content);
return uri + suffix + name;
} catch (Exception e) {
......@@ -124,7 +128,10 @@ public class WordConverterUtils {
* @return
*/
private static String docToHtmlString(File srcFile, String readUrl) {
try {
try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr);
if (!imagePath.exists()) {
......@@ -132,7 +139,6 @@ public class WordConverterUtils {
}
String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
......@@ -183,30 +189,22 @@ public class WordConverterUtils {
}
String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null;
try {
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile));
try (
FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "utf-8");
) {
XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
System.out.println("uri :" + uri);
options.URIResolver(new MyURIResolver(uri));
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(targetFile), "utf-8");
XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance();
xhtmlConverter.convert(document, outputStreamWriter, options);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
/**
......@@ -223,9 +221,11 @@ public class WordConverterUtils {
}
String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null;
try {
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile));
try (
FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(inputStream);
)
{
XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
......@@ -237,15 +237,6 @@ public class WordConverterUtils {
return stringWriter.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return null;
......
......@@ -6,7 +6,7 @@
UPDATE
contingency_plan_instance
SET
runstate = ${runStatus}
runstate = #{runStatus}
<if test="content != null and content != ''">
, content = #{content}
</if>
......@@ -17,7 +17,7 @@
UPDATE
contingency_plan_instance
SET
runstate = ${runStatus}
runstate = #{runStatus}
<if test="content != null and content != ''">
, content = #{content}
</if>
......
......@@ -18,7 +18,7 @@
m.batch_no = #{batchNo}
</if>
<if test="stepIndex != null">
AND m.step_index = ${stepIndex}
AND m.step_index = #{stepIndex}
</if>
</where>
ORDER BY
......@@ -35,7 +35,7 @@
m.batch_no = #{batchNo}
</if>
<if test="stepIndex != null">
AND m.step_index = ${stepIndex}
AND m.step_index = #{stepIndex}
</if>
<if test="indexUpdateTime != null">
AND m.index_create_time = #{indexUpdateTime}
......
......@@ -13,19 +13,19 @@
WHERE
1=1
<if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}')
and TO_DAYS(m.time) = TO_DAYS('#{time}')
</if>
<if test="type!=null">
AND m.type = '${type}'
AND m.type = '#{type}'
</if>
<if test="title!=null">
AND m.title LIKE '%${title}%'
AND m.title LIKE '%#{title}%'
</if>
<if test="orgCode!=null">
AND (
m.org_code = '${orgCode}'
OR m.org_code LIKE '${orgCode}*%'
m.org_code = '#{orgCode}'
OR m.org_code LIKE '#{orgCode}*%'
)
</if>
</select>
......@@ -39,22 +39,22 @@
WHERE
1=1
<if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('${time}')
and TO_DAYS(m.time) = TO_DAYS('#{time}')
</if>
<if test="type!=null">
AND m.type = '${type}'
AND m.type = '#{type}'
</if>
<if test="title!=null">
AND m.title LIKE '%${title}%'
AND m.title LIKE '%#{title}%'
</if>
<if test="orgCode!=null">
AND (
m.org_code = '${orgCode}'
OR m.org_code LIKE '${orgCode}*%'
m.org_code = '#{orgCode}'
OR m.org_code LIKE '#{orgCode}*%'
)
</if>
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</select>
......
......@@ -19,7 +19,7 @@
<!-- FROM-->
<!-- f_fire_station fs-->
<!-- WHERE-->
<!-- fs.id = ${id}-->
<!-- fs.id = #{id}-->
<!-- </select>-->
......@@ -30,7 +30,7 @@
<!-- f_fire_station_equipment fs-->
<!-- JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}-->
<!-- fs.fire_station_id = #{fireStationId}-->
<!-- </select>-->
<!-- <select id="queryForFireEqumntPage" resultType="java.util.Map">-->
<!-- SELECT-->
......@@ -44,9 +44,9 @@
<!-- left join f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!-- left join f_risk_source frs on frs.id = f.risk_source_id-->
<!-- WHERE-->
<!-- fs.fire_station_id = ${fireStationId}-->
<!-- fs.fire_station_id = #{fireStationId}-->
<!-- and f.id is not null-->
<!-- LIMIT ${start}, ${length};-->
<!-- LIMIT #{start}, #{length};-->
<!-- </select>-->
<!-- <select id="queryCountForPage" resultType="long">-->
......@@ -58,13 +58,13 @@
<!-- WHERE-->
<!-- 1=1-->
<!-- <if test="name!=null">-->
<!-- AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!-- AND (fs.name LIKE '%#{name}%' or fs.`code` LIKE '%#{name}%')-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'-->
<!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>-->
<!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%';-->
<!-- AND fs.`type` LIKE '%#{type}%';-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="queryForPage" resultType="java.util.Map">-->
......@@ -85,15 +85,15 @@
<!-- 1=1-->
<!-- <if test="name!=null">-->
<!-- AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!-- AND (fs.name LIKE '%#{name}%' or fs.`code` LIKE '%#{name}%')-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- AND fs.`code` LIKE '%${code}%'-->
<!-- AND fs.`code` LIKE '%#{code}%'-->
<!-- </if>-->
<!-- <if test="type!=null">-->
<!-- AND fs.`type` LIKE '%${type}%'-->
<!-- AND fs.`type` LIKE '%#{type}%'-->
<!-- </if>-->
<!-- LIMIT ${start},${length} ;-->
<!-- LIMIT #{start},#{length} ;-->
<!-- </select>-->
......@@ -126,14 +126,14 @@
a.instance_id
) s
<if test="name!=null">
AND s.name LIKE '%${name}%'
AND s.name LIKE '%#{name}%'
</if>
<if test="code!=null">
AND s.`code` LIKE '%${code}%'
AND s.`code` LIKE '%#{code}%'
</if>
<if test="type!=null">
AND s.`type` LIKE '%${type}%';
AND s.`type` LIKE '%#{type}%';
</if>
</select>
......
......@@ -139,10 +139,10 @@
) d
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
AND d.fireEquipmentName LIKE '%#{fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
AND d.equipmentName LIKE '%#{equipmentName}%'
</if>
<if test="startTime != null and startTime != ''">
AND d.update_date &gt;= #{startTime}
......@@ -194,10 +194,10 @@
) d
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
AND d.fireEquipmentName LIKE '%#{fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
AND d.equipmentName LIKE '%#{equipmentName}%'
</if>
<if test="startTime != null and startTime != ''">
AND d.create_date &gt;= #{startTime}
......@@ -207,7 +207,7 @@
</if>
</where>
ORDER BY d.create_date desc
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
......@@ -218,14 +218,14 @@
<!-- where-->
<!-- 1=1-->
<!-- <if test="equipClassify!=null">-->
<!-- and fe.equip_classify in ( ${equipClassify} )-->
<!-- and fe.equip_classify in ( #{equipClassify} )-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- and fe.`code` like '%${code}%'-->
<!-- and fe.`code` like '%#{code}%'-->
<!-- </if>-->
<!-- <if test="name!=null">-->
<!-- and (fe.`name` like '%${name}%' or fe.`code` like '%${name}%')-->
<!-- and (fe.`name` like '%#{name}%' or fe.`code` like '%#{name}%')-->
<!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;-->
......@@ -258,14 +258,14 @@
<!-- where 1=1) tmp-->
<!-- <where>-->
<!-- <if test="equipClassify!=null">-->
<!-- and tmp.equip_classify in ( ${equipClassify} )-->
<!-- and tmp.equip_classify in ( #{equipClassify} )-->
<!-- </if>-->
<!-- <if test="code!=null">-->
<!-- and tmp.`code` like '%${code}%'-->
<!-- and tmp.`code` like '%#{code}%'-->
<!-- </if>-->
<!-- <if test="name!=null">-->
<!-- and (tmp.`name` like '%${name}%' or tmp.`code` like '%${name}%')-->
<!-- and (tmp.`name` like '%#{name}%' or tmp.`code` like '%#{name}%')-->
<!-- </if>-->
<!-- &lt;!&ndash; 筛选未绑定的配套设施-->
<!-- &ndash;&gt;-->
......@@ -273,7 +273,7 @@
<!-- AND tmp.bindStation is not true-->
<!-- </if>-->
<!-- </where>-->
<!-- LIMIT ${start},${length}-->
<!-- LIMIT #{start},#{length}-->
<!-- </select>-->
......@@ -291,7 +291,7 @@
<!-- FROM-->
<!-- f_fire_station_equipment se-->
<!-- WHERE-->
<!-- se.fire_station_id = ${fireStationId}-->
<!-- se.fire_station_id = #{fireStationId}-->
<!-- AND se.fire_equipment_id = fe.id-->
<!-- )-->
<!-- </select>-->
......@@ -507,12 +507,12 @@
f_equipment_fire_equipment efe
JOIN f_fire_equipment fe ON efe.fire_equipment_id = fe.id
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
<if test="fname != null">
AND fe.`name` like '%${fname}%'
AND fe.`name` like '%#{fname}%'
</if>
<if test="length > 0">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -525,9 +525,9 @@
f_equipment_fire_equipment efe
JOIN wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
<if test="fname != null">
AND fe.`name` like '%${fname}%'
AND fe.`name` like '%#{fname}%'
</if>
</select>
......
......@@ -124,7 +124,7 @@
from
elec_bills_fire_safety_control
where BILL_SEQ = (select SEQUENCE_NBR from elec_bills_basic_info where BILL_NO=#{billNo})
and type =${id}
and type =#{id}
</select>
<update id="updateBill">
UPDATE
......
......@@ -90,7 +90,7 @@
FROM
f_fmea f
WHERE
f.risk_source_id = ${riskSourceId};
f.risk_source_id = #{riskSourceId};
</select>
<select id="getById" resultType="com.yeejoin.amos.fas.dao.entity.Fmea">
......
......@@ -14,11 +14,11 @@
WHERE
1=1
<if test="fireEquipmentId != null">
and t.fire_equipment_id = ${fireEquipmentId}
and t.fire_equipment_id = #{fireEquipmentId}
</if>
<if test="equipmentId != null">
AND t.equipment_id = ${equipmentId};
AND t.equipment_id = #{equipmentId};
</if>
</select>
......@@ -29,8 +29,8 @@
FROM
f_equipment_fire_equipment t
WHERE
t.fire_equipment_id = ${fireEquipmentId}
AND t.equipment_id = ${equipmentId};
t.fire_equipment_id = #{fireEquipmentId}
AND t.equipment_id = #{equipmentId};
</select>
......@@ -46,7 +46,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.fire_equipment_id = ${fireEquipmentId}
efe.fire_equipment_id = #{fireEquipmentId}
)
LIMIT 0,1 ;
</select>
......@@ -81,11 +81,11 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id
)
<if test="start != -1 and length != -1">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -102,7 +102,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id = ${equipmentId}
efe.equipment_id = #{equipmentId}
AND efe.fire_equipment_id = fe.id
)
</select>-->
......@@ -121,7 +121,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.equipment_id =${equipmentId}
efe.equipment_id =#{equipmentId}
and f.id = efe.fire_equipment_id
)
</select>
......
......@@ -22,7 +22,7 @@
FROM
f_equipment_fire_equipment efe
WHERE
efe.fire_equipment_id = ${fireEquipmentId}
efe.fire_equipment_id = #{fireEquipmentId}
AND efe.equipment_id = fe.id
)
</select>
......@@ -76,7 +76,7 @@
ORDER BY
a.id
<if test="start != -1 and length != -1">
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</if>
</select>
......@@ -103,6 +103,6 @@
FROM
f_equipment
WHERE
id = ${id}
id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,6 @@
FROM
f_preplan_picture p
WHERE
p.equipment_id = ${equipmentId}
p.equipment_id = #{equipmentId}
</select>
</mapper>
\ No newline at end of file
......@@ -99,7 +99,7 @@
f_rpn_change_log cl
WHERE
cl.type = 0
and cl.create_date BETWEEN '${startTime}' and '${endTime}'
and cl.create_date BETWEEN '#{startTime}' and '#{endTime}'
)d
</select>
......@@ -362,7 +362,7 @@
<!-- FROM-->
<!-- f_risk_source_equipment se-->
<!-- WHERE-->
<!-- se.fire_equipment_id = ${fireEquipmentId}-->
<!-- se.fire_equipment_id = #{fireEquipmentId}-->
<!-- AND se.risk_source_id = rs.id-->
<!-- )-->
<!-- </select>-->
......@@ -380,7 +380,7 @@
<!-- FROM-->
<!-- f_risk_source_point_inputitem pi-->
<!-- WHERE-->
<!-- pi.point_id = ${pointId}-->
<!-- pi.point_id = #{pointId}-->
<!-- AND rs.id = pi.risk_source_id-->
<!-- )-->
<!-- </select>-->
......@@ -526,7 +526,7 @@
FROM
f_risk_source rs
WHERE
rs.id = ${riskSourceId};
rs.id = #{riskSourceId};
</select>
<select id="queryForRiskSourceRpni" resultType="map">
......@@ -535,7 +535,7 @@
FROM
f_risk_source rs
WHERE
rs.parent_id = ${parentId};
rs.parent_id = #{parentId};
</select>
<select id="queryForUnqualified" resultType="map">
......@@ -638,7 +638,7 @@
f_fmea ff
JOIN f_risk_factor rf ON ff.risk_factors_id = rf.id
WHERE
rf.id = ${factorId}
rf.id = #{factorId}
)
</select>
<!-- <select id="queryContingencyWater" resultType="com.yeejoin.amos.fas.business.vo.FormInstanceVo">-->
......@@ -734,8 +734,8 @@
INNER JOIN p_point_inputitem ppi ON ppi.ID = ffpi.point_inputitem_id) ffpi
ON ffpi.fmea_id = ff.id
WHERE
ffpi.point_id = ${pointId}
# EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = ${pointId} )
ffpi.point_id = #{pointId}
# EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = #{pointId} )
# EXISTS ( SELECT
# 1
# FROM
......@@ -744,7 +744,7 @@
# LEFT JOIN p_point_inputitem ppi on ppi.id = fpi.point_inputitem_id
# WHERE
# f.risk_source_id = frs.id
# AND ppi.point_id = ${pointId}
# AND ppi.point_id = #{pointId}
# )
</select>
......
......@@ -612,8 +612,8 @@
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1070,8 +1070,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1081,7 +1081,7 @@
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
<select id="retrieve3AllCount" resultType="long">
SELECT count(1) FROM (
......@@ -1277,8 +1277,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1486,8 +1486,8 @@
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
......@@ -1500,7 +1500,7 @@
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
LIMIT ${start},${length}
LIMIT #{start},#{length}
</select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment