给角色查询增加备注的查询条件
This commit is contained in:
@@ -12,11 +12,13 @@ public interface RoleMapperEx {
|
||||
|
||||
List<RoleEx> selectByConditionRole(
|
||||
@Param("name") String name,
|
||||
@Param("description") String description,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
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[]);
|
||||
|
||||
|
||||
@@ -32,14 +32,16 @@ public class RoleComponent implements ICommonQuery {
|
||||
private List<?> getRoleList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
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
|
||||
public Long counts(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
return roleService.countRole(name);
|
||||
String description = StringUtil.getInfo(search, "description");
|
||||
return roleService.countRole(name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,10 +75,10 @@ public class RoleService {
|
||||
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;
|
||||
try{
|
||||
list=roleMapperEx.selectByConditionRole(name, offset, rows);
|
||||
list=roleMapperEx.selectByConditionRole(name, description, offset, rows);
|
||||
for(RoleEx roleEx: list) {
|
||||
String priceLimit = roleEx.getPriceLimit();
|
||||
if(StringUtil.isNotEmpty(priceLimit)) {
|
||||
@@ -94,10 +94,10 @@ public class RoleService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countRole(String name)throws Exception {
|
||||
public Long countRole(String name, String description)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=roleMapperEx.countsByRole(name);
|
||||
result=roleMapperEx.countsByRole(name, description);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and name like #{bindName}
|
||||
</if>
|
||||
<if test="description != null">
|
||||
<bind name="bindDescription" value="'%'+description+'%'"/>
|
||||
and description like #{bindDescription}
|
||||
</if>
|
||||
order by sort asc, id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
@@ -27,6 +31,10 @@
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and name like #{bindName}
|
||||
</if>
|
||||
<if test="description != null">
|
||||
<bind name="bindDescription" value="'%'+description+'%'"/>
|
||||
and description like #{bindDescription}
|
||||
</if>
|
||||
</select>
|
||||
<update id="batchDeleteRoleByIds">
|
||||
update jsh_role
|
||||
|
||||
Reference in New Issue
Block a user