1
0
فهرست منبع

首页获取数据

suochencheng 7 سال پیش
والد
کامیت
5e970feab6

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/ServiceTypeMapper.java

@@ -23,6 +23,8 @@ public interface ServiceTypeMapper {
 
 
     List<ServiceType> queryAllServiceType(ServiceType record);
     List<ServiceType> queryAllServiceType(ServiceType record);
 
 
+    List<ServiceType> queryAllServiceTypeForHome(ServiceType record);
+
     List<ServiceType> queryServiceTypeByPage(Map<String, Object> parameter);
     List<ServiceType> queryServiceTypeByPage(Map<String, Object> parameter);
 
 
     int delete(String id);
     int delete(String id);

+ 134 - 0
src/main/java/com/izouma/awesomeadmin/dao/ServiceTypeMapper.xml

@@ -406,6 +406,120 @@
 
 
         rank desc , id desc
         rank desc , id desc
     </select>
     </select>
+    <select id="queryAllServiceTypeForHome" parameterType="java.util.Map"
+            resultMap="InfoWithListForHome">
+        select
+        <include refid="Base_Column_List"/>,
+        1 as homeFlag,
+        'Y' as useFlag,
+        6 as homeLimit,
+        10 as hotLimit
+
+        from service_type
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="serviceType != null and !&quot;&quot;.equals(serviceType)">
+                and service_type = #{serviceType}
+            </if>
+            <if test="shortName != null and !&quot;&quot;.equals(shortName)">
+                and short_name = #{shortName}
+            </if>
+            <if test="image != null and !&quot;&quot;.equals(image)">
+                and image = #{image}
+            </if>
+            <if test="color != null and !&quot;&quot;.equals(color)">
+                and color = #{color}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+            <if test="showFlag != null and !&quot;&quot;.equals(showFlag)">
+                and show_flag = #{showFlag}
+            </if>
+            <if test="description != null and !&quot;&quot;.equals(description)">
+                and description = #{description}
+            </if>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR service_type LIKE concat('%',#{searchKey},'%')
+                    OR short_name LIKE concat('%',#{searchKey},'%')
+                    OR image LIKE concat('%',#{searchKey},'%')
+                    OR color LIKE concat('%',#{searchKey},'%')
+                    OR rank LIKE concat('%',#{searchKey},'%')
+                    OR show_flag LIKE concat('%',#{searchKey},'%')
+                    OR description LIKE concat('%',#{searchKey},'%')
+                </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+        </where>
+        order by
+
+        <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+
+        rank desc , id desc
+    </select>
     <select id="queryServiceType" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ServiceType">
     <select id="queryServiceType" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ServiceType">
         select
         select
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
@@ -482,5 +596,25 @@
 
 
     </resultMap>
     </resultMap>
 
 
+    <resultMap id="InfoWithListForHome" type="com.izouma.awesomeadmin.model.ServiceType" extends="BaseResultMap">
+
+
+        <collection property="serviceTypeDetailList"
+                    ofType="com.izouma.awesomeadmin.model.ServiceTypeDetail"
+                    select="com.izouma.awesomeadmin.dao.ServiceTypeDetailMapper.queryAllServiceTypeDetail"
+                    column="{ parentId = id }"/>
+
+        <collection property="homeStoreInfoList"
+                    ofType="com.izouma.awesomeadmin.model.StoreInfo"
+                    select="com.izouma.awesomeadmin.dao.StoreInfoMapper.queryAllStoreInfoForHome"
+                    column="{ serviceType = id , homeFlag = homeFlag , useFlag = useFlag , limitNum = homeLimit }"/>
+
+        <collection property="hotStoreInfoList"
+                    ofType="com.izouma.awesomeadmin.model.StoreInfo"
+                    select="com.izouma.awesomeadmin.dao.StoreInfoMapper.queryAllStoreInfoForHome"
+                    column="{ serviceType = id , hotFlag = homeFlag , useFlag = useFlag , limitNum = hotLimit }"/>
+
+    </resultMap>
+
 </mapper>
 </mapper>
 
 

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/StoreInfoMapper.java

@@ -22,6 +22,8 @@ public interface StoreInfoMapper{
 
 
     List<StoreInfo> queryAllStoreInfo(StoreInfo record);
     List<StoreInfo> queryAllStoreInfo(StoreInfo record);
 
 
+    List<StoreInfo> queryAllStoreInfoForHome(StoreInfo record);
+
     List<StoreInfo> queryStoreInfoByPage(Map<String, Object> parameter);
     List<StoreInfo> queryStoreInfoByPage(Map<String, Object> parameter);
 
 
     int delete(String id);
     int delete(String id);

+ 98 - 0
src/main/java/com/izouma/awesomeadmin/dao/StoreInfoMapper.xml

@@ -727,6 +727,104 @@
 
 
         rank desc , id desc
         rank desc , id desc
     </select>
     </select>
+    <select id="queryAllStoreInfoForHome" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.StoreInfo">
+        select
+        <include refid="Base_Column_List"/>
+        from store_info
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
+            </if>
+            <if test="userName != null and !&quot;&quot;.equals(userName)">
+                and user_name = #{userName}
+            </if>
+            <if test="storeName != null and !&quot;&quot;.equals(storeName)">
+                and store_name = #{storeName}
+            </if>
+            <if test="serviceType != null and !&quot;&quot;.equals(serviceType)">
+                and service_type = #{serviceType}
+            </if>
+            <if test="description != null and !&quot;&quot;.equals(description)">
+                and description = #{description}
+            </if>
+            <if test="icon != null and !&quot;&quot;.equals(icon)">
+                and icon = #{icon}
+            </if>
+            <if test="province != null and !&quot;&quot;.equals(province)">
+                and province = #{province}
+            </if>
+            <if test="citye != null and !&quot;&quot;.equals(citye)">
+                and citye = #{citye}
+            </if>
+            <if test="district != null and !&quot;&quot;.equals(district)">
+                and district = #{district}
+            </if>
+            <if test="addressDetail != null and !&quot;&quot;.equals(addressDetail)">
+                and address_detail = #{addressDetail}
+            </if>
+            <if test="bankCard != null and !&quot;&quot;.equals(bankCard)">
+                and bank_card = #{bankCard}
+            </if>
+            <if test="bankName != null and !&quot;&quot;.equals(bankName)">
+                and bank_name = #{bankName}
+            </if>
+            <if test="openName != null and !&quot;&quot;.equals(openName)">
+                and open_name = #{openName}
+            </if>
+            <if test="credit != null and !&quot;&quot;.equals(credit)">
+                and credit = #{credit}
+            </if>
+            <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
+                and use_flag = #{useFlag}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+            <if test="responseTime != null and !&quot;&quot;.equals(responseTime)">
+                and response_time = #{responseTime}
+            </if>
+            <if test="reworkRate != null and !&quot;&quot;.equals(reworkRate)">
+                and rework_rate = #{reworkRate}
+            </if>
+            <if test="hotFlag != null and !&quot;&quot;.equals(hotFlag)">
+                and hot_flag = #{hotFlag}
+            </if>
+            <if test="homeFlag != null and !&quot;&quot;.equals(homeFlag)">
+                and home_flag = #{homeFlag}
+            </if>
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
+            </if>
+            <if test="subclass != null and !&quot;&quot;.equals(subclass)">
+                and subclass = #{subclass}
+            </if>
+        </where>
+        order by
+        rank desc , id desc
+        <if test="limitNum != null and !&quot;&quot;.equals(limitNum)">
+            LIMIT #{limitNum}
+        </if>
+    </select>
     <select id="queryStoreInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.StoreInfo">
     <select id="queryStoreInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.StoreInfo">
         select
         select
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>

+ 20 - 0
src/main/java/com/izouma/awesomeadmin/model/ServiceType.java

@@ -25,6 +25,10 @@ public class ServiceType {
 
 
     private List<ServiceTypeDetail> serviceTypeDetailList;
     private List<ServiceTypeDetail> serviceTypeDetailList;
 
 
+    private List<StoreInfo> homeStoreInfoList;
+
+    private List<StoreInfo> hotStoreInfoList;
+
     private String searchKey;
     private String searchKey;
 
 
     /**
     /**
@@ -172,5 +176,21 @@ public class ServiceType {
     public void setServiceTypeDetailList(List<ServiceTypeDetail> serviceTypeDetailList) {
     public void setServiceTypeDetailList(List<ServiceTypeDetail> serviceTypeDetailList) {
         this.serviceTypeDetailList = serviceTypeDetailList;
         this.serviceTypeDetailList = serviceTypeDetailList;
     }
     }
+
+    public List<StoreInfo> getHomeStoreInfoList() {
+        return homeStoreInfoList;
+    }
+
+    public void setHomeStoreInfoList(List<StoreInfo> homeStoreInfoList) {
+        this.homeStoreInfoList = homeStoreInfoList;
+    }
+
+    public List<StoreInfo> getHotStoreInfoList() {
+        return hotStoreInfoList;
+    }
+
+    public void setHotStoreInfoList(List<StoreInfo> hotStoreInfoList) {
+        this.hotStoreInfoList = hotStoreInfoList;
+    }
 }
 }
 
 

+ 13 - 0
src/main/java/com/izouma/awesomeadmin/model/StoreInfo.java

@@ -39,6 +39,11 @@ public class StoreInfo {
     private Integer typeFlag;
     private Integer typeFlag;
     private String subclass;
     private String subclass;
 
 
+    /**
+     * 需要条数
+     */
+    private String limitNum;
+
     private String storelabel;
     private String storelabel;
 
 
     /**
     /**
@@ -321,5 +326,13 @@ public class StoreInfo {
     public void setMemorySpace(BigDecimal memorySpace) {
     public void setMemorySpace(BigDecimal memorySpace) {
         this.memorySpace = memorySpace;
         this.memorySpace = memorySpace;
     }
     }
+
+    public String getLimitNum() {
+        return limitNum;
+    }
+
+    public void setLimitNum(String limitNum) {
+        this.limitNum = limitNum;
+    }
 }
 }
 
 

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/ServiceTypeService.java

@@ -12,6 +12,8 @@ public interface ServiceTypeService{
 
 
     List<ServiceType> getServiceTypeList(ServiceType record);
     List<ServiceType> getServiceTypeList(ServiceType record);
 
 
+    List<ServiceType> getServiceTypeListForHome(ServiceType record);
+
     List<ServiceType> getServiceTypeByPage(Page page, ServiceType record);
     List<ServiceType> getServiceTypeByPage(Page page, ServiceType record);
 
 
     ServiceType getServiceTypeById(String id);
     ServiceType getServiceTypeById(String id);

+ 34 - 18
src/main/java/com/izouma/awesomeadmin/service/impl/ServiceTypeServiceImpl.java

@@ -1,6 +1,7 @@
 package com.izouma.awesomeadmin.service.impl;
 package com.izouma.awesomeadmin.service.impl;
 
 
 import java.util.*;
 import java.util.*;
+
 import org.apache.log4j.Logger;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -11,10 +12,10 @@ import com.izouma.awesomeadmin.service.ServiceTypeService;
 import com.izouma.awesomeadmin.dao.ServiceTypeMapper;
 import com.izouma.awesomeadmin.dao.ServiceTypeMapper;
 
 
 /**
 /**
-*  service接口实现类
-*/
+ * service接口实现类
+ */
 @Service
 @Service
-public class ServiceTypeServiceImpl implements ServiceTypeService{
+public class ServiceTypeServiceImpl implements ServiceTypeService {
 
 
     private static Logger logger = Logger.getLogger(ServiceTypeServiceImpl.class);
     private static Logger logger = Logger.getLogger(ServiceTypeServiceImpl.class);
 
 
@@ -27,26 +28,41 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
         logger.info("getServiceTypeList");
         logger.info("getServiceTypeList");
         try {
         try {
 
 
-        return serviceTypeMapper.queryAllServiceType(record);
+            return serviceTypeMapper.queryAllServiceType(record);
+        } catch (Exception e) {
+            logger.error("getServiceTypeList", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public List<ServiceType> getServiceTypeListForHome(ServiceType record) {
+
+        logger.info("getServiceTypeListForHome");
+        try {
+
+            return serviceTypeMapper.queryAllServiceTypeForHome(record);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getServiceTypeList", e);
+            logger.error("getServiceTypeListForHome", e);
         }
         }
 
 
         return null;
         return null;
     }
     }
+
     @Override
     @Override
     public List<ServiceType> getServiceTypeByPage(Page page, ServiceType record) {
     public List<ServiceType> getServiceTypeByPage(Page page, ServiceType record) {
 
 
         logger.info("getServiceTypeByPage");
         logger.info("getServiceTypeByPage");
         try {
         try {
 
 
-        Map<String, Object> parameter = new HashMap<String, Object>();
-        parameter.put("record", record);
-        parameter.put(AppConstant.PAGE, page);
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
 
 
-        return serviceTypeMapper.queryServiceTypeByPage(parameter);
+            return serviceTypeMapper.queryServiceTypeByPage(parameter);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getServiceTypeByPage", e);
+            logger.error("getServiceTypeByPage", e);
         }
         }
 
 
         return null;
         return null;
@@ -60,7 +76,7 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
 
 
             return serviceTypeMapper.selectByPrimaryKey(Integer.valueOf(id));
             return serviceTypeMapper.selectByPrimaryKey(Integer.valueOf(id));
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getServiceTypeById", e);
+            logger.error("getServiceTypeById", e);
         }
         }
 
 
         return null;
         return null;
@@ -74,7 +90,7 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
 
 
             return serviceTypeMapper.queryServiceType(record);
             return serviceTypeMapper.queryServiceType(record);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getServiceType", e);
+            logger.error("getServiceType", e);
         }
         }
 
 
         return null;
         return null;
@@ -89,7 +105,7 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
             int updates = serviceTypeMapper.insertSelective(record);
             int updates = serviceTypeMapper.insertSelective(record);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             logger.error("createServiceType", e);
             logger.error("createServiceType", e);
@@ -104,13 +120,13 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
         logger.info("deleteServiceType");
         logger.info("deleteServiceType");
         try {
         try {
 
 
-             int updates = serviceTypeMapper.delete(id);
+            int updates = serviceTypeMapper.delete(id);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-             logger.error("deleteServiceType", e);
+            logger.error("deleteServiceType", e);
         }
         }
 
 
         return false;
         return false;
@@ -125,10 +141,10 @@ public class ServiceTypeServiceImpl implements ServiceTypeService{
             int updates = serviceTypeMapper.updateByPrimaryKeySelective(record);
             int updates = serviceTypeMapper.updateByPrimaryKeySelective(record);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-             logger.error("updateServiceType", e);
+            logger.error("updateServiceType", e);
         }
         }
 
 
         return false;
         return false;

+ 13 - 1
src/main/java/com/izouma/awesomeadmin/web/ServiceTypeController.java

@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse;
 */
 */
 @Controller
 @Controller
 @RequestMapping("/serviceType")
 @RequestMapping("/serviceType")
+@RequiresAuthentication
 public class ServiceTypeController {
 public class ServiceTypeController {
 
 
     @Autowired
     @Autowired
@@ -30,7 +31,6 @@ public class ServiceTypeController {
     /**
     /**
     * <p>获取全部记录。</p>
     * <p>获取全部记录。</p>
     */
     */
-    //@RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
     public Result all(ServiceType record) {
     public Result all(ServiceType record) {
@@ -38,6 +38,18 @@ public class ServiceTypeController {
         return new Result(true, pp);
         return new Result(true, pp);
     }
     }
 
 
+    /**
+     * <p>首页获取全部记录。</p>
+     * @param record
+     * @return
+     */
+    @RequestMapping(value = "/home", method = RequestMethod.GET)
+    @ResponseBody
+    public Result home(ServiceType record) {
+        List<ServiceType> pp = serviceTypeService.getServiceTypeListForHome(record);
+        return new Result(true, pp);
+    }
+
     /**
     /**
     * <p>根据Id。</p>
     * <p>根据Id。</p>
     */
     */