给角色查询增加备注的查询条件

This commit is contained in:
季圣华
2023-03-06 23:12:48 +08:00
parent f4905dbe0e
commit 7b0a69ef79
4 changed files with 19 additions and 7 deletions

View File

@@ -12,11 +12,13 @@ public interface RoleMapperEx {
List<RoleEx> selectByConditionRole( List<RoleEx> selectByConditionRole(
@Param("name") String name, @Param("name") String name,
@Param("description") String description,
@Param("offset") Integer offset, @Param("offset") Integer offset,
@Param("rows") Integer rows); @Param("rows") Integer rows);
Long countsByRole( Long countsByRole(
@Param("name") String name); @Param("name") String name,
@Param("description") String description);
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);

View File

@@ -32,14 +32,16 @@ public class RoleComponent implements ICommonQuery {
private List<?> getRoleList(Map<String, String> map) throws Exception{ private List<?> getRoleList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
return roleService.select(name, QueryUtils.offset(map), QueryUtils.rows(map)); String description = StringUtil.getInfo(search, "description");
return roleService.select(name, description, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@Override @Override
public Long counts(Map<String, String> map) throws Exception{ public Long counts(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
return roleService.countRole(name); String description = StringUtil.getInfo(search, "description");
return roleService.countRole(name, description);
} }
@Override @Override

View File

@@ -75,10 +75,10 @@ public class RoleService {
return list; return list;
} }
public List<RoleEx> select(String name, int offset, int rows)throws Exception { public List<RoleEx> select(String name, String description, int offset, int rows)throws Exception {
List<RoleEx> list=null; List<RoleEx> list=null;
try{ try{
list=roleMapperEx.selectByConditionRole(name, offset, rows); list=roleMapperEx.selectByConditionRole(name, description, offset, rows);
for(RoleEx roleEx: list) { for(RoleEx roleEx: list) {
String priceLimit = roleEx.getPriceLimit(); String priceLimit = roleEx.getPriceLimit();
if(StringUtil.isNotEmpty(priceLimit)) { if(StringUtil.isNotEmpty(priceLimit)) {
@@ -94,10 +94,10 @@ public class RoleService {
return list; return list;
} }
public Long countRole(String name)throws Exception { public Long countRole(String name, String description)throws Exception {
Long result=null; Long result=null;
try{ try{
result=roleMapperEx.countsByRole(name); result=roleMapperEx.countsByRole(name, description);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }

View File

@@ -12,6 +12,10 @@
<bind name="bindName" value="'%'+name+'%'"/> <bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName} and name like #{bindName}
</if> </if>
<if test="description != null">
<bind name="bindDescription" value="'%'+description+'%'"/>
and description like #{bindDescription}
</if>
order by sort asc, id desc order by sort asc, id desc
<if test="offset != null and rows != null"> <if test="offset != null and rows != null">
limit #{offset},#{rows} limit #{offset},#{rows}
@@ -27,6 +31,10 @@
<bind name="bindName" value="'%'+name+'%'"/> <bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName} and name like #{bindName}
</if> </if>
<if test="description != null">
<bind name="bindDescription" value="'%'+description+'%'"/>
and description like #{bindDescription}
</if>
</select> </select>
<update id="batchDeleteRoleByIds"> <update id="batchDeleteRoleByIds">
update jsh_role update jsh_role