Browse Source

2024-11-07

master
qiezi 1 year ago
parent
commit
ddd79a993a
  1. 1
      src/main/java/com/spring/modules/customer/mapper/CustomerInformationMapper.java
  2. 3
      src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java
  3. 128
      src/main/resources/mapper/customer/CustomerInformationMapper.xml

1
src/main/java/com/spring/modules/customer/mapper/CustomerInformationMapper.java

@ -14,4 +14,5 @@ public interface CustomerInformationMapper extends BaseMapper<CustomerInformatio
IPage<CustomerInformationVo> customerInformationSearchForCheck(Page<CustomerInformationVo> customerInformationVoPage, @Param("query") CustomerInformationVo data);
String queryNextCustomerNo(String site);
}

3
src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java

@ -79,6 +79,9 @@ public class CustomerInformationServiceImpl extends ServiceImpl<CustomerInformat
String msg = String.valueOf(resultMap.get("resultMsg"));
throw new XJException(msg, Integer.parseInt(code));
}
// 获取下一位客户编码
String customerNo = baseMapper.queryNextCustomerNo(data.getSite());
data.setCustomerNo(customerNo);
// 新增客户信息
customerInformationMapper.insert(data);
}

128
src/main/resources/mapper/customer/CustomerInformationMapper.xml

@ -1,86 +1,98 @@
<?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">
<mapper namespace="com.spring.modules.customer.mapper.CustomerInformationMapper">
<!-- 客户信息列表 -->
<select id="customerInformationSearch" parameterType="com.spring.modules.customer.vo.CustomerInformationVo" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
SELECT
site,
customer_no,
customer_desc,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency',customer_currency,site) as customer_currency,
turnover_of_year,
potential_revenue_of_year,
dbo.plm_get_dictDataLabel('plm_customer_information_important_customer',important_customer,site) as important_customer,
customer_group_id1,
dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1,
customer_group_id2,
dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2,
customer_status,
case when customer_status = 'Y' then '启用'
when customer_status = 'N' then '停用'
else '' end as customerStatusDesc,
customer_type,
customer_description,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_industry',customer_industry,site) as customer_industry,
create_date,
create_by,
update_date,
update_by,
dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
dbo.plm_get_addressName(site, customer_no) as addressName
<select id="customerInformationSearch" parameterType="com.spring.modules.customer.vo.CustomerInformationVo"
resultType="com.spring.modules.customer.vo.CustomerInformationVo">
SELECT site,
customer_no,
customer_desc,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', customer_currency,
site) as customer_currency,
turnover_of_year,
potential_revenue_of_year,
dbo.plm_get_dictDataLabel('plm_customer_information_important_customer', important_customer,
site) as important_customer,
customer_group_id1,
dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1,
customer_group_id2,
dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2,
customer_status,
case
when customer_status = 'Y' then '启用'
when customer_status = 'N' then '停用'
else '' end as customerStatusDesc,
customer_type,
customer_description,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_industry', customer_industry,
site) as customer_industry,
create_date,
create_by,
update_date,
update_by,
dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
dbo.plm_get_addressName(site, customer_no) as addressName
FROM plm_customer_information
<where>
site = #{query.site}
<if test = "query.customerNo != null and query.customerNo != ''">
<if test="query.customerNo != null and query.customerNo != ''">
AND customer_no like #{query.customerNo}
</if>
<if test = "query.customerDesc != null and query.customerDesc != ''">
<if test="query.customerDesc != null and query.customerDesc != ''">
AND customer_desc like #{query.customerDesc}
</if>
<if test = "query.customerStatus != null and query.customerStatus != ''">
<if test="query.customerStatus != null and query.customerStatus != ''">
AND customer_status = #{query.customerStatus}
</if>
</where>
order by CAST(SUBSTRING(customer_no, 2, 6) AS INT) desc
</select>
<select id="customerInformationSearchForCheck" parameterType="com.spring.modules.customer.vo.CustomerInformationVo" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
SELECT
site,
customer_no,
customer_desc,
customer_currency,
turnover_of_year,
potential_revenue_of_year,
important_customer,
customer_group_id1,
dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1,
customer_group_id2,
dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2,
customer_status,
customer_type,
customer_description,
customer_industry,
create_date,
create_by,
update_date,
update_by,
dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
dbo.plm_get_addressName(site, customer_no) as addressName
<select id="customerInformationSearchForCheck" parameterType="com.spring.modules.customer.vo.CustomerInformationVo"
resultType="com.spring.modules.customer.vo.CustomerInformationVo">
SELECT site,
customer_no,
customer_desc,
customer_currency,
turnover_of_year,
potential_revenue_of_year,
important_customer,
customer_group_id1,
dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1,
customer_group_id2,
dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2,
customer_status,
customer_type,
customer_description,
customer_industry,
create_date,
create_by,
update_date,
update_by,
dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
dbo.plm_get_addressName(site, customer_no) as addressName
FROM plm_customer_information
<where>
site = #{query.site}
AND customer_no = #{query.customerNo}
AND customer_no = #{query.customerNo}
<if test = "query.customerDesc != null and query.customerDesc != ''">
<if test="query.customerDesc != null and query.customerDesc != ''">
AND customer_desc like #{query.customerDesc}
</if>
<if test = "query.customerStatus != null and query.customerStatus != ''">
<if test="query.customerStatus != null and query.customerStatus != ''">
AND customer_status = #{query.customerStatus}
</if>
</where>
order by CAST(SUBSTRING(customer_no, 2, 6) AS INT) desc
</select>
<select id="queryNextCustomerNo" resultType="java.lang.String">
select
'C'+Right('00000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(customer_no, 2, 6))), 0) + 1), 5)
AS next_customer_no
from plm_customer_information
where site = #{site}
</select>
</mapper>
Loading…
Cancel
Save