feat: add name_pinyin_abbr columns for CRM product and customer.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fa9b3429c7
commit
e7b3fbb21b
3 files changed
+41
-16752
No files matched your search
@@ -48,6 +48,7 @@ class CrmProduct(Base):
|
||||
id = Column(String(64), primary_key=True, comment="主键ID")
|
||||
product_no = Column(String(50), nullable=False, comment="产品编号")
|
||||
product_name = Column(String(200), nullable=False, comment="产品名称")
|
||||
name_pinyin_abbr = Column(String(100), nullable=True, comment="产品名称拼音首字母(小写)")
|
||||
category_id = Column(String(64), nullable=True, comment="分类ID")
|
||||
category_name = Column(String(100), nullable=True, comment="分类名称(冗余)")
|
||||
model = Column(String(100), nullable=True, comment="规格型号")
|
||||
@@ -157,6 +158,7 @@ class CrmCustomer(Base):
|
||||
# 业务字段
|
||||
customer_no = Column(String(50), nullable=False, comment="客户编号(唯一)")
|
||||
customer_name = Column(String(200), nullable=False, comment="客户名称")
|
||||
name_pinyin_abbr = Column(String(100), nullable=True, comment="客户名称拼音首字母(小写)")
|
||||
short_name = Column(String(100), nullable=True, comment="客户简称")
|
||||
customer_type = Column(String(20), nullable=True, default="company", comment="客户类型(字典 crm_customer_type)")
|
||||
mobile = Column(String(20), nullable=True, comment="手机号")
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
-- 产品/客户名称拼音首字母(小写)
|
||||
-- 若列已存在会报 Duplicate column;可忽略或先查 information_schema。
|
||||
-- 建议仅执行一次。
|
||||
|
||||
-- crm_product.name_pinyin_abbr
|
||||
SET @col_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'crm_product'
|
||||
AND COLUMN_NAME = 'name_pinyin_abbr'
|
||||
);
|
||||
SET @sql := IF(
|
||||
@col_exists = 0,
|
||||
'ALTER TABLE `crm_product` ADD COLUMN `name_pinyin_abbr` varchar(100) DEFAULT NULL COMMENT ''产品名称拼音首字母(小写)'' AFTER `product_name`',
|
||||
'SELECT ''crm_product.name_pinyin_abbr already exists, skip'''
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- crm_customer.name_pinyin_abbr
|
||||
SET @col_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'crm_customer'
|
||||
AND COLUMN_NAME = 'name_pinyin_abbr'
|
||||
);
|
||||
SET @sql := IF(
|
||||
@col_exists = 0,
|
||||
'ALTER TABLE `crm_customer` ADD COLUMN `name_pinyin_abbr` varchar(100) DEFAULT NULL COMMENT ''客户名称拼音首字母(小写)'' AFTER `customer_name`',
|
||||
'SELECT ''crm_customer.name_pinyin_abbr already exists, skip'''
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
+2
-16752
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user