diff --git a/pom.xml b/pom.xml
index 81cda28..3cc388d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.imyeyu.timiserverapi
TimiServerAPI
- 1.0.39
+ 1.0.40
jar
TimiServerAPI
imyeyu.com API
diff --git a/src/main/java/com/imyeyu/api/modules/common/controller/ArticleController.java b/src/main/java/com/imyeyu/api/modules/common/controller/ArticleController.java
index b7a91dd..32794d0 100644
--- a/src/main/java/com/imyeyu/api/modules/common/controller/ArticleController.java
+++ b/src/main/java/com/imyeyu/api/modules/common/controller/ArticleController.java
@@ -39,6 +39,7 @@ public class ArticleController {
/// @return 文章分页
@JsonView(ResponseView.Public.class)
@RequestRateLimit
+ @RequireCorePermission(CorePermissionCode.ARTICLE_READ)
@PostMapping("/list")
public PageResult list(@RequestBody Page page) {
return service.page(page);
@@ -50,7 +51,7 @@ public class ArticleController {
/// @return 文章详情
@JsonView(ResponseView.Public.class)
@RequestRateLimit
- @PostMapping("/detail")
+ @RequestMapping("/detail")
public Article detail(@RequestParam String id) {
Article article = service.get(id);
article.setAttachmentList(attachmentService.listByBizId(Attachment.BizType.ARTICLE, article.getId()));
diff --git a/src/main/java/com/imyeyu/api/modules/gao/entity/GaoCustomer.java b/src/main/java/com/imyeyu/api/modules/gao/entity/GaoCustomer.java
index 9c31870..a9008d5 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/entity/GaoCustomer.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/entity/GaoCustomer.java
@@ -6,7 +6,6 @@ import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.entity.TagApply;
import com.imyeyu.api.modules.user.bean.Gender;
import com.imyeyu.api.modules.user.entity.User;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.imyeyu.java.TimiJava;
import com.imyeyu.spring.annotation.table.Column;
import com.imyeyu.spring.annotation.table.Transient;
@@ -62,15 +61,12 @@ public class GaoCustomer extends UUIDEntity {
private String name;
@Column("name_pinyin_full")
- @JsonIgnore
private String namePinyinFull;
@Column("name_pinyin_initial")
- @JsonIgnore
private String namePinyinInitial;
@Column("name_pinyin_mixed")
- @JsonIgnore
private String namePinyinMixed;
/// 性别
diff --git a/src/main/java/com/imyeyu/api/modules/gao/entity/GaoProduct.java b/src/main/java/com/imyeyu/api/modules/gao/entity/GaoProduct.java
index 6186823..e9fb4a3 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/entity/GaoProduct.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/entity/GaoProduct.java
@@ -1,6 +1,8 @@
package com.imyeyu.api.modules.gao.entity;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.imyeyu.api.modules.common.entity.Attachment;
+import com.imyeyu.spring.annotation.table.Column;
import com.imyeyu.spring.annotation.table.Transient;
import com.imyeyu.spring.entity.UUIDEntity;
import lombok.Data;
@@ -61,6 +63,18 @@ public class GaoProduct extends UUIDEntity {
/// 产品名称
private String name;
+ @Column("name_pinyin_full")
+ @JsonIgnore
+ private String namePinyinFull;
+
+ @Column("name_pinyin_initial")
+ @JsonIgnore
+ private String namePinyinInitial;
+
+ @Column("name_pinyin_mixed")
+ @JsonIgnore
+ private String namePinyinMixed;
+
/// 产品类型
private ProductType productType;
diff --git a/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoProductServiceImplement.java b/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoProductServiceImplement.java
index 806dba3..6ecef9d 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoProductServiceImplement.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoProductServiceImplement.java
@@ -17,6 +17,7 @@ import com.imyeyu.api.modules.gao.vo.GaoProductPage;
import com.imyeyu.api.modules.system.audit.AuditOperation;
import com.imyeyu.api.modules.system.audit.OperationAudit;
import com.imyeyu.api.modules.user.service.UserLoginService;
+import com.imyeyu.api.util.PinyinUtil;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
@@ -166,6 +167,7 @@ public class GaoProductServiceImplement extends AbstractEntityService= BATCH_SIZE) {
+ update.executeBatch();
+ batchSize = 0;
+ }
+ }
+ if (0 < batchSize) {
+ update.executeBatch();
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/resources/db/migration/timiserver/V77__add_gao_product_pinyin_search_columns.sql b/src/main/resources/db/migration/timiserver/V77__add_gao_product_pinyin_search_columns.sql
new file mode 100644
index 0000000..6c81fc2
--- /dev/null
+++ b/src/main/resources/db/migration/timiserver/V77__add_gao_product_pinyin_search_columns.sql
@@ -0,0 +1,7 @@
+ALTER TABLE `gao_product`
+ ADD COLUMN `name_pinyin_full` VARCHAR(768) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '产品名称全拼' AFTER `name`,
+ ADD COLUMN `name_pinyin_initial` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '产品名称拼音首字母' AFTER `name_pinyin_full`,
+ ADD COLUMN `name_pinyin_mixed` VARCHAR(768) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '产品名称混合拼音' AFTER `name_pinyin_initial`,
+ ADD KEY `idx_gao_product_store_name_pinyin_full` (`store_id`, `deleted_at`, `name_pinyin_full`(128)),
+ ADD KEY `idx_gao_product_store_name_pinyin_initial` (`store_id`, `deleted_at`, `name_pinyin_initial`),
+ ADD KEY `idx_gao_product_store_name_pinyin_mixed` (`store_id`, `deleted_at`, `name_pinyin_mixed`(128));
diff --git a/src/main/resources/mapper/timi-server/gao/GaoProductMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoProductMapper.xml
index b638e34..66a45e9 100644
--- a/src/main/resources/mapper/timi-server/gao/GaoProductMapper.xml
+++ b/src/main/resources/mapper/timi-server/gao/GaoProductMapper.xml
@@ -13,7 +13,7 @@
AND `status` = #{status}
AND `product_type` = #{productType}
- AND (`code` LIKE CONCAT('%', #{keyword}, '%') OR `name` LIKE CONCAT('%', #{keyword}, '%'))
+ AND (`code` LIKE CONCAT('%', #{keyword}, '%') OR `name` LIKE CONCAT('%', #{keyword}, '%') OR `name_pinyin_full` LIKE CONCAT(#{keyword}, '%') OR `name_pinyin_initial` LIKE CONCAT(#{keyword}, '%') OR `name_pinyin_mixed` LIKE CONCAT(#{keyword}, '%'))
diff --git a/src/main/resources/mapper/timi-server/gao/GaoProductStockMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoProductStockMapper.xml
index c28beb9..7a3a673 100644
--- a/src/main/resources/mapper/timi-server/gao/GaoProductStockMapper.xml
+++ b/src/main/resources/mapper/timi-server/gao/GaoProductStockMapper.xml
@@ -23,7 +23,7 @@
AND k.`stock_enabled` = 1 AND k.`status` = 'ACTIVE'
AND p.`store_id` = #{storeId}
AND k.`product_id` = #{productId}
- AND (p.`code` LIKE CONCAT('%', #{keyword}, '%') OR p.`name` LIKE CONCAT('%', #{keyword}, '%') OR k.`code` LIKE CONCAT('%', #{keyword}, '%') OR k.`name` LIKE CONCAT('%', #{keyword}, '%') OR k.`spec_summary` LIKE CONCAT('%', #{keyword}, '%') OR k.`barcode` LIKE CONCAT('%', #{keyword}, '%'))
+ AND (p.`code` LIKE CONCAT('%', #{keyword}, '%') OR p.`name` LIKE CONCAT('%', #{keyword}, '%') OR p.`name_pinyin_full` LIKE CONCAT(#{keyword}, '%') OR p.`name_pinyin_initial` LIKE CONCAT(#{keyword}, '%') OR p.`name_pinyin_mixed` LIKE CONCAT(#{keyword}, '%') OR k.`code` LIKE CONCAT('%', #{keyword}, '%') OR k.`name` LIKE CONCAT('%', #{keyword}, '%') OR k.`spec_summary` LIKE CONCAT('%', #{keyword}, '%') OR k.`barcode` LIKE CONCAT('%', #{keyword}, '%'))
@@ -57,7 +57,7 @@
AND p.`stock_enabled` = 1
AND k.`stock_enabled` = 1 AND k.`status` = 'ACTIVE'
AND p.`store_id` = #{storeId}
- AND (p.`code` LIKE CONCAT('%', #{keyword}, '%') OR p.`name` LIKE CONCAT('%', #{keyword}, '%'))
+ AND (p.`code` LIKE CONCAT('%', #{keyword}, '%') OR p.`name` LIKE CONCAT('%', #{keyword}, '%') OR p.`name_pinyin_full` LIKE CONCAT(#{keyword}, '%') OR p.`name_pinyin_initial` LIKE CONCAT(#{keyword}, '%') OR p.`name_pinyin_mixed` LIKE CONCAT(#{keyword}, '%'))