From 81a17f6b2d3a51b0283d815e92f85bafa53f9015 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 03 九月 2019 10:48:39 +0800
Subject: [PATCH] 分类排序  +   金币领取评率限制

---
 fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSubClassMapper.xml |  467 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 233 insertions(+), 234 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSubClassMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSubClassMapper.xml
index 8a02a5a..baa5ce9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSubClassMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSubClassMapper.xml
@@ -1,234 +1,233 @@
-<?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.yeshi.fanli.dao.mybatis.GoodsSubClassMapper">
-	<resultMap id="BaseResultMap"
-		type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
-		<id column="sub_id" property="id" jdbcType="BIGINT" />
-		<result column="sub_name" property="name" jdbcType="VARCHAR" />
-		<result column="sub_picture" property="picture" jdbcType="VARCHAR" />
-		<result column="sub_picture_second" property="pictureSecond"
-			jdbcType="VARCHAR" />
-		<result column="sub_weight" property="weight" jdbcType="INTEGER" />
-		<result column="sub_level" property="level" jdbcType="INTEGER" />
-		<result column="sub_state" property="state" jdbcType="INTEGER" />
-		<result column="sub_key" property="key" jdbcType="VARCHAR" />
-		<result column="sub_search_json" property="searchJson"
-			jdbcType="VARCHAR" />
-		<result column="sub_ios_click" property="iosClick" jdbcType="BIGINT" />
-		<result column="sub_android_click" property="androidClick"
-			jdbcType="BIGINT" />
-		<result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" />
-		<result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
-		<result column="sub_sex" property="sex" jdbcType="INTEGER" />
-		<result column="sub_month" property="month" jdbcType="VARCHAR" />
-		<association property="rootClass" column="sub_root_id"
-			select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey" />
-		<association property="parent" column="sub_pid"
-			select="com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper.selectByPrimaryKey" />
-
-	</resultMap>
-	<resultMap id="SimpleResultMap"
-		type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
-		<id column="sub_id" property="id" jdbcType="BIGINT" />
-		<result column="sub_name" property="name" jdbcType="VARCHAR" />
-		<result column="sub_picture" property="picture" jdbcType="VARCHAR" />
-		<result column="sub_picture_second" property="pictureSecond"
-			jdbcType="VARCHAR" />
-		<result column="sub_weight" property="weight" jdbcType="INTEGER" />
-		<result column="sub_level" property="level" jdbcType="INTEGER" />
-		<result column="sub_state" property="state" jdbcType="INTEGER" />
-		<result column="sub_key" property="key" jdbcType="VARCHAR" />
-		<result column="sub_search_json" property="searchJson"
-			jdbcType="VARCHAR" />
-		<result column="sub_ios_click" property="iosClick" jdbcType="BIGINT" />
-		<result column="sub_android_click" property="androidClick"
-			jdbcType="BIGINT" />
-		<result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" />
-		<result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
-		<result column="sub_sex" property="sex" jdbcType="INTEGER" />
-		<result column="sub_month" property="month" jdbcType="VARCHAR" />
-		<association property="rootClass" column="sub_root_id"
-			javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
-			<id column="sub_root_id" property="id" jdbcType="BIGINT" />
-		</association>
-		<association property="parent" column="sub_pid"
-			javaType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
-			<id column="sub_pid" property="id" jdbcType="BIGINT" />
-		</association>
-	</resultMap>
-	<sql id="Base_Column_List">sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month
-	</sql>
-	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
-		parameterType="java.lang.Long">
-		select
-		<include refid="Base_Column_List" />
-		from yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT}
-	</select>
-	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
-		yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT}
-	</delete>
-	<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"
-		useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_sub_class
-		(sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month)
-		values
-		(#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureSecond,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{rootClass.id,jdbcType=BIGINT},#{parent.id,jdbcType=BIGINT},#{level,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{key,jdbcType=VARCHAR},#{searchJson,jdbcType=VARCHAR},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{month,jdbcType=VARCHAR})
-	</insert>
-	<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"
-		useGeneratedKeys="true" keyProperty="id">
-		insert into yeshi_ec_sub_class
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="id != null">sub_id,</if>
-			<if test="name != null">sub_name,</if>
-			<if test="picture != null">sub_picture,</if>
-			<if test="pictureSecond != null">sub_picture_second,</if>
-			<if test="weight != null">sub_weight,</if>
-			<if test="rootClass != null">sub_root_id,</if>
-			<if test="parent != null">sub_pid,</if>
-			<if test="level != null">sub_level,</if>
-			<if test="state != null">sub_state,</if>
-			<if test="key != null">sub_key,</if>
-			<if test="searchJson != null">sub_search_json,</if>
-			<if test="iosClick != null">sub_ios_click,</if>
-			<if test="androidClick != null">sub_android_click,</if>
-			<if test="createtime != null">sub_createtime,</if>
-			<if test="updatetime != null">sub_updatetime,</if>
-			<if test="sex != null">sub_sex,</if>
-			<if test="month != null">sub_month,</if>
-		</trim>
-		values
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="id != null">#{id,jdbcType=BIGINT},</if>
-			<if test="name != null">#{name,jdbcType=VARCHAR},</if>
-			<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
-			<if test="pictureSecond != null">#{pictureSecond,jdbcType=VARCHAR},</if>
-			<if test="weight != null">#{weight,jdbcType=INTEGER},</if>
-			<if test="rootClass != null">#{rootClass.id,jdbcType=BIGINT},</if>
-			<if test="parent != null">#{parent.id,jdbcType=BIGINT},</if>
-			<if test="level != null">#{level,jdbcType=INTEGER},</if>
-			<if test="state != null">#{state,jdbcType=INTEGER},</if>
-			<if test="key != null">#{key,jdbcType=VARCHAR},</if>
-			<if test="searchJson != null">#{searchJson,jdbcType=VARCHAR},</if>
-			<if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if>
-			<if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if>
-			<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
-			<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
-			<if test="sex != null">#{sex,jdbcType=INTEGER},</if>
-			<if test="month != null">#{month,jdbcType=VARCHAR}</if>
-		</trim>
-	</insert>
-	<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">update
-		yeshi_ec_sub_class set sub_name = #{name,jdbcType=VARCHAR},sub_picture
-		= #{picture,jdbcType=VARCHAR},sub_picture_second =
-		#{pictureSecond,jdbcType=VARCHAR},sub_weight =
-		#{weight,jdbcType=INTEGER},sub_root_id =
-		#{rootClass.id,jdbcType=BIGINT},sub_pid =
-		#{parent.id,jdbcType=BIGINT},sub_level =
-		#{level,jdbcType=INTEGER},sub_state = #{state,jdbcType=INTEGER},
-		sub_key = #{key,jdbcType=VARCHAR},sub_search_json =
-		#{searchJson,jdbcType=VARCHAR},sub_ios_click =
-		#{iosClick,jdbcType=BIGINT},sub_android_click =
-		#{androidClick,jdbcType=BIGINT},sub_createtime =
-		#{createtime,jdbcType=TIMESTAMP},sub_updatetime =
-		#{updatetime,jdbcType=TIMESTAMP} ,sub_sex =#{sex,jdbcType=INTEGER}
-		,sub_month =#{month,jdbcType=VARCHAR} where sub_id =
-		#{id,jdbcType=BIGINT}
-	</update>
-	<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
-		update yeshi_ec_sub_class
-		<set>
-			<if test="name != null">sub_name=#{name,jdbcType=VARCHAR},</if>
-			<if test="picture != null">sub_picture=#{picture,jdbcType=VARCHAR},</if>
-			<if test="pictureSecond != null">sub_picture_second=#{pictureSecond,jdbcType=VARCHAR},
-			</if>
-			<if test="weight != null">sub_weight=#{weight,jdbcType=INTEGER},</if>
-			<if test="rootClass != null">sub_root_id=#{rootClass.id,jdbcType=BIGINT},</if>
-			<if test="parent != null">sub_pid=#{parent.id,jdbcType=BIGINT},</if>
-			<if test="level != null">sub_level=#{level,jdbcType=INTEGER},</if>
-			<if test="level != null">sub_state=#{state,jdbcType=INTEGER},</if>
-			<if test="key != null">sub_key=#{key,jdbcType=VARCHAR},</if>
-			<if test="searchJson != null">sub_search_json=#{searchJson,jdbcType=VARCHAR},</if>
-			<if test="iosClick != null">sub_ios_click=#{iosClick,jdbcType=BIGINT},</if>
-			<if test="androidClick != null">sub_android_click=#{androidClick,jdbcType=BIGINT},</if>
-			<if test="createtime != null">sub_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
-			<if test="updatetime != null">sub_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
-			<if test="sex !=null">sub_sex =#{sex,jdbcType=INTEGER},</if>
-			<if test="month !=null">sub_month =#{month,jdbcType=VARCHAR},</if>
-		</set>
-		where sub_id = #{id,jdbcType=BIGINT}
-	</update>
-	<select id="queryByRootId" resultMap="BaseResultMap">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_sub_class 
-		LEFT JOIN `yeshi_ec_sub_class_label_map` m ON m.`sclm_sub_class_id`=sub_id LEFT JOIN `yeshi_ec_sub_class_label`  l ON l.`scl_id`=m.`sclm_label_id`
-		WHERE sub_root_id = #{rootId} 
-		<if test="month != null">
-		 AND (
-	      (sub_month is null)
-	      or
-		  FIND_IN_SET(#{month},sub_month)
-		  )
-		</if>
-		
-		<if test="state != null">AND sub_state = #{state}</if>
-         ORDER BY l.`scl_order_by`,sub_weight
-	</select>
-	<select id="queryByPid" resultMap="BaseResultMap">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_sub_class WHERE sub_pid = #{pid}
-		<if test="state != null">and sub_state = #{state}</if>
-		ORDER BY sub_weight,sub_updatetime
-	</select>
-	<select id="queryByRootIdAndWeight" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_sub_class WHERE sub_root_id = ${rootId}
-		<if test="type == -1"> <![CDATA[and sub_weight < #{weight} ]]>
-			order by sub_weight desc
-		</if>
-		<if test="type == 1"> <![CDATA[and sub_weight > #{weight} ]]>
-			order by sub_weight
-		</if>
-	</select>
-	<select id="queryByPidAndWeight" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_sub_class WHERE sub_pid = ${pid}
-		<if test="type == -1"> <![CDATA[and sub_weight < #{weight} ]]>
-			order by sub_weight desc
-		</if>
-		<if test="type == 1"> <![CDATA[and sub_weight > #{weight} ]]>
-			order by sub_weight
-		</if>
-	</select>
-	<select id="countByRootId" resultType="java.lang.Integer">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT count(sub_id) FROM yeshi_ec_sub_class WHERE sub_root_id =
-		${rootId}
-	</select>
-	<select id="countByPid" resultType="java.lang.Integer">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT count(sub_id) FROM yeshi_ec_sub_class WHERE sub_pid = ${pid}
-	</select>
-	<select id="getMaxWeightByRootId" resultType="java.lang.Integer">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT IFNULL(MAX(c.`sub_weight`),0) FROM `yeshi_ec_sub_class` c WHERE
-		c.`sub_root_id` = ${rootId}
-	</select>
-	<select id="getMaxWeightByPid" resultType="java.lang.Integer">
-		<!-- 鏉′欢浜岀骇绫诲埆 -->
-		SELECT IFNULL(MAX(c.`sub_weight`),0) FROM `yeshi_ec_sub_class` c WHERE
-		c.`sub_root_id` = ${rootId}
-	</select>
-	<select id="queryByListCid" resultMap="SimpleResultMap">
-		SELECT * FROM yeshi_ec_sub_class WHERE sub_state = 1 AND sub_root_id
-		in
-		<foreach collection="list" index="index" item="item"
-			separator="," open="(" close=")">${item}</foreach>
-		ORDER BY sub_weight
-	</select>
-</mapper>
+<?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.yeshi.fanli.dao.mybatis.GoodsSubClassMapper">
+	<resultMap id="BaseResultMap"
+		type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
+		<id column="sub_id" property="id" jdbcType="BIGINT" />
+		<result column="sub_name" property="name" jdbcType="VARCHAR" />
+		<result column="sub_picture" property="picture" jdbcType="VARCHAR" />
+		<result column="sub_picture_second" property="pictureSecond"
+			jdbcType="VARCHAR" />
+		<result column="sub_weight" property="weight" jdbcType="INTEGER" />
+		<result column="sub_level" property="level" jdbcType="INTEGER" />
+		<result column="sub_state" property="state" jdbcType="INTEGER" />
+		<result column="sub_key" property="key" jdbcType="VARCHAR" />
+		<result column="sub_search_json" property="searchJson"
+			jdbcType="VARCHAR" />
+		<result column="sub_ios_click" property="iosClick" jdbcType="BIGINT" />
+		<result column="sub_android_click" property="androidClick"
+			jdbcType="BIGINT" />
+		<result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" />
+		<result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+		<result column="sub_sex" property="sex" jdbcType="INTEGER" />
+		<result column="sub_month" property="month" jdbcType="VARCHAR" />
+		<association property="rootClass" column="sub_root_id"
+			select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey" />
+		<association property="parent" column="sub_pid"
+			select="com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper.selectByPrimaryKey" />
+
+	</resultMap>
+	<resultMap id="SimpleResultMap"
+		type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
+		<id column="sub_id" property="id" jdbcType="BIGINT" />
+		<result column="sub_name" property="name" jdbcType="VARCHAR" />
+		<result column="sub_picture" property="picture" jdbcType="VARCHAR" />
+		<result column="sub_picture_second" property="pictureSecond"
+			jdbcType="VARCHAR" />
+		<result column="sub_weight" property="weight" jdbcType="INTEGER" />
+		<result column="sub_level" property="level" jdbcType="INTEGER" />
+		<result column="sub_state" property="state" jdbcType="INTEGER" />
+		<result column="sub_key" property="key" jdbcType="VARCHAR" />
+		<result column="sub_search_json" property="searchJson"
+			jdbcType="VARCHAR" />
+		<result column="sub_ios_click" property="iosClick" jdbcType="BIGINT" />
+		<result column="sub_android_click" property="androidClick"
+			jdbcType="BIGINT" />
+		<result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" />
+		<result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+		<result column="sub_sex" property="sex" jdbcType="INTEGER" />
+		<result column="sub_month" property="month" jdbcType="VARCHAR" />
+		<association property="rootClass" column="sub_root_id"
+			javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
+			<id column="sub_root_id" property="id" jdbcType="BIGINT" />
+		</association>
+		<association property="parent" column="sub_pid"
+			javaType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
+			<id column="sub_pid" property="id" jdbcType="BIGINT" />
+		</association>
+	</resultMap>
+	<sql id="Base_Column_List">sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month
+	</sql>
+	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
+		parameterType="java.lang.Long">
+		select
+		<include refid="Base_Column_List" />
+		from yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT}
+	</select>
+	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
+		yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT}
+	</delete>
+	<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"
+		useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_sub_class
+		(sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month)
+		values
+		(#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureSecond,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{rootClass.id,jdbcType=BIGINT},#{parent.id,jdbcType=BIGINT},#{level,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{key,jdbcType=VARCHAR},#{searchJson,jdbcType=VARCHAR},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{month,jdbcType=VARCHAR})
+	</insert>
+	<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"
+		useGeneratedKeys="true" keyProperty="id">
+		insert into yeshi_ec_sub_class
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null">sub_id,</if>
+			<if test="name != null">sub_name,</if>
+			<if test="picture != null">sub_picture,</if>
+			<if test="pictureSecond != null">sub_picture_second,</if>
+			<if test="weight != null">sub_weight,</if>
+			<if test="rootClass != null">sub_root_id,</if>
+			<if test="parent != null">sub_pid,</if>
+			<if test="level != null">sub_level,</if>
+			<if test="state != null">sub_state,</if>
+			<if test="key != null">sub_key,</if>
+			<if test="searchJson != null">sub_search_json,</if>
+			<if test="iosClick != null">sub_ios_click,</if>
+			<if test="androidClick != null">sub_android_click,</if>
+			<if test="createtime != null">sub_createtime,</if>
+			<if test="updatetime != null">sub_updatetime,</if>
+			<if test="sex != null">sub_sex,</if>
+			<if test="month != null">sub_month,</if>
+		</trim>
+		values
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null">#{id,jdbcType=BIGINT},</if>
+			<if test="name != null">#{name,jdbcType=VARCHAR},</if>
+			<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
+			<if test="pictureSecond != null">#{pictureSecond,jdbcType=VARCHAR},</if>
+			<if test="weight != null">#{weight,jdbcType=INTEGER},</if>
+			<if test="rootClass != null">#{rootClass.id,jdbcType=BIGINT},</if>
+			<if test="parent != null">#{parent.id,jdbcType=BIGINT},</if>
+			<if test="level != null">#{level,jdbcType=INTEGER},</if>
+			<if test="state != null">#{state,jdbcType=INTEGER},</if>
+			<if test="key != null">#{key,jdbcType=VARCHAR},</if>
+			<if test="searchJson != null">#{searchJson,jdbcType=VARCHAR},</if>
+			<if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if>
+			<if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if>
+			<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
+			<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
+			<if test="sex != null">#{sex,jdbcType=INTEGER},</if>
+			<if test="month != null">#{month,jdbcType=VARCHAR}</if>
+		</trim>
+	</insert>
+	<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">update
+		yeshi_ec_sub_class set sub_name = #{name,jdbcType=VARCHAR},sub_picture
+		= #{picture,jdbcType=VARCHAR},sub_picture_second =
+		#{pictureSecond,jdbcType=VARCHAR},sub_weight =
+		#{weight,jdbcType=INTEGER},sub_root_id =
+		#{rootClass.id,jdbcType=BIGINT},sub_pid =
+		#{parent.id,jdbcType=BIGINT},sub_level =
+		#{level,jdbcType=INTEGER},sub_state = #{state,jdbcType=INTEGER},
+		sub_key = #{key,jdbcType=VARCHAR},sub_search_json =
+		#{searchJson,jdbcType=VARCHAR},sub_ios_click =
+		#{iosClick,jdbcType=BIGINT},sub_android_click =
+		#{androidClick,jdbcType=BIGINT},sub_createtime =
+		#{createtime,jdbcType=TIMESTAMP},sub_updatetime =
+		#{updatetime,jdbcType=TIMESTAMP} ,sub_sex =#{sex,jdbcType=INTEGER}
+		,sub_month =#{month,jdbcType=VARCHAR} where sub_id =
+		#{id,jdbcType=BIGINT}
+	</update>
+	<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">
+		update yeshi_ec_sub_class
+		<set>
+			<if test="name != null">sub_name=#{name,jdbcType=VARCHAR},</if>
+			<if test="picture != null">sub_picture=#{picture,jdbcType=VARCHAR},</if>
+			<if test="pictureSecond != null">sub_picture_second=#{pictureSecond,jdbcType=VARCHAR},
+			</if>
+			<if test="weight != null">sub_weight=#{weight,jdbcType=INTEGER},</if>
+			<if test="rootClass != null">sub_root_id=#{rootClass.id,jdbcType=BIGINT},</if>
+			<if test="parent != null">sub_pid=#{parent.id,jdbcType=BIGINT},</if>
+			<if test="level != null">sub_level=#{level,jdbcType=INTEGER},</if>
+			<if test="level != null">sub_state=#{state,jdbcType=INTEGER},</if>
+			<if test="key != null">sub_key=#{key,jdbcType=VARCHAR},</if>
+			<if test="searchJson != null">sub_search_json=#{searchJson,jdbcType=VARCHAR},</if>
+			<if test="iosClick != null">sub_ios_click=#{iosClick,jdbcType=BIGINT},</if>
+			<if test="androidClick != null">sub_android_click=#{androidClick,jdbcType=BIGINT},</if>
+			<if test="createtime != null">sub_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
+			<if test="updatetime != null">sub_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
+			<if test="sex !=null">sub_sex =#{sex,jdbcType=INTEGER},</if>
+			<if test="month !=null">sub_month =#{month,jdbcType=VARCHAR},</if>
+		</set>
+		where sub_id = #{id,jdbcType=BIGINT}
+	</update>
+	<select id="queryByRootId" resultMap="BaseResultMap">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_sub_class 
+		LEFT JOIN `yeshi_ec_sub_class_label_map` m ON m.`sclm_sub_class_id`=sub_id LEFT JOIN `yeshi_ec_sub_class_label`  l ON l.`scl_id`=m.`sclm_label_id`
+		WHERE sub_root_id = #{rootId} 
+		<if test="month != null">
+		 AND (
+	      (sub_month is null)
+	      or
+		  FIND_IN_SET(#{month},sub_month)
+		  )
+		</if>
+		<if test="state != null">AND sub_state = #{state}</if>
+        ORDER BY l.`scl_order_by`,m.`sclm_order_by`
+	</select>
+	<select id="queryByPid" resultMap="BaseResultMap">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_sub_class WHERE sub_pid = #{pid}
+		<if test="state != null">and sub_state = #{state}</if>
+		ORDER BY sub_weight,sub_updatetime
+	</select>
+	<select id="queryByRootIdAndWeight" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_sub_class WHERE sub_root_id = ${rootId}
+		<if test="type == -1"> <![CDATA[and sub_weight < #{weight} ]]>
+			order by sub_weight desc
+		</if>
+		<if test="type == 1"> <![CDATA[and sub_weight > #{weight} ]]>
+			order by sub_weight
+		</if>
+	</select>
+	<select id="queryByPidAndWeight" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_sub_class WHERE sub_pid = ${pid}
+		<if test="type == -1"> <![CDATA[and sub_weight < #{weight} ]]>
+			order by sub_weight desc
+		</if>
+		<if test="type == 1"> <![CDATA[and sub_weight > #{weight} ]]>
+			order by sub_weight
+		</if>
+	</select>
+	<select id="countByRootId" resultType="java.lang.Integer">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT count(sub_id) FROM yeshi_ec_sub_class WHERE sub_root_id =
+		${rootId}
+	</select>
+	<select id="countByPid" resultType="java.lang.Integer">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT count(sub_id) FROM yeshi_ec_sub_class WHERE sub_pid = ${pid}
+	</select>
+	<select id="getMaxWeightByRootId" resultType="java.lang.Integer">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT IFNULL(MAX(c.`sub_weight`),0) FROM `yeshi_ec_sub_class` c WHERE
+		c.`sub_root_id` = ${rootId}
+	</select>
+	<select id="getMaxWeightByPid" resultType="java.lang.Integer">
+		<!-- 鏉′欢浜岀骇绫诲埆 -->
+		SELECT IFNULL(MAX(c.`sub_weight`),0) FROM `yeshi_ec_sub_class` c WHERE
+		c.`sub_root_id` = ${rootId}
+	</select>
+	<select id="queryByListCid" resultMap="SimpleResultMap">
+		SELECT * FROM yeshi_ec_sub_class WHERE sub_state = 1 AND sub_root_id
+		in
+		<foreach collection="list" index="index" item="item"
+			separator="," open="(" close=")">${item}</foreach>
+		ORDER BY sub_weight
+	</select>
+</mapper>

--
Gitblit v1.8.0