Commit 16668fc0 authored by zhengyi's avatar zhengyi

客户详情获取重构

parent a2a108af
...@@ -63,49 +63,8 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> { ...@@ -63,49 +63,8 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
List<CustomerDO> searchCustomer(@Param("reqVO") CustomerSelectReqVO customerSelectReqVO); List<CustomerDO> searchCustomer(@Param("reqVO") CustomerSelectReqVO customerSelectReqVO);
@ResultType(CustomerDetailRespVO.class)
@Select({
"<script>",
"select c.*, ",
"cl.name_zh as vip_level_name_zh, cl.name_en as vip_level_name_en, ",
"",
"cc.name_zh as credit_level_name_zh, cc.name_en as credit_level_name_en,",
"",
"country.name_zh as country_name_zh, country.name_en as country_name_en,",
"",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_product_type pt WHERE FIND_IN_SET(pt.id,(SELECT product_types FROM ecw_customer WHERE id=c.id))) AS product_type_name_zh, ",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_product_type pt WHERE FIND_IN_SET(pt.id,(SELECT product_types FROM ecw_customer WHERE id=c.id))) AS product_type_name_en, ",
"",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_zh, ",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_en, ",
"",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_zh,",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_en,",
"",
"(SELECT GROUP_CONCAT(name_zh) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_zh,",
"(SELECT GROUP_CONCAT(name_en) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_en,",
"",
"(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor ccp WHERE FIND_IN_SET(ccp.id,(SELECT competitor_ids FROM ecw_customer WHERE id=c.id))) AS competitor_names,",
"",
"uc.nickname as creator_name,",
"uu.nickname as updater_name,",
"",
"c.customer_service,",
"u.nickname as customer_service_name",
"",
"from ecw_customer c",
"left join ecw_customer_level cl on c.level = cl.id",
"left join ecw_customer_credit cc on c.credit_level = cc.id",
"left join ecw_country country on c.country = country.id",
"left join system_user u on c.customer_service = u.id",
"left join system_user uc on c.creator = uc.id",
"left join system_user uu on c.updater = uu.id",
"where c.id = #{id}",
"</script>"
})
CustomerDetailRespVO getCustomerDetailRespVO(@Param("id") Long id); CustomerDetailRespVO getCustomerDetailRespVO(@Param("id") Long id);
List<CustomerDO> getMyCustomerList(@Param("loginUserId") Long loginUserId); List<CustomerDO> getMyCustomerList(@Param("loginUserId") Long loginUserId);
......
...@@ -1098,7 +1098,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1098,7 +1098,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
@Override @Override
public CustomerDetailRespVO getCustomerDetailRespVO(Long id) { public CustomerDetailRespVO getCustomerDetailRespVO(Long id) {
return customerMapper.getCustomerDetailRespVO(id); CustomerDetailRespVO respVO = customerMapper.getCustomerDetailRespVO(id);
return respVO;
} }
@Override @Override
......
package cn.iocoder.yudao.module.customer.vo.customer.vo; package cn.iocoder.yudao.module.customer.vo.customer.vo;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO; import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO;
import cn.iocoder.yudao.module.product.vo.product.ProductRespVO;
import cn.iocoder.yudao.module.product.vo.product.ProductTypeRespVO;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -306,8 +308,11 @@ public class CustomerDetailRespVO extends CustomerBaseVO { ...@@ -306,8 +308,11 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "竞争对手名称") @ApiModelProperty(value = "竞争对手名称")
private String competitorNames; private String competitorNames;
@ApiModelProperty(value = "选中的主营产品")
private List<ProductRespVO> productList;
@ApiModelProperty(value = "选中的主营产品类型")
private List<ProductTypeRespVO> productTypeList;
@ApiModelProperty(value = "付款人姓名") @ApiModelProperty(value = "付款人姓名")
private String payerName; private String payerName;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper"> <mapper namespace="cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper">
<resultMap id="orderAndOrderItemMap" type="cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerDetailRespVO" >
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="number" jdbcType="VARCHAR" property="number"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="INTEGER" property="level"/>
<result column="credit_level" jdbcType="INTEGER" property="creditLevel"/>
<result column="country" jdbcType="BIGINT" property="country"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="transport_type" jdbcType="VARCHAR" property="transportType"/>
<result column="resource_type" jdbcType="INTEGER" property="resourceType"/>
<result column="agent_id" jdbcType="BIGINT" property="agentId"/>
<result column="company" jdbcType="VARCHAR" property="company"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="product_types" jdbcType="VARCHAR" property="productTypes"/>
<result column="product_ids" jdbcType="VARCHAR" property="productIds"/>
<result column="pickup_points" jdbcType="VARCHAR" property="pickupPoints"/>
<result column="member_id" jdbcType="BIGINT" property="memberId"/>
<result column="birthday" jdbcType="DATE" property="birthday"/>
<result column="balance" jdbcType="INTEGER" property="balance"/>
<result column="source" jdbcType="INTEGER" property="source"/>
<result column="picture" jdbcType="VARCHAR" property="picture"/>
<result column="customer_service" jdbcType="BIGINT" property="customerService"/>
<result column="promoter" jdbcType="BIGINT" property="promoter"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="status_update_time" jdbcType="DATE" property="statusUpdateTime"/>
<result column="is_customer_service_confirmed" jdbcType="INTEGER" property="isCustomerServiceConfirmed"/>
<result column="founder" jdbcType="BIGINT" property="founder"/>
<result column="department" jdbcType="VARCHAR" property="department"/>
<result column="invoice_title" jdbcType="VARCHAR" property="invoiceTitle"/>
<result column="license_number" jdbcType="VARCHAR" property="licenseNumber"/>
<result column="bank" jdbcType="VARCHAR" property="bank"/>
<result column="bank_number" jdbcType="VARCHAR" property="bankNumber"/>
<result column="project" jdbcType="VARCHAR" property="project"/>
<result column="billing_address" jdbcType="VARCHAR" property="billingAddress"/>
<result column="billing_tell" jdbcType="VARCHAR" property="billingTell"/>
<result column="tax_rate" jdbcType="DECIMAL" property="taxRate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="arrival_confirm" jdbcType="INTEGER" property="arrivalConfirm"/>
<result column="weight_unit" jdbcType="DECIMAL" property="weightUnit"/>
<result column="light_unit" jdbcType="DECIMAL" property="lightUnit"/>
<result column="enquiry_info" jdbcType="VARCHAR" property="enquiryInfo"/>
<result column="is_in_open_sea" jdbcType="INTEGER" property="isInOpenSea"/>
<result column="enter_open_sea_time" jdbcType="DATE" property="enterOpenSeaTime"/>
<result column="estimate_enter_open_sea_time" jdbcType="DATE" property="estimateEnterOpenSeaTime"/>
<result column="catch_time" jdbcType="DATE" property="catchTime"/>
<result column="is_show_tidan_price" jdbcType="INTEGER" property="isShowTidanPrice"/>
<result column="vip_level_score" jdbcType="BIGINT" property="vipLevelScore"/>
<result column="credit_level_score" jdbcType="BIGINT" property="creditLevelScore"/>
<result column="create_time" jdbcType="DATE" property="createTime"/>
<result column="update_time" jdbcType="DATE" property="updateTime"/>
<result column="car_name" jdbcType="VARCHAR" property="carName"/>
<result column="car_no" jdbcType="VARCHAR" property="carNo"/>
<result column="is_web_order_consignee_sync" jdbcType="INTEGER" property="isWebOrderConsigneeSync"/>
<result column="consignee_first_customer_service" jdbcType="BIGINT" property="consigneeFirstCustomerService"/>
<result column="is_new" jdbcType="INTEGER" property="isNew"/>
<result column="name_en" jdbcType="VARCHAR" property="nameEn"/>
<result column="company_en" jdbcType="VARCHAR" property="companyEn"/>
<result column="payer_name" jdbcType="VARCHAR" property="payerName"/>
<result column="inquiry" jdbcType="VARCHAR" property="inquiry"/>
<result column="is_potential" jdbcType="INTEGER" property="isPotential"/>
<result column="default_pay" jdbcType="BIT" property="defaultPay"/>
<result column="no_consignee" jdbcType="BIT" property="noConsignee"/>
<result column="first_deal_time" jdbcType="DATE" property="firstDealTime"/>
<result column="get_method" jdbcType="INTEGER" property="getMethod"/>
<result column="create_from" jdbcType="INTEGER" property="createFrom"/>
<result column="customer_service_confirmed_time" jdbcType="DATE" property="customerServiceConfirmedTime"/>
<result column="busi_country_ids" jdbcType="VARCHAR" property="busiCountryIds"/>
<result column="roles" jdbcType="VARCHAR" property="roles"/>
<result column="competitor_ids" jdbcType="VARCHAR" property="competitorIds"/>
<result column="weight_yearly" jdbcType="DECIMAL" property="weightYearly"/>
<result column="num_yearly" jdbcType="INTEGER" property="numYearly"/>
<result column="default_billing" jdbcType="BIT" property="defaultBilling"/>
<result column="credit_level_name_zh" jdbcType="VARCHAR" property="creditLevelNameZh"/>
<result column="credit_level_name_en" jdbcType="VARCHAR" property="creditLevelNameEn"/>
<result column="pickup_point_name_zh" jdbcType="VARCHAR" property="pickupPointNameZh"/>
<result column="pickup_point_name_en" jdbcType="VARCHAR" property="pickupPointNameEn"/>
<result column="vip_level_name_zh" jdbcType="VARCHAR" property="vipLevelNameZh"/>
<result column="vip_level_name_en" jdbcType="VARCHAR" property="vipLevelNameEn"/>
<result column="busi_country_name_zh" jdbcType="VARCHAR" property="busiCountryNameZh"/>
<result column="busi_country_name_en" jdbcType="VARCHAR" property="busiCountryNameEn"/>
<result column="competitor_names" jdbcType="VARCHAR" property="competitorNames"/>
<result column="creator_name" jdbcType="VARCHAR" property="creatorName"/>
<result column="updater_name" jdbcType="VARCHAR" property="updaterName"/>
<result column="customer_service_name" jdbcType="VARCHAR" property="customerServiceName"/>
<collection property="productList" ofType="cn.iocoder.yudao.module.product.vo.product.ProductRespVO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="type_id" jdbcType="BIGINT" property="typeId"/>
<result column="attr_id" jdbcType="VARCHAR" property="attrId"/>
<result column="title_zh" jdbcType="VARCHAR" property="titleZh"/>
<result column="title_en" jdbcType="VARCHAR" property="titleEn"/>
<result column="material_type" jdbcType="VARCHAR" property="materialType"/>
<result column="packaging" jdbcType="VARCHAR" property="packaging"/>
</collection>
<collection property="productTypeList" ofType="cn.iocoder.yudao.module.product.vo.product.ProductTypeRespVO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="title_zh" jdbcType="VARCHAR" property="titleZh"/>
<result column="title_en" jdbcType="VARCHAR" property="titleEn"/>
</collection>
</resultMap>
<sql id="queryTable"> <sql id="queryTable">
select contact.*, select contact.*,
level.name_zh as vip_level_name_zh, level.name_zh as vip_level_name_zh,
...@@ -33,6 +134,32 @@ ...@@ -33,6 +134,32 @@
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
</sql> </sql>
<select id="getCustomerDetailRespVO" resultMap="orderAndOrderItemMap">
select
c.*,
cl.name_zh as vip_level_name_zh, cl.name_en as vip_level_name_en,
cc.name_zh as credit_level_name_zh, cc.name_en as credit_level_name_en,
country.name_zh as country_name_zh, country.name_en as country_name_en,
(select p.* from ecw_product p where FIND_IN_SET(p.id, c.product_ids) as product_list,
(select pt.* from ecw_product_type pt where FIND_IN_SET(pt.id, c.product_types) as product_type_list,
(SELECT GROUP_CONCAT(title_zh) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_zh,
(SELECT GROUP_CONCAT(title_en) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_en,
(SELECT GROUP_CONCAT(name_zh) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_zh,
(SELECT GROUP_CONCAT(name_en) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_en,
(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor ccp WHERE FIND_IN_SET(ccp.id,(SELECT competitor_ids FROM ecw_customer WHERE id=c.id))) AS competitor_names,
uc.nickname as creator_name,
uu.nickname as updater_name,
u.nickname as customer_service_name
from ecw_customer c
left join ecw_customer_level cl on c.level = cl.id
left join ecw_customer_credit cc on c.credit_level = cc.id
left join ecw_country country on c.country = country.id
left join system_user u on c.customer_service = u.id
left join system_user uc on c.creator = uc.id
left join system_user uu on c.updater = uu.id
where c.id = #{id}
</select>
<select id="getPage" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> <select id="getPage" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
select * from ( select * from (
<include refid="queryTable"/> <include refid="queryTable"/>
......
package cn.iocoder.yudao.module.product.vo.product;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 商品类型 Base VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
public class ProductTypeBaseVO {
@ApiModelProperty(value = "中文标题", required = true)
@NotNull(message = "中文标题不能为空")
private String titleZh;
@ApiModelProperty(value = "英文标题", required = true)
@NotNull(message = "英文标题不能为空")
private String titleEn;
@ApiModelProperty(value = "排序", required = true)
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "是否展示 默认为展示")
private Integer status;
}
package cn.iocoder.yudao.module.product.vo.product;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
@ApiModel("管理后台 - 商品类型 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProductTypeRespVO extends ProductTypeBaseVO {
@ApiModelProperty(value = "", required = true)
private Long id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
private Long productNum;
public Long getProductNum() {
if(productNum == null) return 0L;
return productNum;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment