Browse Source

轮播图模块开发

Signed-off-by: anderx <312518615@qq.com>
anderx 6 years ago
parent
commit
f31c31aca7

+ 13 - 13
GeneratorConfig.xml

@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
-<generatorConfiguration>
-  <classPathEntry location="C:/Users/Administrator/.dbeaver-drivers/maven/maven-central/mysql/mysql-connector-java-5.1.39.jar" />
-   <!-- <classPathEntry location="E:/mysql-connector-java-5.1.40.jar" /> -->
-  <context id="context1">	
-    <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/aft_ow" 
-    	driverClass="com.mysql.jdbc.Driver" password="123456" userId="dev" />
-    <javaModelGenerator targetPackage="com.kede.common.model" targetProject="kede-officialWeb" />
-    <sqlMapGenerator targetPackage="com.kede.common.mapper" targetProject="kede-officialWeb" />
-    <javaClientGenerator targetPackage="com.kede.common.dao" targetProject="kede-officialWeb" type="XMLMAPPER" />
-    <table schema="aft_ow" tableName="admin"/>
-  </context>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
+<generatorConfiguration>
+  <classPathEntry location="C:/Users/Administrator/.dbeaver-drivers/maven/maven-central/mysql/mysql-connector-java-5.1.39.jar" />
+   <!-- <classPathEntry location="E:/mysql-connector-java-5.1.40.jar" /> -->
+  <context id="context1">	
+    <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/aft_ow" 
+    	driverClass="com.mysql.jdbc.Driver" password="123456" userId="dev" />
+    <javaModelGenerator targetPackage="com.kede.common.model" targetProject="kede-officialWeb-HN" />
+    <sqlMapGenerator targetPackage="com.kede.common.mapper" targetProject="kede-officialWeb-HN" />
+    <javaClientGenerator targetPackage="com.kede.common.dao" targetProject="kede-officialWeb-HN" type="XMLMAPPER" />
+    <table schema="aft_ow" tableName="banner_details"/>
+  </context>
 </generatorConfiguration>

+ 7 - 0
src/main/java/com/kede/banners/bo/InputBannerDetails.java

@@ -0,0 +1,7 @@
+package com.kede.banners.bo;
+
+import com.kede.common.model.BannerDetails;
+
+public class InputBannerDetails extends BannerDetails {
+
+}

+ 15 - 0
src/main/java/com/kede/banners/bo/OutBannerDetails.java

@@ -0,0 +1,15 @@
+package com.kede.banners.bo;
+
+import com.kede.common.model.BannerDetails;
+
+public class OutBannerDetails extends BannerDetails {
+	private String createTimeConvert;
+
+	public String getCreateTimeConvert() {
+		return createTimeConvert;
+	}
+
+	public void setCreateTimeConvert(String createTimeConvert) {
+		this.createTimeConvert = createTimeConvert;
+	}
+}

+ 92 - 0
src/main/java/com/kede/banners/controller/AdminBannersApiController.java

@@ -0,0 +1,92 @@
+package com.kede.banners.controller;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.kede.banners.bo.InputBannerDetails;
+import com.kede.banners.service.BannersService;
+import com.kede.common.bo.Result;
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.controller.BaseApiController;
+import com.kede.common.utils.StringUtils;
+
+
+
+
+@RestController
+@RequestMapping(value = "/open/admin/banners")
+public class AdminBannersApiController extends BaseApiController {
+	@Resource
+ 	private BannersService	bannersService;
+	
+
+	@RequestMapping(value = "/addBanners", method = RequestMethod.POST)
+	public Result addBanners(InputBannerDetails ibd) {
+		Result res =new Result();
+		inuptcheck(ibd, res);
+		if (!res.getError().isEmpty()) {
+			return res;
+		}
+		res.data(bannersService.addBannersDetails(ibd));
+		return res;
+	}
+
+	private void inuptcheck(InputBannerDetails ibd, Result res) {
+		if(StringUtils.isBlank(ibd.getBannerUrl())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"图片","图片"));
+		}
+		if (StringUtils.isBlank(ibd.getTitle())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"标题","标题"));
+		}
+	}
+	
+	@RequestMapping(value = "/updateBanners", method = RequestMethod.POST)
+	public Result updateBanners(InputBannerDetails ibd) {
+		Result res =new Result();
+		inuptcheck(ibd, res);
+		if (!res.getError().isEmpty()) return res;
+		
+		res.data(bannersService.updateBannersDetails(ibd));
+		return res;
+	}
+	
+	@RequestMapping(value = "/deleteBanners", method = RequestMethod.POST)
+	public Result deleteBanners(InputBannerDetails ibd) {
+		Result res =new Result();
+		if(ibd.getId()==null)res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
+		res.data(bannersService.deleteBannersDetails(ibd));
+		return res;
+	}
+	
+	@RequestMapping(value = "/listBanners", method = RequestMethod.GET)
+	public Result listBanners(InputBannerDetails ibd,Integer pageSize,Integer pageNo) {
+		Result res =new Result();
+		
+		res.data(bannersService.listBannersDetails(ibd,pageSize,pageNo));
+		return res;
+	}
+	
+	@RequestMapping(value = "/selectBanners", method = RequestMethod.GET)
+	public Result selectBanners(InputBannerDetails ibd) {
+		Result res =new Result();
+		if(ibd.getId()==null)res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
+		if (!res.getError().isEmpty()) return res;
+		res.data(bannersService.selectBannersDetails(ibd));
+		return res;
+	}
+	
+	/** 上传图片 **/
+	@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
+	public Result uploadOrderInvoiceFile(HttpServletRequest req){
+		Result res = new Result();
+		res.setData(handleFile(res, "/banners_Details/", false, req, "banners_Details"));
+		return res;
+	}
+
+	
+
+}

+ 19 - 0
src/main/java/com/kede/banners/service/BannersService.java

@@ -0,0 +1,19 @@
+package com.kede.banners.service;
+
+import com.kede.banners.bo.InputBannerDetails;
+import com.kede.banners.bo.OutBannerDetails;
+import com.kede.core.mybatis.page.Pagination;
+
+public interface BannersService {
+
+	int addBannersDetails(InputBannerDetails ibd);
+
+	int updateBannersDetails(InputBannerDetails ibd);
+
+	int deleteBannersDetails(InputBannerDetails ibd);
+
+	Pagination<OutBannerDetails> listBannersDetails(InputBannerDetails ibd, Integer pageSize, Integer pageNo);
+
+	OutBannerDetails selectBannersDetails(InputBannerDetails ibd);
+
+}

+ 56 - 0
src/main/java/com/kede/banners/service/impl/BannersServiceImpl.java

@@ -0,0 +1,56 @@
+package com.kede.banners.service.impl;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.kede.banners.bo.InputBannerDetails;
+import com.kede.banners.bo.OutBannerDetails;
+import com.kede.banners.service.BannersService;
+import com.kede.common.dao.BannerDetailsMapper;
+import com.kede.core.mybatis.BaseMybatisDao;
+import com.kede.core.mybatis.page.Pagination;
+@Service
+public class BannersServiceImpl extends BaseMybatisDao<BannerDetailsMapper> implements BannersService {
+	
+	@Autowired
+	private BannerDetailsMapper	bannerDetailsMapper; 
+	
+	@Override
+	public int addBannersDetails(InputBannerDetails ibd) {
+		
+		return bannerDetailsMapper.insertSelective(ibd);
+	}
+
+	@Override
+	public int updateBannersDetails(InputBannerDetails ibd) {
+		
+		return  bannerDetailsMapper.updateByPrimaryKeySelective(ibd);
+	}
+
+	@Override
+	public int deleteBannersDetails(InputBannerDetails ibd) {
+		// TODO Auto-generated method stub
+		return bannerDetailsMapper.deleteByPrimaryKey(ibd.getId());
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OutBannerDetails> listBannersDetails(InputBannerDetails ibd,Integer pageSize,Integer pageNo) {
+		Map<String, Object> params = new HashMap<>();
+		if(pageSize==null||pageSize<0)pageSize=10;
+		if(pageNo==null||pageNo<0)pageNo=1;
+		params.put("b", ibd);
+		return (Pagination<OutBannerDetails>) findPage("findBannersList", "findBannersCount", params, pageNo, pageSize);
+	}
+
+	@Override
+	public OutBannerDetails selectBannersDetails(InputBannerDetails ibd) {
+		
+		return bannerDetailsMapper.selectByid(ibd.getId());
+	}
+
+}

+ 1 - 1
src/main/java/com/kede/common/controller/BaseApiController.java

@@ -63,7 +63,7 @@ public class BaseApiController extends BaseController {
 		if (!files.isEmpty()) {
 			try {
 				MultipartFile mf = files.get(0);
-				fileName = FileUtils.splicingFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
+				fileName = FileUtils.splicingFileName(mf, isPrivate, sign, path, TokenManager.getAdminId());
 				mf.transferTo(isPrivate ? toPrivateFile(fileName) : toFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (Exception e) {

+ 78 - 95
src/main/java/com/kede/common/dao/BannerDetailsMapper.java

@@ -1,96 +1,79 @@
-package com.kede.common.dao;
-
-import com.kede.common.model.BannerDetails;
-import com.kede.common.model.BannerDetailsExample;
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-
-public interface BannerDetailsMapper {
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    long countByExample(BannerDetailsExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int deleteByExample(BannerDetailsExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int deleteByPrimaryKey(Integer id);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int insert(BannerDetails record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int insertSelective(BannerDetails record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    List<BannerDetails> selectByExample(BannerDetailsExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    BannerDetails selectByPrimaryKey(Integer id);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int updateByExampleSelective(@Param("record") BannerDetails record, @Param("example") BannerDetailsExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int updateByExample(@Param("record") BannerDetails record, @Param("example") BannerDetailsExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int updateByPrimaryKeySelective(BannerDetails record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table banner_details
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    int updateByPrimaryKey(BannerDetails record);
+package com.kede.common.dao;
+
+import com.kede.banners.bo.OutBannerDetails;
+import com.kede.common.model.BannerDetails;
+import com.kede.common.model.BannerDetailsExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface BannerDetailsMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	long countByExample(BannerDetailsExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int deleteByExample(BannerDetailsExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int deleteByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int insert(BannerDetails record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int insertSelective(BannerDetails record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	List<BannerDetails> selectByExample(BannerDetailsExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	BannerDetails selectByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int updateByExampleSelective(@Param("record") BannerDetails record, @Param("example") BannerDetailsExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int updateByExample(@Param("record") BannerDetails record, @Param("example") BannerDetailsExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int updateByPrimaryKeySelective(BannerDetails record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table banner_details
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	int updateByPrimaryKey(BannerDetails record);
+	
+	
+	OutBannerDetails selectByid(Integer id);
 }

+ 365 - 302
src/main/java/com/kede/common/mapper/BannerDetailsMapper.xml

@@ -1,303 +1,366 @@
-<?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">
-<mapper namespace="com.kede.common.dao.BannerDetailsMapper">
-  <resultMap id="BaseResultMap" type="com.kede.common.model.BannerDetails">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="banner_url" jdbcType="VARCHAR" property="bannerUrl" />
-    <result column="title" jdbcType="VARCHAR" property="title" />
-    <result column="sort" jdbcType="INTEGER" property="sort" />
-    <result column="display" jdbcType="INTEGER" property="display" />
-    <result column="position" jdbcType="INTEGER" property="position" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    id, banner_url, title, sort, display, position
-  </sql>
-  <select id="selectByExample" parameterType="com.kede.common.model.BannerDetailsExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from banner_details
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    select 
-    <include refid="Base_Column_List" />
-    from banner_details
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    delete from banner_details
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.kede.common.model.BannerDetailsExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    delete from banner_details
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.kede.common.model.BannerDetails">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    insert into banner_details (id, banner_url, title, 
-      sort, display, position
-      )
-    values (#{id,jdbcType=INTEGER}, #{bannerUrl,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, 
-      #{sort,jdbcType=INTEGER}, #{display,jdbcType=INTEGER}, #{position,jdbcType=INTEGER}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.kede.common.model.BannerDetails">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    insert into banner_details
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="bannerUrl != null">
-        banner_url,
-      </if>
-      <if test="title != null">
-        title,
-      </if>
-      <if test="sort != null">
-        sort,
-      </if>
-      <if test="display != null">
-        display,
-      </if>
-      <if test="position != null">
-        position,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=INTEGER},
-      </if>
-      <if test="bannerUrl != null">
-        #{bannerUrl,jdbcType=VARCHAR},
-      </if>
-      <if test="title != null">
-        #{title,jdbcType=VARCHAR},
-      </if>
-      <if test="sort != null">
-        #{sort,jdbcType=INTEGER},
-      </if>
-      <if test="display != null">
-        #{display,jdbcType=INTEGER},
-      </if>
-      <if test="position != null">
-        #{position,jdbcType=INTEGER},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.kede.common.model.BannerDetailsExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    select count(*) from banner_details
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    update banner_details
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.bannerUrl != null">
-        banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
-      </if>
-      <if test="record.title != null">
-        title = #{record.title,jdbcType=VARCHAR},
-      </if>
-      <if test="record.sort != null">
-        sort = #{record.sort,jdbcType=INTEGER},
-      </if>
-      <if test="record.display != null">
-        display = #{record.display,jdbcType=INTEGER},
-      </if>
-      <if test="record.position != null">
-        position = #{record.position,jdbcType=INTEGER},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    update banner_details
-    set id = #{record.id,jdbcType=INTEGER},
-      banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
-      title = #{record.title,jdbcType=VARCHAR},
-      sort = #{record.sort,jdbcType=INTEGER},
-      display = #{record.display,jdbcType=INTEGER},
-      position = #{record.position,jdbcType=INTEGER}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.BannerDetails">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    update banner_details
-    <set>
-      <if test="bannerUrl != null">
-        banner_url = #{bannerUrl,jdbcType=VARCHAR},
-      </if>
-      <if test="title != null">
-        title = #{title,jdbcType=VARCHAR},
-      </if>
-      <if test="sort != null">
-        sort = #{sort,jdbcType=INTEGER},
-      </if>
-      <if test="display != null">
-        display = #{display,jdbcType=INTEGER},
-      </if>
-      <if test="position != null">
-        position = #{position,jdbcType=INTEGER},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.kede.common.model.BannerDetails">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed Sep 11 15:57:15 CST 2019.
-    -->
-    update banner_details
-    set banner_url = #{bannerUrl,jdbcType=VARCHAR},
-      title = #{title,jdbcType=VARCHAR},
-      sort = #{sort,jdbcType=INTEGER},
-      display = #{display,jdbcType=INTEGER},
-      position = #{position,jdbcType=INTEGER}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
+<?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">
+<mapper namespace="com.kede.common.dao.BannerDetailsMapper">
+  <resultMap id="BaseResultMap" type="com.kede.common.model.BannerDetails">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="banner_url" jdbcType="VARCHAR" property="bannerUrl" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="sort" jdbcType="INTEGER" property="sort" />
+    <result column="display" jdbcType="INTEGER" property="display" />
+    <result column="position" jdbcType="INTEGER" property="position" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    id, banner_url, title, sort, display, position, create_time
+  </sql>
+  <select id="selectByExample" parameterType="com.kede.common.model.BannerDetailsExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from banner_details
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from banner_details
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    delete from banner_details
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.kede.common.model.BannerDetailsExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    delete from banner_details
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.kede.common.model.BannerDetails">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    insert into banner_details (id, banner_url, title, 
+      sort, display, position, 
+      create_time)
+    values (#{id,jdbcType=INTEGER}, #{bannerUrl,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, 
+      #{sort,jdbcType=INTEGER}, #{display,jdbcType=INTEGER}, #{position,jdbcType=INTEGER}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.kede.common.model.BannerDetails">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    insert into banner_details
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="bannerUrl != null">
+        banner_url,
+      </if>
+      <if test="title != null">
+        title,
+      </if>
+      <if test="sort != null">
+        sort,
+      </if>
+      <if test="display != null">
+        display,
+      </if>
+      <if test="position != null">
+        position,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="bannerUrl != null">
+        #{bannerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="sort != null">
+        #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="display != null">
+        #{display,jdbcType=INTEGER},
+      </if>
+      <if test="position != null">
+        #{position,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.kede.common.model.BannerDetailsExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    select count(*) from banner_details
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    update banner_details
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.bannerUrl != null">
+        banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="record.title != null">
+        title = #{record.title,jdbcType=VARCHAR},
+      </if>
+      <if test="record.sort != null">
+        sort = #{record.sort,jdbcType=INTEGER},
+      </if>
+      <if test="record.display != null">
+        display = #{record.display,jdbcType=INTEGER},
+      </if>
+      <if test="record.position != null">
+        position = #{record.position,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    update banner_details
+    set id = #{record.id,jdbcType=INTEGER},
+      banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
+      title = #{record.title,jdbcType=VARCHAR},
+      sort = #{record.sort,jdbcType=INTEGER},
+      display = #{record.display,jdbcType=INTEGER},
+      position = #{record.position,jdbcType=INTEGER},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.BannerDetails">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    update banner_details
+    <set>
+      <if test="bannerUrl != null">
+        banner_url = #{bannerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        title = #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="sort != null">
+        sort = #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="display != null">
+        display = #{display,jdbcType=INTEGER},
+      </if>
+      <if test="position != null">
+        position = #{position,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.kede.common.model.BannerDetails">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Dec 25 14:10:15 CST 2019.
+    -->
+    update banner_details
+    set banner_url = #{bannerUrl,jdbcType=VARCHAR},
+      title = #{title,jdbcType=VARCHAR},
+      sort = #{sort,jdbcType=INTEGER},
+      display = #{display,jdbcType=INTEGER},
+      position = #{position,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  
+  <select id="selectByid" parameterType="java.lang.Integer" resultType="com.kede.banners.bo.OutBannerDetails" >
+  	select id, banner_url bannerUrl, title, sort, display, position, date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert
+    from banner_details where id = #{id,jdbcType=INTEGER}
+    </select>
+    
+    <select id="findBannersList" resultType="com.kede.banners.bo.OutBannerDetails">
+    select id, banner_url bannerUrl, title, sort, display, position, date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert 
+    from banner_details where 1=1
+    <if test="b.id!=null">
+    and id = #{b.id}
+    </if>
+    <if test="b.title!=null">
+    and title = #{b.title}
+    </if>
+    <if test="b.sort!=null">
+    and sort = #{b.sort}
+    </if>
+    <if test="b.display!=null">
+    and display = #{b.display}
+    </if>
+    <if test="b.position!=null">
+    and position = #{b.position}
+    </if>
+    order by display,sort desc,create_time desc
+    <if test="page_sql!=null">
+			${page_sql}
+	</if>
+    </select>
+    <select id="findBannersCount" resultType="java.lang.Integer">
+    select count(*)
+    from banner_details where 1=1
+    <if test="b.id!=null">
+    and id = #{b.id}
+    </if>
+    <if test="b.title!=null">
+    and title = #{b.title}
+    </if>
+     <if test="b.sort!=null">
+    and sort = #{b.sort}
+    </if>
+    <if test="b.display!=null">
+    and display = #{b.display}
+    </if>
+    <if test="b.position!=null">
+    and position = #{b.position}
+    </if>
+    </select>
 </mapper>

+ 167 - 200
src/main/java/com/kede/common/model/BannerDetails.java

@@ -1,201 +1,168 @@
-package com.kede.common.model;
-
-public class BannerDetails {
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.id
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private Integer id;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.banner_url
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private String bannerUrl;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.title
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private String title;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.sort
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private Integer sort;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.display
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private Integer display;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column banner_details.position
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    private Integer position;
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.id
-     *
-     * @return the value of banner_details.id
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public Integer getId() {
-        return id;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.id
-     *
-     * @param id the value for banner_details.id
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.banner_url
-     *
-     * @return the value of banner_details.banner_url
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public String getBannerUrl() {
-        return bannerUrl;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.banner_url
-     *
-     * @param bannerUrl the value for banner_details.banner_url
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setBannerUrl(String bannerUrl) {
-        this.bannerUrl = bannerUrl;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.title
-     *
-     * @return the value of banner_details.title
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public String getTitle() {
-        return title;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.title
-     *
-     * @param title the value for banner_details.title
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.sort
-     *
-     * @return the value of banner_details.sort
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public Integer getSort() {
-        return sort;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.sort
-     *
-     * @param sort the value for banner_details.sort
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setSort(Integer sort) {
-        this.sort = sort;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.display
-     *
-     * @return the value of banner_details.display
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public Integer getDisplay() {
-        return display;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.display
-     *
-     * @param display the value for banner_details.display
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setDisplay(Integer display) {
-        this.display = display;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column banner_details.position
-     *
-     * @return the value of banner_details.position
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public Integer getPosition() {
-        return position;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column banner_details.position
-     *
-     * @param position the value for banner_details.position
-     *
-     * @mbg.generated Wed Sep 11 15:57:15 CST 2019
-     */
-    public void setPosition(Integer position) {
-        this.position = position;
-    }
+package com.kede.common.model;
+
+import java.util.Date;
+
+public class BannerDetails {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.id
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private Integer id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.banner_url
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private String bannerUrl;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.title
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private String title;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.sort
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private Integer sort;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.display
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private Integer display;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.position
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private Integer position;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column banner_details.create_time
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	private Date createTime;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.id
+	 * @return  the value of banner_details.id
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public Integer getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.id
+	 * @param id  the value for banner_details.id
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.banner_url
+	 * @return  the value of banner_details.banner_url
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public String getBannerUrl() {
+		return bannerUrl;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.banner_url
+	 * @param bannerUrl  the value for banner_details.banner_url
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setBannerUrl(String bannerUrl) {
+		this.bannerUrl = bannerUrl;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.title
+	 * @return  the value of banner_details.title
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public String getTitle() {
+		return title;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.title
+	 * @param title  the value for banner_details.title
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.sort
+	 * @return  the value of banner_details.sort
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public Integer getSort() {
+		return sort;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.sort
+	 * @param sort  the value for banner_details.sort
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setSort(Integer sort) {
+		this.sort = sort;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.display
+	 * @return  the value of banner_details.display
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public Integer getDisplay() {
+		return display;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.display
+	 * @param display  the value for banner_details.display
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setDisplay(Integer display) {
+		this.display = display;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.position
+	 * @return  the value of banner_details.position
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public Integer getPosition() {
+		return position;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.position
+	 * @param position  the value for banner_details.position
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setPosition(Integer position) {
+		this.position = position;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column banner_details.create_time
+	 * @return  the value of banner_details.create_time
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column banner_details.create_time
+	 * @param createTime  the value for banner_details.create_time
+	 * @mbg.generated  Wed Dec 25 14:10:15 CST 2019
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
 }

File diff suppressed because it is too large
+ 701 - 681
src/main/java/com/kede/common/model/BannerDetailsExample.java


+ 250 - 246
src/main/java/com/kede/core/mybatis/BaseMybatisDao.java

@@ -1,246 +1,250 @@
-package com.kede.core.mybatis;
-
-import java.lang.reflect.ParameterizedType;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ibatis.mapping.BoundSql;
-import org.apache.ibatis.mapping.ParameterMapping;
-import org.apache.ibatis.session.Configuration;
-import org.mybatis.spring.SqlSessionTemplate;
-import org.mybatis.spring.support.SqlSessionDaoSupport;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.kede.common.utils.LoggerUtils;
-import com.kede.core.mybatis.page.MysqlDialect;
-import com.kede.core.mybatis.page.Pagination;
-
-@SuppressWarnings({ "unchecked" })
-public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
-
-	private String NAMESPACE;
-	final static Class<? extends Object> SELF = BaseMybatisDao.class;
-	protected final Log logger = LogFactory.getLog(BaseMybatisDao.class);
-	/** 默认的查询Sql id */
-	final static String DEFAULT_SQL_ID = "findAll";
-	/** 默认的查询Count sql id **/
-	final static String DEFAULT_COUNT_SQL_ID = "findCount";
-
-	public BaseMybatisDao() {
-		try {
-			Object genericClz = getClass().getGenericSuperclass();
-			if (genericClz instanceof ParameterizedType) {
-				Class<T> entityClass = (Class<T>) ((ParameterizedType) genericClz).getActualTypeArguments()[0];
-				NAMESPACE = entityClass.getPackage().getName() + "." + entityClass.getSimpleName();
-			}
-		} catch (RuntimeException e) {
-			LoggerUtils.error(SELF, "初始化失败,继承BaseMybatisDao,没有泛型!");
-		}
-	}
-
-	@Autowired
-	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
-		super.setSqlSessionTemplate(sqlSessionTemplate);
-	}
-
-	/**
-	 * 根据Sql id 去查询 分页对象
-	 * 
-	 * @param sqlId
-	 *            对应mapper.xml 里的Sql Id
-	 * @param params
-	 *            参数<String,Object>
-	 * @param pageNo
-	 *            number
-	 * @param pageSize
-	 *            size
-	 * @return
-	 */
-	public Pagination<?> findByPageBySqlId(String sqlId, Map<String, Object> params, Integer pageNo, Integer pageSize) {
-
-		pageNo = null == pageNo ? 1 : pageNo;
-		pageSize = null == pageSize ? 10 : pageSize;
-
-		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
-
-		Pagination<?> page = new Pagination<Object>();
-		page.setPageNo(pageNo);
-		page.setPageSize(pageSize);
-		Configuration c = this.getSqlSession().getConfiguration();
-		int offset = (page.getPageNo() - 1) * page.getPageSize();
-		String page_sql = String.format(" limit %s , %s", offset, pageSize);
-		params.put("page_sql", page_sql);
-
-		BoundSql boundSql = c.getMappedStatement(sqlId).getBoundSql(params);
-		String sqlcode = boundSql.getSql();
-
-		LoggerUtils.debug(SELF, "findByPageBySqlId sql : %s", sqlcode);
-		String countCode = "", countId = "";
-		BoundSql countSql = null;
-		/**
-		 * sql id 和 count id 用同一个
-		 */
-		if (StringUtils.isBlank(sqlId)) {
-			countCode = sqlcode;
-			countSql = boundSql;
-		} else {
-			countId = sqlId;
-
-			Map<String, Object> countMap = new HashMap<String, Object>();
-			countMap.putAll(params);
-			countMap.remove("page_sql");// 去掉,分页的参数。
-			countSql = c.getMappedStatement(countId).getBoundSql(countMap);
-			countCode = countSql.getSql();
-		}
-		try {
-			Connection conn = this.getSqlSession().getConnection();
-
-			List<?> resultList = this.getSqlSession().selectList(sqlId, params);
-			page.setList(resultList);
-			PreparedStatement ps = getPreparedStatement(countCode, countSql.getParameterMappings(), params, conn);
-			ps.execute();
-			ResultSet set = ps.getResultSet();
-
-			while (set.next()) {
-				page.setTotalCount(set.getInt(1));
-			}
-		} catch (Exception e) {
-			LoggerUtils.error(SELF, "jdbc.error.code.findByPageBySqlId", e);
-		}
-		return page;
-	}
-
-	/**
-	 * 根据Sql ID 查询List,而不要查询分页的页码
-	 * 
-	 * @param sqlId
-	 *            对应mapper.xml 里的Sql Id[主语句]
-	 * @param params
-	 *            参数<String,Object>
-	 * @param pageNo
-	 *            number
-	 * @param pageSize
-	 *            size
-	 * @return
-	 */
-	public List<?> findList(String sqlId, Map<String, Object> params, Integer pageNo, Integer pageSize) {
-		pageNo = null == pageNo ? 1 : pageNo;
-		pageSize = null == pageSize ? 10 : pageSize;
-
-		int offset = (pageNo - 1) * pageSize;
-		String page_sql = String.format(" limit %s , %s", offset, pageSize);
-		params.put("page_sql", page_sql);
-		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
-
-		List<?> resultList = this.getSqlSession().selectList(sqlId, params);
-		return resultList;
-	}
-
-	/**
-	 * 当Sql ID 是 default findAll的情况下。
-	 * 
-	 * @param params
-	 * @param pageNo
-	 * @param pageSize
-	 * @param requiredType
-	 *            返回的类型[可以不传参]
-	 * @return
-	 */
-	public List<?> findList(Map<String, Object> params, Integer pageNo, Integer pageSize) {
-		return findList(DEFAULT_SQL_ID, params, pageNo, pageSize);
-	}
-
-	/**
-	 * 分页
-	 * 
-	 * @param sqlId
-	 *            主语句
-	 * @param countId
-	 *            Count 语句
-	 * @param params
-	 *            参数
-	 * @param pageNo
-	 *            第几页
-	 * @param pageSize每页显示多少条
-	 * @param requiredType
-	 *            返回的类型[可以不传参]
-	 * @return
-	 */
-	public Pagination<?> findPage(String sqlId, String countId, Map<String, Object> params, Integer pageNo,
-			Integer pageSize) {
-		pageNo = null == pageNo ? 1 : pageNo;
-		pageSize = null == pageSize ? 10 : pageSize;
-		Pagination<?> page = new Pagination<Object>();
-		page.setPageNo(pageNo);
-		page.setPageSize(pageSize);
-		int offset = (page.getPageNo() - 1) * page.getPageSize();
-		String page_sql = String.format(" limit  %s , %s ", offset, pageSize);
-		params.put("page_sql", page_sql);
-
-		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
-
-		countId = String.format("%s.%s", NAMESPACE, countId);
-		
-		try {
-			List<?> resultList = this.getSqlSession().selectList(sqlId, params);
-
-			page.setList(resultList);
-
-			page.setTotalCount(this.getSqlSession().selectOne(countId, params));
-
-		} catch (Exception e) {
-			LoggerUtils.error(SELF, "jdbc.error.code.findByPageBySqlId", e);
-		}
-		return page;
-
-	}
-
-	/**
-	 * 重载减少参数DEFAULT_SQL_ID, "findCount"
-	 * 
-	 * @param params
-	 * @param pageNo
-	 * @param pageSize
-	 * @return
-	 */
-	public Pagination<?> findPage(Map<String, Object> params, Integer pageNo, Integer pageSize) {
-
-		return findPage(DEFAULT_SQL_ID, DEFAULT_COUNT_SQL_ID, params, pageNo, pageSize);
-	}
-
-	/**
-	 * 组装
-	 * 
-	 * @param sql
-	 * @param parameterMappingList
-	 * @param params
-	 * @param conn
-	 * @return
-	 * @throws SQLException
-	 */
-	private PreparedStatement getPreparedStatement(String sql, List<ParameterMapping> parameterMappingList,
-			Map<String, Object> params, Connection conn) throws SQLException {
-		/**
-		 * 分页根据数据库分页
-		 */
-		MysqlDialect o = new MysqlDialect();
-
-		PreparedStatement ps = conn.prepareStatement(o.getCountSqlString(sql));
-		int index = 1;
-		for (int i = 0; i < parameterMappingList.size(); i++) {
-			ps.setObject(index++, params.get(parameterMappingList.get(i).getProperty()));
-		}
-		return ps;
-	}
-
-	
-
-}
+package com.kede.core.mybatis;
+
+import java.lang.reflect.ParameterizedType;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ibatis.mapping.BoundSql;
+import org.apache.ibatis.mapping.ParameterMapping;
+import org.apache.ibatis.session.Configuration;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.support.SqlSessionDaoSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.kede.banners.bo.InputBannerDetails;
+import com.kede.banners.bo.OutBannerDetails;
+import com.kede.common.utils.LoggerUtils;
+import com.kede.core.mybatis.page.MysqlDialect;
+import com.kede.core.mybatis.page.Pagination;
+
+@SuppressWarnings({ "unchecked" })
+public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
+
+	private String NAMESPACE;
+	final static Class<? extends Object> SELF = BaseMybatisDao.class;
+	protected final Log logger = LogFactory.getLog(BaseMybatisDao.class);
+	/** 默认的查询Sql id */
+	final static String DEFAULT_SQL_ID = "findAll";
+	/** 默认的查询Count sql id **/
+	final static String DEFAULT_COUNT_SQL_ID = "findCount";
+
+	public BaseMybatisDao() {
+		try {
+			Object genericClz = getClass().getGenericSuperclass();
+			if (genericClz instanceof ParameterizedType) {
+				Class<T> entityClass = (Class<T>) ((ParameterizedType) genericClz).getActualTypeArguments()[0];
+				NAMESPACE = entityClass.getPackage().getName() + "." + entityClass.getSimpleName();
+			}
+		} catch (RuntimeException e) {
+			LoggerUtils.error(SELF, "初始化失败,继承BaseMybatisDao,没有泛型!");
+		}
+	}
+
+	@Autowired
+	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
+		super.setSqlSessionTemplate(sqlSessionTemplate);
+	}
+
+	/**
+	 * 根据Sql id 去查询 分页对象
+	 * 
+	 * @param sqlId
+	 *            对应mapper.xml 里的Sql Id
+	 * @param params
+	 *            参数<String,Object>
+	 * @param pageNo
+	 *            number
+	 * @param pageSize
+	 *            size
+	 * @return
+	 */
+	public Pagination<?> findByPageBySqlId(String sqlId, Map<String, Object> params, Integer pageNo, Integer pageSize) {
+
+		pageNo = null == pageNo ? 1 : pageNo;
+		pageSize = null == pageSize ? 10 : pageSize;
+
+		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
+
+		Pagination<?> page = new Pagination<Object>();
+		page.setPageNo(pageNo);
+		page.setPageSize(pageSize);
+		Configuration c = this.getSqlSession().getConfiguration();
+		int offset = (page.getPageNo() - 1) * page.getPageSize();
+		String page_sql = String.format(" limit %s , %s", offset, pageSize);
+		params.put("page_sql", page_sql);
+
+		BoundSql boundSql = c.getMappedStatement(sqlId).getBoundSql(params);
+		String sqlcode = boundSql.getSql();
+
+		LoggerUtils.debug(SELF, "findByPageBySqlId sql : %s", sqlcode);
+		String countCode = "", countId = "";
+		BoundSql countSql = null;
+		/**
+		 * sql id 和 count id 用同一个
+		 */
+		if (StringUtils.isBlank(sqlId)) {
+			countCode = sqlcode;
+			countSql = boundSql;
+		} else {
+			countId = sqlId;
+
+			Map<String, Object> countMap = new HashMap<String, Object>();
+			countMap.putAll(params);
+			countMap.remove("page_sql");// 去掉,分页的参数。
+			countSql = c.getMappedStatement(countId).getBoundSql(countMap);
+			countCode = countSql.getSql();
+		}
+		try {
+			Connection conn = this.getSqlSession().getConnection();
+
+			List<?> resultList = this.getSqlSession().selectList(sqlId, params);
+			page.setList(resultList);
+			PreparedStatement ps = getPreparedStatement(countCode, countSql.getParameterMappings(), params, conn);
+			ps.execute();
+			ResultSet set = ps.getResultSet();
+
+			while (set.next()) {
+				page.setTotalCount(set.getInt(1));
+			}
+		} catch (Exception e) {
+			LoggerUtils.error(SELF, "jdbc.error.code.findByPageBySqlId", e);
+		}
+		return page;
+	}
+
+	/**
+	 * 根据Sql ID 查询List,而不要查询分页的页码
+	 * 
+	 * @param sqlId
+	 *            对应mapper.xml 里的Sql Id[主语句]
+	 * @param params
+	 *            参数<String,Object>
+	 * @param pageNo
+	 *            number
+	 * @param pageSize
+	 *            size
+	 * @return
+	 */
+	public List<?> findList(String sqlId, Map<String, Object> params, Integer pageNo, Integer pageSize) {
+		pageNo = null == pageNo ? 1 : pageNo;
+		pageSize = null == pageSize ? 10 : pageSize;
+
+		int offset = (pageNo - 1) * pageSize;
+		String page_sql = String.format(" limit %s , %s", offset, pageSize);
+		params.put("page_sql", page_sql);
+		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
+
+		List<?> resultList = this.getSqlSession().selectList(sqlId, params);
+		return resultList;
+	}
+
+	/**
+	 * 当Sql ID 是 default findAll的情况下。
+	 * 
+	 * @param params
+	 * @param pageNo
+	 * @param pageSize
+	 * @param requiredType
+	 *            返回的类型[可以不传参]
+	 * @return
+	 */
+	public List<?> findList(Map<String, Object> params, Integer pageNo, Integer pageSize) {
+		return findList(DEFAULT_SQL_ID, params, pageNo, pageSize);
+	}
+
+	/**
+	 * 分页
+	 * 
+	 * @param sqlId
+	 *            主语句
+	 * @param countId
+	 *            Count 语句
+	 * @param params
+	 *            参数
+	 * @param pageNo
+	 *            第几页
+	 * @param pageSize每页显示多少条
+	 * @param requiredType
+	 *            返回的类型[可以不传参]
+	 * @return
+	 */
+	public Pagination<?> findPage(String sqlId, String countId, Map<String, Object> params, Integer pageNo,
+			Integer pageSize) {
+		pageNo = null == pageNo ? 1 : pageNo;
+		pageSize = null == pageSize ? 10 : pageSize;
+		Pagination<?> page = new Pagination<Object>();
+		page.setPageNo(pageNo);
+		page.setPageSize(pageSize);
+		int offset = (page.getPageNo() - 1) * page.getPageSize();
+		String page_sql = String.format(" limit  %s , %s ", offset, pageSize);
+		params.put("page_sql", page_sql);
+
+		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
+
+		countId = String.format("%s.%s", NAMESPACE, countId);
+		
+		try {
+			List<?> resultList = this.getSqlSession().selectList(sqlId, params);
+
+			page.setList(resultList);
+
+			page.setTotalCount(this.getSqlSession().selectOne(countId, params));
+
+		} catch (Exception e) {
+			LoggerUtils.error(SELF, "jdbc.error.code.findByPageBySqlId", e);
+		}
+		return page;
+
+	}
+
+	/**
+	 * 重载减少参数DEFAULT_SQL_ID, "findCount"
+	 * 
+	 * @param params
+	 * @param pageNo
+	 * @param pageSize
+	 * @return
+	 */
+	public Pagination<?> findPage(Map<String, Object> params, Integer pageNo, Integer pageSize) {
+
+		return findPage(DEFAULT_SQL_ID, DEFAULT_COUNT_SQL_ID, params, pageNo, pageSize);
+	}
+
+	/**
+	 * 组装
+	 * 
+	 * @param sql
+	 * @param parameterMappingList
+	 * @param params
+	 * @param conn
+	 * @return
+	 * @throws SQLException
+	 */
+	private PreparedStatement getPreparedStatement(String sql, List<ParameterMapping> parameterMappingList,
+			Map<String, Object> params, Connection conn) throws SQLException {
+		/**
+		 * 分页根据数据库分页
+		 */
+		MysqlDialect o = new MysqlDialect();
+
+		PreparedStatement ps = conn.prepareStatement(o.getCountSqlString(sql));
+		int index = 1;
+		for (int i = 0; i < parameterMappingList.size(); i++) {
+			ps.setObject(index++, params.get(parameterMappingList.get(i).getProperty()));
+		}
+		return ps;
+	}
+
+	
+
+	
+
+}