Michael пре 8 година
родитељ
комит
18f263aac4

+ 89 - 1
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -788,6 +788,94 @@
 	</if>		
   </select>
   
+  <select id="selectBusinessManageList" resultType="com.goafanti.customer.bo.BusinessListBo">
+	  select
+		c.name as businessName,
+		b.identify_name as identifyName,
+		a.id as businessId,
+		a.create_time as createTime,
+		a.update_time as updateTime,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		d.name as adminName
+	from
+		user_business a inner join user b on
+		a.uid = b.id left join business_glossory c on
+		a.business_glossory_id = c.id left join admin d on
+		a.aid = d.id
+		LEFT JOIN department_management dm on dm.id = d.department_id 	
+	where 1 = 1
+	<if test="aid != null and aid != ''">
+		and (b.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
+	</if>
+	<if test="uid != null and uid !=''">
+		and a.uid = #{uid,jdbcType=VARCHAR}
+	</if>
+	<if test="businessGlossoryId !=null and businessGlossoryId != ''">
+		and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
+	</if>
+	<if test="identifyName != null and identifyName != ''">
+		and b.identify_name like concat('%', #{identifyName},'%')
+	</if>
+	<if test="followSituation != null">
+		and a.follow_situation = #{followSituation,jdbcType=INTEGER}
+	</if>
+	<if test="customerStatus != null">
+		and a.customer_status = #{customerStatus,jdbcType=INTEGER}
+	</if>
+	<if test="adminName != null and adminName != ''">
+		and d.name = #{adminName,jdbcType=VARCHAR}
+	</if>
+	<if test="startDate != null and startDate != ''">
+		and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
+	</if>
+	<if test="endDate != null and endDate != ''">
+		and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
+	</if>
+	<if test="page_sql != null">
+    	${page_sql}
+    </if>
+  </select>
+  
+  <select id="selectBusinessManageCount" parameterType="com.goafanti.customer.bo.BusinessListBo" resultType="java.lang.Integer">
+  	select
+  		count(0)
+  	from
+		user_business a inner join user b on
+		a.uid = b.id left join business_glossory c on
+		a.business_glossory_id = c.id left join admin d on
+		a.aid = d.id
+		LEFT JOIN department_management dm on dm.id = d.department_id 	
+	where 1 = 1
+	<if test="aid != null and aid != ''">
+		and (b.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
+	</if>
+	<if test="uid != null and uid !=''">
+		and a.uid = #{uid,jdbcType=VARCHAR}
+	</if>
+	<if test="businessGlossoryId !=null and businessGlossoryId != ''">
+		and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
+	</if>
+	<if test="identifyName != null and identifyName != ''">
+		and b.identify_name like concat('%', #{identifyName},'%')
+	</if>
+	<if test="followSituation != null">
+		and a.follow_situation = #{followSituation,jdbcType=INTEGER}
+	</if>
+	<if test="customerStatus != null">
+		and a.customer_status = #{customerStatus,jdbcType=INTEGER}
+	</if>
+	<if test="adminName != null and adminName != ''">
+		and d.name = #{adminName,jdbcType=VARCHAR}
+	</if>
+	<if test="startDate != null and startDate != ''">
+		and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
+	</if>
+	<if test="endDate != null and endDate != ''">
+		and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
+	</if>		
+  </select>
+  
   <select id="selectManagePersonalCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
 		select
 			a.id as uid,
@@ -827,7 +915,7 @@
 			and a.identify_name like concat('%',#{name},'%')
 		</if>
 		<if test="shareType != null">
-			and a.share_type = #{shareType,jdbcType=VARCHAR}
+			and a.share_type = #{shareType,jdbcType=INTEGER}
 		</if>
 		<if test="status != null">
 			and a.status = #{status,jdbcType=INTEGER}

+ 8 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -641,6 +641,14 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 	
+	/** 业务管理列表 **/
+	@RequestMapping(value = "/listManageBusiness", method = RequestMethod.POST)
+	public Result listManageBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		res.setData(customerService.listManageBusiness(blo, pageNo, pageSize));
+		return res;
+	}
+	
 	/** 查询业务字典 **/
 	@RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
 	public Result findBusinessGlossory(){

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

@@ -289,6 +289,13 @@ public interface CustomerService {
 	Pagination<BusinessListBo> listAllBusiness(BusinessListBo blo, Integer pageNo, Integer pageSize);
 	
 	/**
+	 * 业务管理列表
+	 * @param blo
+	 * @return
+	 */
+	Pagination<BusinessListBo> listManageBusiness(BusinessListBo blo,Integer pageNo,Integer pageSize);
+	
+	/**
 	 *  意向字典
 	 * @return
 	 */

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

@@ -118,6 +118,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	public Pagination<CustomerListOut> listAllManagePersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_PERSONAL);
+		cli.setShareType(String.valueOf(AFTConstants.USER_SHARE_PRIVATE));
 		Map<String,Object> params = disposeParams(cli);
 		@SuppressWarnings("unchecked")
 		Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage("selectManagePersonalCustomerList","selectManagePersonalCustomerCount",params,pageNo,pageSize);
@@ -158,6 +159,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	public Pagination<CustomerListOut> listAllManageOrganizationCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_ORGANIZATION);
+		cli.setShareType(String.valueOf(AFTConstants.USER_SHARE_PRIVATE));
 		Map<String,Object> params = disposeParams(cli);
 		@SuppressWarnings("unchecked")
 		Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage("selectManageOrganizationCustomerList","selectManageOrganizationCustomerCount",params,pageNo,pageSize);
@@ -758,6 +760,13 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		return (Pagination<BusinessListBo>) findPage("selectBusinessList", "selectBusinessCount", disposeParams(blo), pageNo, pageSize);
 	}
 	
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<BusinessListBo> listManageBusiness(BusinessListBo blo,Integer pageNo,Integer pageSize) {
+		blo.setAid(TokenManager.getAdminId());
+		return (Pagination<BusinessListBo>) findPage("selectBusinessManageList", "selectBusinessManageCount", disposeParams(blo), pageNo, pageSize);
+	}
+	
 	private Map<String,Object> disposeParams(BusinessListBo blo){
 		Map<String, Object> params = new HashMap<String, Object>();
 		if(StringUtils.isNotBlank(blo.getUid())) params.put("uid", blo.getUid());