去除字符串前面的空格

This commit is contained in:
2024-08-28 22:20:02 +08:00
parent c39f17103e
commit addaabd25a
2 changed files with 12 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package com.gxwebsoft.common.system.controller; package com.gxwebsoft.common.system.controller;
import cn.hutool.core.util.StrUtil;
import com.gxwebsoft.common.core.annotation.OperationLog; import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.web.*; import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;
@@ -69,6 +70,11 @@ public class MenuController extends BaseController {
if (menu.getParentId() == null) { if (menu.getParentId() == null) {
menu.setParentId(0); menu.setParentId(0);
} }
// 去除字符串前面的空格
menu.setTitle(StrUtil.trimStart(menu.getTitle()));
menu.setPath(StrUtil.trimStart(menu.getPath()));
menu.setComponent(StrUtil.trimStart(menu.getComponent()));
menu.setAuthority(StrUtil.trimStart(menu.getAuthority()));
if (menuService.save(menu)) { if (menuService.save(menu)) {
return success("添加成功"); return success("添加成功");
} }

View File

@@ -37,15 +37,18 @@
<if test="param.deleted == null"> <if test="param.deleted == null">
AND a.deleted = 0 AND a.deleted = 0
</if> </if>
<if test="param.tenantId == null">
AND a.tenant_id = #{param.tenantId}
</if>
<if test="param.createTimeStart != null"> <if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart} AND a.create_time &gt;= #{param.createTimeStart}
</if> </if>
<if test="param.createTimeEnd != null"> <if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd} AND a.create_time &lt;= #{param.createTimeEnd}
</if> </if>
<if test="param.keywords != null">
AND (
a.name = #{param.keywords}
OR a.comments = #{param.keywords}
)
</if>
</where> </where>
</sql> </sql>