Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/yc/education/mapper/BrandFourSMapper.java
caolong 4 éve%!(EXTRA string=óta)
szülő
commit
d8fc5fc52f

+ 9 - 12
src/main/java/com/yc/education/controller/admin/ProviderAdminController.java

@@ -4,14 +4,8 @@ import com.baidu.ueditor.ActionEnter;
 import com.baidu.ueditor.define.ActionMap;
 import com.baidu.ueditor.define.BaseState;
 import com.github.pagehelper.PageInfo;
-import com.yc.education.model.Brand;
-import com.yc.education.model.CarSedan;
-import com.yc.education.model.Provider;
-import com.yc.education.model.UserInfo;
-import com.yc.education.service.IBrandService;
-import com.yc.education.service.ICarSedanService;
-import com.yc.education.service.IProviderService;
-import com.yc.education.service.IUserInfoService;
+import com.yc.education.model.*;
+import com.yc.education.service.*;
 import com.yc.education.util.AjaxMessage;
 import com.yc.education.util.MapUtils;
 import com.yc.education.util.ViewUtil;
@@ -60,6 +54,9 @@ public class ProviderAdminController {
     @Autowired
     private ICarSedanService iCarSedanService;//车型
 
+    @Autowired
+    private IBrandFourSService iBrandFourSService;//品牌
+
 
     /**
      * 服务商信息列表
@@ -120,10 +117,10 @@ public class ProviderAdminController {
     @RequestMapping("searchSeries.html")
     public AjaxMessage<Object> searchSeries (String name){
         AjaxMessage<Object> am = new AjaxMessage<>();
-        List<CarSedan> listSeriesByName = iCarSedanService.listSeriesByName(name);//查询车型数据
-
-        if (listSeriesByName != null){
-            am.setData(listSeriesByName);//将数据返还前台
+        /*List<CarSedan> listSeriesByName = iCarSedanService.listSeriesByName(name);//查询车型数据*/
+         List<BrandFourS> listBrandByName = iBrandFourSService.listBrandByName(name);//根据品牌名模糊查询4s店品牌
+        if (listBrandByName != null){
+            am.setData(listBrandByName);//将数据返还前台
             am.setIs(true);
 
         }

+ 7 - 3
src/main/java/com/yc/education/mapper/BrandFourSMapper.java

@@ -6,23 +6,25 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
-public interface BrandFourSMapper extends MyMapper< BrandFourS > {
+public interface BrandFourSMapper extends MyMapper<BrandFourS> {
 
     /**
      * @Description: 添加集合数据
      */
-    int addByList(@Param("list") List< BrandFourS > list);
+    int addByList(@Param("list") List<BrandFourS> list);
 
     /**
      * @Description: 查询重复
      */
-    List< String > queryId( );
+    List<String> queryId();
 
     /**
      * @Description: 删除集合数据
      */
     int deleteByRepeat(@Param("list") List< String > list);
 
+    List<BrandFourS> listBrandByName(@Param("name") String name);
+
     List< BrandFourS > listGroupByLetterByCategory(@Param("category") String category);
 
     List< BrandFourS > listAllByCategoryAndLetter(@Param("category") String category, @Param("letter") String letter);
@@ -30,4 +32,6 @@ public interface BrandFourSMapper extends MyMapper< BrandFourS > {
     List< BrandFourS > listAllByCategoryAndBrand(@Param("category") String category, @Param("brand") String brand);
 
     List< BrandFourS > listAllByFactoryAndBrand(@Param("brand") String brand, @Param("factory") String factory);
+
+
 }

+ 3 - 1
src/main/java/com/yc/education/service/IBrandFourSService.java

@@ -1,7 +1,6 @@
 package com.yc.education.service;
 
 import com.yc.education.model.BrandFourS;
-import com.yc.education.model.CarSedan;
 
 import java.util.List;
 
@@ -12,6 +11,7 @@ import java.util.List;
  */
 public interface IBrandFourSService extends IService<BrandFourS> {
 
+
     /**
      * 添加集合数据
      * @param list
@@ -31,5 +31,7 @@ public interface IBrandFourSService extends IService<BrandFourS> {
      * @return
      */
     int deleteByRepeat(List<String> list);
+
+    List<BrandFourS> listBrandByName(String name);
 }
 

+ 5 - 0
src/main/java/com/yc/education/service/impl/BrandFourSServiceImpl.java

@@ -33,4 +33,9 @@ public class BrandFourSServiceImpl extends  BaseService<BrandFourS> implements I
     public int deleteByRepeat(List<String> list) {
         return mapper.deleteByRepeat(list);
     }
+
+    @Override
+    public List<BrandFourS> listBrandByName(String name) {
+        return mapper.listBrandByName(name);
+    }
 }

+ 12 - 0
src/main/resources/mapper/BrandFourSMapper.xml

@@ -13,6 +13,18 @@
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
   </resultMap>
 
+
+
+  <!--根据品牌名称查询所有信息-->
+  <select id="listBrandByName" resultMap="BaseResultMap">
+    SELECT distinct brand FROM `brand_four_s`
+    <where>
+      <if test="name != null and name != ''">
+        brand  like concat('%',#{name},'%')
+      </if>
+    </where>
+  </select>
+
   <!-- 添加集合数据 -->
   <insert id="addByList" useGeneratedKeys="true" parameterType="java.util.List">
     insert into brand_four_s(category,factory,brand,letter,create_date)