Explorar el Código

广告端接口

zhengkaixin hace 4 años
padre
commit
9e4c613380

+ 21 - 0
common/src/main/java/com/jpsoft/bus/modules/base/dao/MobileBannerInfoDAO.java

@@ -0,0 +1,21 @@
+package com.jpsoft.bus.modules.base.dao;
+
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface MobileBannerInfoDAO {
+	int insert(MobileBannerInfo entity);
+	int update(MobileBannerInfo entity);
+	int exist(String id);
+	MobileBannerInfo get(String id);
+	int delete(String id);
+	List<MobileBannerInfo> list();
+	List<MobileBannerInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+
+    List<MobileBannerInfo> getBannerInfo(String type);
+}

+ 85 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/MobileBannerInfo.java

@@ -0,0 +1,85 @@
+package com.jpsoft.bus.modules.base.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 描述:base_mobile_banner_info的实体类
+ */
+@Data
+@ApiModel(value = "base_mobile_banner_info的实体类")
+public class MobileBannerInfo {
+    /**
+     *
+     */
+    @ApiModelProperty(value = "")
+    private String id;
+    /**
+     * 幻灯片标题
+     */
+    @ApiModelProperty(value = "幻灯片标题")
+    private String name;
+    /**
+     * 幻灯片分类
+     */
+    @ApiModelProperty(value = "幻灯片分类")
+    private String classify;
+    /**
+     * 幻灯片链接地址
+     */
+    @ApiModelProperty(value = "幻灯片链接地址")
+    private String linkUrl;
+    /**
+     * 幻灯片图片
+     */
+    @ApiModelProperty(value = "幻灯片图片")
+    private String picUrl;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+    /**
+     * 是否删除
+     */
+    @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+
+    @ApiModelProperty(value = "幻灯片分类")
+    private String classifyN;
+
+    @ApiModelProperty(value = "审核状态(0-未审核,1-已审核)")
+    private Boolean enabled;
+
+    @ApiModelProperty(value = "序号")
+    private Integer sortNo;
+
+
+
+
+
+}

+ 19 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/MobileBannerInfoService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.bus.modules.base.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+import java.util.List;
+import java.util.Map;
+
+public interface MobileBannerInfoService {
+	MobileBannerInfo get(String id);
+	boolean exist(String id);
+	int insert(MobileBannerInfo model);
+	int update(MobileBannerInfo model);
+	int delete(String id);
+	List<MobileBannerInfo> list();
+	List<MobileBannerInfo> getBannerInfo(String type);
+	Page<MobileBannerInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 75 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/impl/MobileBannerInfoServiceImpl.java

@@ -0,0 +1,75 @@
+package com.jpsoft.bus.modules.base.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.bus.modules.base.dao.MobileBannerInfoDAO;
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.base.service.MobileBannerInfoService;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Transactional
+@Component(value="mobileBannerInfoService")
+public class MobileBannerInfoServiceImpl implements MobileBannerInfoService {
+	@Resource(name="mobileBannerInfoDAO")
+	private MobileBannerInfoDAO mobileBannerInfoDAO;
+
+	@Override
+	public MobileBannerInfo get(String id) {
+		// TODO Auto-generated method stub
+		return mobileBannerInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(MobileBannerInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return mobileBannerInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(MobileBannerInfo model) {
+		// TODO Auto-generated method stub
+		return mobileBannerInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return mobileBannerInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = mobileBannerInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<MobileBannerInfo> list() {
+		// TODO Auto-generated method stub
+		return mobileBannerInfoDAO.list();
+	}
+
+	@Override
+	public List<MobileBannerInfo> getBannerInfo(String type) {
+		// TODO Auto-generated method stub
+		return mobileBannerInfoDAO.getBannerInfo(type);
+	}
+	@Override
+	public Page<MobileBannerInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+        Page<MobileBannerInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            mobileBannerInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 123 - 0
common/src/main/resources/mapper/base/MobileBannerInfo.xml

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.bus.modules.base.dao.MobileBannerInfoDAO">
+    <resultMap id="MobileBannerInfoMap" type="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        <id property="id" column="id_"/>
+        <result property="name" column="name_"/>
+        <result property="classify" column="classify_"/>
+        <result property="linkUrl" column="link_url"/>
+        <result property="picUrl" column="pic_url"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="enabled" column="enabled_"/>
+        <result property="sortNo" column="sort_no"/>
+
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into base_mobile_banner_info
+	    (id_,name_,classify_,link_url,pic_url,create_by,create_time,update_by,update_time,del_flag,enabled_,sort_no)
+		values
+		(
+			#{id,jdbcType=VARCHAR}
+			,#{name,jdbcType=VARCHAR}
+			,#{classify,jdbcType= VARCHAR }
+			,#{linkUrl,jdbcType=VARCHAR}
+			,#{picUrl,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{enabled,jdbcType=VARCHAR}
+			,#{sortNo,jdbcType= NUMERIC }
+
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from base_mobile_banner_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.base.entity.MobileBannerInfo">
+        update base_mobile_banner_info
+        <set>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="classify!=null">
+                classify_=#{classify,jdbcType= VARCHAR },
+            </if>
+            <if test="linkUrl!=null">
+                link_url=#{linkUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="picUrl!=null">
+                pic_url=#{picUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="enabled!=null">
+                enabled_=#{enabled,jdbcType=NUMERIC},
+            </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType=NUMERIC},
+            </if>
+
+
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="MobileBannerInfoMap">
+        select * from
+        base_mobile_banner_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from base_mobile_banner_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="MobileBannerInfoMap">
+        select * from base_mobile_banner_info
+    </select>
+    <select id="getBannerInfo" resultMap="MobileBannerInfoMap">
+        select * from base_mobile_banner_info where classify_=#{0}  and enabled_ =1  and del_flag=0
+        order by sort_no asc
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="MobileBannerInfoMap">
+        <![CDATA[
+			select * from base_mobile_banner_info
+		]]>
+        <where>
+            del_flag=0
+            <if test="searchParams.name != null">
+                and name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.classify != null">
+                and classify_ = #{searchParams.classify}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+</mapper>

+ 1 - 0
web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java

@@ -73,6 +73,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/passengerApi/passengerNearbyStation")
 				.excludePathPatterns("/mobile/passengerApi/routeList")
 				.excludePathPatterns("/mobile/passengerApi/routeDetail")
+                .excludePathPatterns("/mobile/bannerInfo/getBannerInfo")
 				.excludePathPatterns("/aliPay/**")
 				.excludePathPatterns("/wxPay/**")
 				;

+ 55 - 0
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/BannerInfoApiController.java

@@ -0,0 +1,55 @@
+package com.jpsoft.bus.modules.mobile.controller;
+
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.base.service.MobileBannerInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/mobile/bannerInfo")
+@Api(description = "移动端广告栏接口")
+public class BannerInfoApiController {
+
+    @Autowired
+    private MobileBannerInfoService mobileBannerInfoService;
+
+    @PostMapping("getBannerInfo")
+    @ApiOperation(value = "获取移动端广告栏")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "", required = true, paramType = "form"),
+
+    })
+    public MessageResult<List> getBannerInfo(String type) {
+
+        MessageResult<List> messageResult = new MessageResult<>();
+        //    Map<String, Object> map = new HashMap<>();
+
+        try {
+            List<MobileBannerInfo> list = mobileBannerInfoService.getBannerInfo(type);
+
+            //         map.put("list",list);
+            messageResult.setData(list);
+            messageResult.setCode(200);
+            messageResult.setMessage("查询成功");
+            messageResult.setResult(true);
+
+        } catch (Exception ex) {
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+            messageResult.setResult(false);
+        }
+
+        return messageResult;
+    }
+
+}