3 changed files with 74 additions and 58 deletions
-
1src/main/java/com/spring/modules/customer/mapper/CustomerInformationMapper.java
-
3src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java
-
128src/main/resources/mapper/customer/CustomerInformationMapper.xml
@ -1,86 +1,98 @@ |
|||||
<?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="com.spring.modules.customer.mapper.CustomerInformationMapper"> |
<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 |
FROM plm_customer_information |
||||
<where> |
<where> |
||||
site = #{query.site} |
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} |
AND customer_no like #{query.customerNo} |
||||
</if> |
</if> |
||||
<if test = "query.customerDesc != null and query.customerDesc != ''"> |
|
||||
|
<if test="query.customerDesc != null and query.customerDesc != ''"> |
||||
AND customer_desc like #{query.customerDesc} |
AND customer_desc like #{query.customerDesc} |
||||
</if> |
</if> |
||||
<if test = "query.customerStatus != null and query.customerStatus != ''"> |
|
||||
|
<if test="query.customerStatus != null and query.customerStatus != ''"> |
||||
AND customer_status = #{query.customerStatus} |
AND customer_status = #{query.customerStatus} |
||||
</if> |
</if> |
||||
</where> |
</where> |
||||
|
order by CAST(SUBSTRING(customer_no, 2, 6) AS INT) desc |
||||
</select> |
</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 |
FROM plm_customer_information |
||||
<where> |
<where> |
||||
site = #{query.site} |
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} |
AND customer_desc like #{query.customerDesc} |
||||
</if> |
</if> |
||||
<if test = "query.customerStatus != null and query.customerStatus != ''"> |
|
||||
|
<if test="query.customerStatus != null and query.customerStatus != ''"> |
||||
AND customer_status = #{query.customerStatus} |
AND customer_status = #{query.customerStatus} |
||||
</if> |
</if> |
||||
</where> |
</where> |
||||
|
order by CAST(SUBSTRING(customer_no, 2, 6) AS INT) desc |
||||
</select> |
</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> |
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue