Browse Source

feat: 商品信息 & 竞品信息 新增销售id和用户id

xdd 2 weeks ago
parent
commit
c10b4b02b2

+ 3 - 0
fs-service/src/main/java/com/fs/saler/domain/FsCompetitorInfo.java

@@ -66,4 +66,7 @@ public class FsCompetitorInfo implements Serializable {
      * 更新人
      */
     private String updateBy;
+
+    private Long userId;
+    private Long companyUserId;
 }

+ 10 - 0
fs-service/src/main/java/com/fs/saler/domain/FsProductInfo.java

@@ -74,4 +74,14 @@ public class FsProductInfo {
      * 更新人
      */
     private String updateBy;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 公司用户ID
+     */
+    private Long companyUserId;
 }

+ 45 - 7
fs-service/src/main/java/com/fs/saler/mapper/FsCompetitorInfoMapper.java

@@ -22,7 +22,35 @@ public interface FsCompetitorInfoMapper {
      * 查询所有竞品信息
      * @return 竞品信息列表
      */
-    @Select("SELECT * FROM fs_competitor_info")
+    @Select("<script>" +
+            "SELECT * FROM fs_competitor_info " +
+            "WHERE 1=1 " +
+            "<if test='competitorCompany != null and competitorCompany != \"\"'>" +
+            "AND competitor_company LIKE CONCAT('%', #{competitorCompany}, '%') " +
+            "</if>" +
+            "<if test='product != null and product != \"\"'>" +
+            "AND product LIKE CONCAT('%', #{product}, '%') " +
+            "</if>" +
+            "<if test='price != null'>" +
+            "AND price = #{price} " +
+            "</if>" +
+            "<if test='service != null and service != \"\"'>" +
+            "AND service LIKE CONCAT('%', #{service}, '%') " +
+            "</if>" +
+            "<if test='freeServiceTimes != null'>" +
+            "AND free_service_times = #{freeServiceTimes} " +
+            "</if>" +
+            "<if test='remark != null and remark != \"\"'>" +
+            "AND remark LIKE CONCAT('%', #{remark}, '%') " +
+            "</if>" +
+            "<if test='userId != null'>" +
+            "AND create_by = #{userId} " +
+            "</if>" +
+            "<if test='companyUserId != null'>" +
+            "AND company_user_id = #{companyUserId} " +
+            "</if>" +
+            "ORDER BY create_time DESC" +
+            "</script>")
     List<FsCompetitorInfo> selectAll(FsCompetitorInfoParam param);
 
     /**
@@ -31,9 +59,9 @@ public interface FsCompetitorInfoMapper {
      * @return 影响行数
      */
     @Insert("INSERT INTO fs_competitor_info (competitor_company, product, price, service, " +
-            "free_service_times, remark, create_by, update_by) " +
+            "free_service_times, remark, create_by, update_by, user_id, company_user_id) " +
             "VALUES (#{competitorCompany}, #{product}, #{price}, #{service}, " +
-            "#{freeServiceTimes}, #{remark}, #{createBy}, #{updateBy})")
+            "#{freeServiceTimes}, #{remark}, #{createBy}, #{updateBy}, #{userId}, #{companyUserId})")
     @Options(useGeneratedKeys = true, keyProperty = "id")
     int insert(FsCompetitorInfo FsCompetitorInfo);
 
@@ -42,10 +70,20 @@ public interface FsCompetitorInfoMapper {
      * @param FsCompetitorInfo 竞品信息
      * @return 影响行数
      */
-    @Update("UPDATE fs_competitor_info SET competitor_company = #{competitorCompany}, product = #{product}, " +
-            "price = #{price}, service = #{service}, free_service_times = #{freeServiceTimes}, " +
-            "remark = #{remark}, update_by = #{updateBy} " +
-            "WHERE id = #{id}")
+    @Update("<script>" +
+            "UPDATE fs_competitor_info SET " +
+            "<if test='competitorCompany != null'>competitor_company = #{competitorCompany}, </if>" +
+            "<if test='product != null'>product = #{product}, </if>" +
+            "<if test='price != null'>price = #{price}, </if>" +
+            "<if test='service != null'>service = #{service}, </if>" +
+            "<if test='freeServiceTimes != null'>free_service_times = #{freeServiceTimes}, </if>" +
+            "<if test='remark != null'>remark = #{remark}, </if>" +
+            "<if test='updateBy != null'>update_by = #{updateBy}, </if>" +
+            "<if test='userId != null'>user_id = #{userId}, </if>" +
+            "<if test='companyUserId != null'>company_user_id = #{companyUserId}, </if>" +
+            "update_time = NOW() " +
+            "WHERE id = #{id}" +
+            "</script>")
     int update(FsCompetitorInfo FsCompetitorInfo);
 
     /**

+ 18 - 7
fs-service/src/main/java/com/fs/saler/mapper/FsProductInfoMapper.java

@@ -30,9 +30,9 @@ public interface FsProductInfoMapper {
      * @return 影响行数
      */
     @Insert("INSERT INTO fs_product_info (product_name, purchase_quantity, amount, planned_completion_date, " +
-            "purchase_times, surplus_times, member_status, remark, create_by, update_by) " +
+            "purchase_times, surplus_times, member_status, remark, create_by, update_by, user_id, company_user_id) " +
             "VALUES (#{productName}, #{purchaseQuantity}, #{amount}, #{plannedCompletionDate}, " +
-            "#{purchaseTimes}, #{surplusTimes}, #{memberStatus}, #{remark}, #{createBy}, #{updateBy})")
+            "#{purchaseTimes}, #{surplusTimes}, #{memberStatus}, #{remark}, #{createBy}, #{updateBy}, #{userId}, #{companyUserId})")
     @Options(useGeneratedKeys = true, keyProperty = "id")
     int insert(FsProductInfo FsProductInfo);
 
@@ -41,11 +41,22 @@ public interface FsProductInfoMapper {
      * @param FsProductInfo 商品信息
      * @return 影响行数
      */
-    @Update("UPDATE fs_product_info SET product_name = #{productName}, purchase_quantity = #{purchaseQuantity}, " +
-            "amount = #{amount}, planned_completion_date = #{plannedCompletionDate}, " +
-            "purchase_times = #{purchaseTimes}, surplus_times = #{surplusTimes}, " +
-            "member_status = #{memberStatus}, remark = #{remark}, update_by = #{updateBy} " +
-            "WHERE id = #{id}")
+    @Update("<script>" +
+            "UPDATE fs_product_info SET " +
+            "<if test='productName != null'>product_name = #{productName}, </if>" +
+            "<if test='purchaseQuantity != null'>purchase_quantity = #{purchaseQuantity}, </if>" +
+            "<if test='amount != null'>amount = #{amount}, </if>" +
+            "<if test='plannedCompletionDate != null'>planned_completion_date = #{plannedCompletionDate}, </if>" +
+            "<if test='purchaseTimes != null'>purchase_times = #{purchaseTimes}, </if>" +
+            "<if test='surplusTimes != null'>surplus_times = #{surplusTimes}, </if>" +
+            "<if test='memberStatus != null'>member_status = #{memberStatus}, </if>" +
+            "<if test='remark != null'>remark = #{remark}, </if>" +
+            "<if test='updateBy != null'>update_by = #{updateBy}, </if>" +
+            "<if test='userId != null'>user_id = #{userId}, </if>" +
+            "<if test='companyUserId != null'>company_user_id = #{companyUserId}, </if>" +
+            "update_time = NOW() " +
+            "WHERE id = #{id}" +
+            "</script>")
     int update(FsProductInfo FsProductInfo);
 
     /**

+ 4 - 0
fs-service/src/main/java/com/fs/saler/param/FsCompetitorInfoParam.java

@@ -61,4 +61,8 @@ public class FsCompetitorInfoParam implements Serializable {
      * 更新人
      */
     private String updateBy;
+
+    private Long userId;
+
+    private Long companyUserId;
 }

+ 3 - 0
fs-service/src/main/java/com/fs/saler/param/ProductInfoListPageParam.java

@@ -56,4 +56,7 @@ public class ProductInfoListPageParam {
      * 创建时间
      */
     private LocalDateTime createTime;
+
+    private Long userId;
+    private Long companyUserId;
 }

+ 6 - 0
fs-service/src/main/resources/mapper/saler/FsProductInfoMapper.xml

@@ -35,6 +35,12 @@
             <if test="createTime != null">
                 AND create_time = #{createTime}
             </if>
+            <if test="userId != null">
+                AND user_id = #{userId}
+            </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
         </where>
         ORDER BY id DESC
     </select>