给角色查询增加备注的查询条件
This commit is contained in:
@@ -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[]);
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user