Просмотр исходного кода

客户查询管理员无需精确

Signed-off-by: anderx <312518615@qq.com>
anderx лет назад: 5
Родитель
Сommit
815579f5c1

+ 10 - 0
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -342,7 +342,12 @@
 		left join district_glossory dg3 on b.location_area = dg3.id
 		left join admin d on a.aid = d.id 
 		where a.type = 1 and a.status != 1
+	<if test="role == 0">
 		and a.identify_name = #{name}
+	</if>
+	<if test="role == 1">
+		and a.identify_name like concat('%', #{name},'%')
+	</if>	
 		<if test="aid != null and aid !=''">
 			and a.aid = #{aid,jdbcType=VARCHAR}
 		</if>
@@ -379,7 +384,12 @@
 		where department_id=#{departmentId,jdbcType=VARCHAR}) d on a.aid = d.id
 		</if>
 		where a.type = 1 and a.status != 1
+		<if test="role == 0">
 		and a.identify_name = #{name}
+	</if>
+	<if test="role == 1">
+		and a.identify_name like concat('%', #{name},'%')
+	</if>
 		<if test="aid != null and aid !=''">
 			and a.aid = #{aid,jdbcType=VARCHAR}
 		</if>

+ 7 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.alibaba.druid.sql.ast.statement.SQLIfStatement.Else;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
@@ -192,6 +193,12 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	public Pagination<CustomerListOut> listAllOrganizationCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_ORGANIZATION);
 		Map<String,Object> params = disposeParams(cli);
+		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+			params.put("role", 1);
+		}else {
+			params.put("role", 0);
+		}
+		
 		Pagination<CustomerListOut> p=(Pagination<CustomerListOut>) findPage("selectOrganizationCustomerList","selectOrganizationCustomerCount",params,pageNo,pageSize);
 		List<CustomerListOut> l=(List<CustomerListOut>) p.getList();
 		for (CustomerListOut c : l) {