and condition for like
This commit is contained in:
@@ -315,6 +315,45 @@ public class Condition implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder leftLike(String key, Object value) {
|
||||
if (value.toString().contains("\"")) {
|
||||
value = value.toString().replaceAll("\"", "");
|
||||
}
|
||||
String sqlKey = "item_" + IdUtil.fastUUID();
|
||||
this.conditionSql += " " + key + " " + LIKE + " CONCAT('%',#{" + sqlKey + "})";
|
||||
this.paramMap.put(sqlKey, formatValue(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder rightLike(String key, Object value) {
|
||||
if (value.toString().contains("\"")) {
|
||||
value = value.toString().replaceAll("\"", "");
|
||||
}
|
||||
String sqlKey = "item_" + IdUtil.fastUUID();
|
||||
this.conditionSql += " " + key + " " + LIKE + " CONCAT(#{" + sqlKey + "},'%')";
|
||||
this.paramMap.put(sqlKey, formatValue(key, value));
|
||||
return this;
|
||||
}
|
||||
public ConditionBuilder andLeftLike(String key, Object value) {
|
||||
this.and().leftLike(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder andRightLike(String key, Object value) {
|
||||
this.and().rightLike(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder orLeftLike(String key, Object value) {
|
||||
this.or().leftLike(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder orRightLike(String key, Object value) {
|
||||
this.or().rightLike(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConditionBuilder like(String key, Object value) {
|
||||
if (value.toString().contains("\"")) {
|
||||
value = value.toString().replaceAll("\"", "");
|
||||
|
||||
@@ -214,6 +214,7 @@ public class TableServiceImpl implements TableService {
|
||||
public ResultVO<Integer> logicDelete(OsSysTable tableName, String ids) {
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put(FieldConstants.DELETED.toString(), 0);
|
||||
map.put(FieldConstants.UPDATE_TIME.toString(), new Date());
|
||||
DataMap dataMap = DataMap.builder().sysOsTable(tableName).ids(ids).data(map).build();
|
||||
Condition condition = Condition.creatCriteria().andIn(dataMap.getPkName(), dataMap.getIdList()).build();
|
||||
int i = baseMapper.updateByCondition(dataMap, condition);
|
||||
|
||||
@@ -240,5 +240,15 @@
|
||||
<name>Snapshot</name>
|
||||
<url>http://192.168.0.123:8081/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<!-- <repository>-->
|
||||
<!-- <id>releases-hc</id>-->
|
||||
<!-- <name>Releases</name>-->
|
||||
<!-- <url>https://qs.taixingyiji.com:8082/repository/maven-releases/</url>-->
|
||||
<!-- </repository>-->
|
||||
<!-- <snapshotRepository>-->
|
||||
<!-- <id>snapshots-hc</id>-->
|
||||
<!-- <name>Snapshot</name>-->
|
||||
<!-- <url>https://qs.taixingyiji.com:8082/repository/maven-snapshots/</url>-->
|
||||
<!-- </snapshotRepository>-->
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user