| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | |
| | | String retStr = "-1"; |
| | | switch (key) { |
| | | case "EQUAL": //等于 |
| | | retStr = " is null OR = '' "; |
| | | retStr = " is null"; |
| | | break; |
| | | case "UNEQUAL": //不等于 |
| | | retStr = " is not null "; |
| | |
| | | } else if (rc.getRelation().equals("OR")) { |
| | | relation = " OR "; |
| | | } else { |
| | | relation = " WHERE "; |
| | | relation = " WHERE ("; |
| | | } |
| | | |
| | | sqlStr += relation + getPropSqlStr(rc.getBasic()); |
| | |
| | | if (rc.getProp().equals("NULLVAL")) { // 空值 |
| | | sqlStr += getConditionSqlStrByNullVal(rc.getCondition()); |
| | | } else if (rc.getProp().equals("TARGET")) { // 指标 |
| | | sqlStr += getConditionSqlStrByTarget(rc.getCondition(), getPropSqlStr(rc.getTarget()), rc.getValue()); |
| | | sqlStr += ObjectUtil.isNotEmpty(rc.getFixValue())? |
| | | getConditionSqlStrByTarget(rc.getCondition(), getPropSqlStr(rc.getTarget()), rc.getValue())+"-"+rc.getFixValue() : |
| | | getConditionSqlStrByTarget(rc.getCondition(), getPropSqlStr(rc.getTarget()), rc.getValue()); |
| | | } else { |
| | | sqlStr += getConditionSqlStrByVal(rc.getCondition(), rc.getValue()); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | sqlStr += ")"; |
| | | |
| | | varStr = "concat(" + varStr +") AS val"; |
| | | |
| | | if (StringUtil.isNotBlank(rules.getIsGate())) { |
| | | sqlStr += " and a.\"is_gate\" = " + rules.getIsGate(); |
| | | |
| | | String gateStr = rules.getIsGate().equals("1") ?"'有闸控制'":"'无闸控制'"; |
| | | |
| | | sqlStr += " and a.\"is_gate\" = " + gateStr; |
| | | } |
| | | |
| | | // 拼接条件有问题,不操作 |
| | |
| | | log.info("查询条件错误,请检查规则设置......:", sqlStr); |
| | | return R.fail(-1, sqlStr + "\\n 查询条件错误,请检查规则设置"); |
| | | } |
| | | |
| | | |
| | | Integer ret = 0; |
| | | try { |
| | |
| | | log.info("执行完成......:"); |
| | | } |
| | | |
| | | // 执行sql |
| | | // 执行sql |
| | | return R.data(ret); |
| | | } |
| | | } |