Merge branch 'develop_3' into 'develop_master'

Develop 3

See merge request !113
This commit is contained in:
super_liu
2021-08-17 02:48:55 +00:00
5 changed files with 124 additions and 59 deletions
@@ -18,12 +18,9 @@ public class CodeGen {
private static final String PACKAGE_PATH="/adc-da-slrs/src/main";
private static final String AUTHOR="zyl";
private static final String AUTHOR="super_liu";
// x.x.x.x:3306/xxxx --MYSQL
// 192.168.10.140:1521:foton_slrs_test
// foton_slrs_test@101.36.227.22
private static final String DB_IP="192.168.10.47/foton_slrs_test";
private static final String DB_IP="127.0.0.1:3306/foton_slrs_test";
private static final String DB_USER="root";
@@ -130,36 +130,52 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
}
}
}
if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
int i = 0;
for (SarAdvanceSearchVO sarAdvanceSearchVO:searchList){
if ("SVPPS".equals(sarAdvanceSearchVO.getField()) && StringUtils.isBlank(sarAdvanceSearchVO.getValue())){
isNull = i;
}
i++;
}
if (-1 != isNull) {
searchList.remove(isNull);
}
if (isNull == 0 && searchList.size() > 0){
searchList.get(0).setConnect("");
}
String advanceStr = SarAdvanceSearchUtil.createSql(searchList);
if (null != advanceStr) {
advanceStr = advanceStr.replace("stand_number", "concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',SAR_STANDARDS_INFO.STAND_YEAR)");
}
if (-1 != isNull && StringUtils.isBlank(advanceStr)){
advanceStr = advanceStr + " SVPPS is null";
}else if (-1 != isNull && StringUtils.isNotBlank(advanceStr)){
advanceStr = advanceStr + " and SVPPS is null";
}
String advanceStr = SarAdvanceSearchUtil.createStandSql(searchList);
if (StringUtils.isNotBlank(advanceStr)) {
page.setAdvanceSearchStr(advanceStr);
} else {
page.setAdvanceSearchStr(null);
}
}
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
// List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
// int i = 0;
// for (SarAdvanceSearchVO sarAdvanceSearchVO:searchList){
// if ("SVPPS".equals(sarAdvanceSearchVO.getField()) && StringUtils.isBlank(sarAdvanceSearchVO.getValue())){
// isNull = i;
// }
// i++;
// }
// if (-1 != isNull) {
// searchList.remove(isNull);
// }
// if (isNull == 0 && searchList.size() > 0){
// searchList.get(0).setConnect("");
// }
// String advanceStr = SarAdvanceSearchUtil.createSql(searchList);
// if (null != advanceStr) {
// advanceStr = advanceStr.replace("stand_number", "concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',SAR_STANDARDS_INFO.STAND_YEAR)");
// }
// if (-1 != isNull && StringUtils.isBlank(advanceStr)){
// advanceStr = advanceStr + " SVPPS is null";
// }else if (-1 != isNull && StringUtils.isNotBlank(advanceStr)){
// advanceStr = advanceStr + " and SVPPS is null";
// }
// if (StringUtils.isNotBlank(advanceStr)) {
// page.setAdvanceSearchStr(advanceStr);
// } else {
// page.setAdvanceSearchStr(null);
// }
// }
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
@@ -87,5 +87,8 @@ public class SarStandardsInfoEOPage extends BasePage {
private String orderBy1 = "SAR_STANDARDS_INFO.issue_time";
private String order1 = "desc";
// zhaokaiyao
private String textStatus;//文本状态
}
@@ -14,61 +14,61 @@ import java.util.List;
public class SarAdvanceSearchUtil {
// 拼接sql语句
public static String createSql (List<SarAdvanceSearchVO> searchVOList) {
public static String createSql(List<SarAdvanceSearchVO> searchVOList) {
String sqlInfo = "";
StringBuilder sqlBuilder = new StringBuilder();
if (searchVOList != null && !searchVOList.isEmpty()) {
for (SarAdvanceSearchVO searchVO : searchVOList) {
String sql = "";
if (StringUtils.isNotBlank(searchVO.getValue())) {
if(searchVO.getValue().contains(",")){
sql += searchVO.getConnect()+"(";
if (searchVO.getValue().contains(",")) {
sql += searchVO.getConnect() + "(";
List<String> list = Arrays.asList(searchVO.getValue().split(","));
for(int i =0;i<list.size();i++){
if(i==list.size()-1){
sql += searchVO.getField() +" "+searchVO.getType() + " " + "concat(concat('%','"+ list.get(i) +"'),'%') ";
}else{
sql += searchVO.getField() +" "+searchVO.getType() + " " + "concat(concat('%','"+ list.get(i) +"'),'%') and ";
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
sql += searchVO.getField() + " " + searchVO.getType() + " " + "concat(concat('%','" + list.get(i) + "'),'%') ";
} else {
sql += searchVO.getField() + " " + searchVO.getType() + " " + "concat(concat('%','" + list.get(i) + "'),'%') and ";
}
}
sql += " )";
}else{
} else {
sql += searchVO.getConnect() + " " + searchVO.getField() + " ";
if (!"like".equals(searchVO.getType())) {
sql += searchVO.getType() + "'" + searchVO.getValue() + "'";
} else {
sql += searchVO.getType() + " " + "concat(concat('%','"+ searchVO.getValue() +"'),'%')";
sql += searchVO.getType() + " " + "concat(concat('%','" + searchVO.getValue() + "'),'%')";
}
}
sqlBuilder.append(sql);
} else if (StringUtils.isNotBlank(searchVO.getTimeSt()) || StringUtils.isNotBlank(searchVO.getTimeEd())) {
sql += searchVO.getConnect() + " ";
if (StringUtils.isNotBlank(searchVO.getTimeSt()) && StringUtils.isBlank(searchVO.getTimeEd())) {
sql += "("+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") + " between " + "'" + searchVO.getTimeSt() + "' and '2099-12-31'";
sql += " or "+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") + " between " + "'" + searchVO.getTimeSt() +" 00:00:00"+ "' and '2099-12-31 23:59:59'";
sql += " or "+searchVO.getField();
sql += " = 'TBD'";
sql += "(" + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between " + "'" + searchVO.getTimeSt() + "' and '2099-12-31'";
sql += " or " + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between " + "'" + searchVO.getTimeSt() + " 00:00:00" + "' and '2099-12-31 23:59:59'";
sql += " or " + searchVO.getField();
sql += " = 'TBD'";
sql += ")";
} else if (StringUtils.isBlank(searchVO.getTimeSt()) && StringUtils.isNotBlank(searchVO.getTimeEd())) {
sql += "("+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") +" between '1970-01-01' and " + "'" + searchVO.getTimeEd() + "'";
sql += " or "+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") +" between '1970-01-01 00:00:00' and " +
sql += "(" + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between '1970-01-01' and " + "'" + searchVO.getTimeEd() + "'";
sql += " or " + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between '1970-01-01 00:00:00' and " +
"'" + searchVO.getTimeEd() + " 23:59:59'";
sql += " or "+searchVO.getField();
sql += " = 'TBD'";
sql += " or " + searchVO.getField();
sql += " = 'TBD'";
sql += ")";
} else if (StringUtils.isNotBlank(searchVO.getTimeSt()) && StringUtils.isNotBlank(searchVO.getTimeEd())) {
sql += "("+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") + " between '" + searchVO.getTimeSt() + "' and '"
sql += "(" + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between '" + searchVO.getTimeSt() + "' and '"
+ searchVO.getTimeEd() + "'";
sql += " or "+searchVO.getField();
sql += (searchVO.getType().equals("!=")?" not ":"") + " between '" + searchVO.getTimeSt() +" 00:00:00"+ "' and '"
sql += " or " + searchVO.getField();
sql += (searchVO.getType().equals("!=") ? " not " : "") + " between '" + searchVO.getTimeSt() + " 00:00:00" + "' and '"
+ searchVO.getTimeEd() + " 23:59:59'";
sql += " or "+searchVO.getField();
sql += " = 'TBD'";
sql += " or " + searchVO.getField();
sql += " = 'TBD'";
sql += ")";
}
sqlBuilder.append(sql);
@@ -78,4 +78,33 @@ public class SarAdvanceSearchUtil {
}
return sqlInfo;
}
/**
* 国内外标准高级查询 对SAR_STAND_ATTR_INFO表自定义字段生成条件语句
* @param searchVOList
* @return
*/
public static String createStandSql(List<SarAdvanceSearchVO> searchVOList) {
String sqlInfo = "";
String tableName="SAR_STAND_ATTR_INFO.";
StringBuilder sqlBuilder = new StringBuilder();
if (searchVOList != null && !searchVOList.isEmpty()) {
for (int i = 0; i < searchVOList.size(); i++) {
String sql = "";
SarAdvanceSearchVO searchVO=searchVOList.get(i);
if (StringUtils.isNotBlank(searchVO.getValue()));
if (i==0){
sql+=tableName+searchVO.getField()+" " + searchVO.getType() + " " + "concat(concat('%','" +searchVO.getValue() + "'),'%') ";
}else {
sql+="AND"+" "+tableName+searchVO.getField()+" " + searchVO.getType() + " " + "concat(concat('%','" +searchVO.getValue() + "'),'%') ";
}
sqlBuilder.append(sql);
}
sqlInfo = sqlBuilder.toString();
}
return sqlInfo;
}
}
@@ -429,6 +429,9 @@
<if test="replacedStandNum != null and replacedStandNum != ''">
and replaced_stand_num like concat(concat('%',#{replacedStandNum}),'%')
</if>
<if test="isRelateAccess != null and isRelateAccess != ''" >
and is_relate_access = #{isRelateAccess}
</if>
<!-- 目录判断 -->
<if test="menuId != null and menuId !='nomenu' and menuAllChildrenIdList != null">
and SAR_STAND_MENU.MENU_ID in
@@ -490,11 +493,28 @@
</if>
<if test="standSort != null and standSort != ''" >
and SAR_STANDARDS_INFO.stand_sort = #{standSort}
</if>
<!--标准年份-->
<if test="standYear != null and standYear != ''">
and SAR_STANDARDS_INFO.STAND_YEAR = #{standYear}
</if>
<if test="issueTime != null and issueTime != ''">
and SAR_STANDARDS_INFO.ISSUE_TIME = #{issueTime}
</if>
<!--内容摘要-->
<if test="synopsis != null and synopsis != ''" >
AND dbms_lob.instr(SYNOPSIS, #{synopsis} ,1,1) > 0
</if>
<!--文本状态-->
<if test="textStatus != null and textStatus != ''" >
and SAR_STANDARDS_INFO.TEXT_STATUS = #{textStatus}
</if>
<!--是否纳入法规清单-->
<if test="isRelateAccess != null and isRelateAccess != ''" >
and SAR_STANDARDS_INFO.IS_RELATE_ACCESS = #{isRelateAccess}
</if>
<if test="collectMenuId != null and collectMenuId != ''">
and SAR_STANDARDS_INFO.id in (
select COLLECT_RES_ID from TS_PERSON_COLLECT where TS_PERSON_COLLECT.VALID_FLAG=0
@@ -502,18 +522,18 @@
and TS_PERSON_COLLECT.user_id=#{userId}
)
</if>
<if test='labelMenuId != null and labelMenuId == "gxhbq"'>
and SAR_STAND_ATTR_INFO.GXHBQ is not null
</if>
<if test='labelMenuId != null and labelMenuId != "gxhbq"'>
and SAR_STAND_ATTR_INFO.GXHBQ like concat(concat('%',#{labelMenuId}),'%')
</if>
<!--适用车型-->
<if test="applyArctic != null and applyArctic != ''">
and SAR_STAND_ATTR_INFO.SYCLLX = #{applyArctic}
</if>
<if test="isRelateAccess != null and isRelateAccess != ''" >
and is_relate_access = #{isRelateAccess}
and SAR_STAND_ATTR_INFO.CLLX = #{applyArctic}
</if>
<if test="advanceSearchStr != null and advanceSearchStr != ''">
and (${advanceSearchStr})
</if>