You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
6.2 KiB
118 lines
6.2 KiB
package com.hfkj.dao;
|
|
|
|
import com.hfkj.entity.GoodsMsg;
|
|
import com.hfkj.entity.GoodsSpecs;
|
|
import com.hfkj.entity.SecDictionary;
|
|
import com.hfkj.model.goods.JdGoodsModel;
|
|
import com.hfkj.model.order.OrderCouponModel;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* mapper扩展类
|
|
*/
|
|
public interface GoodsMsgMapperExt {
|
|
|
|
|
|
@Select("<script>" +
|
|
" SELECT" +
|
|
" a.goods_type_parent_name as goodsTypeParentName," +
|
|
" a.goods_type_name as goodsTypeName," +
|
|
" a.goods_brand_name as goodsBrandName," +
|
|
" a.title as title," +
|
|
" b.id as id," +
|
|
" b.ext_3 as costPrice," +
|
|
" a.list_img as listImg," +
|
|
" b.sale_price as salePrice, " +
|
|
" b.third_price as thirdPrice," +
|
|
" b.original_price as originalPrice," +
|
|
" a.third_id as thirdId" +
|
|
" FROM" +
|
|
" goods_msg a join goods_specs b on a.id = b.goods_id where a.type = 1 and a.child_type=1 and a.status = 1" +
|
|
" <if test='param.goodsTypeParent != null'> and a.goods_type_parent = #{param.goodsTypeParent} </if>" +
|
|
" <if test='param.title != null'> and a.title like concat('%',#{param.title},'%') </if>" +
|
|
" <if test='param.goodsType != null'> and a.goods_type = #{param.goodsType} </if>" +
|
|
" <if test='param.id != null'> and b.id = #{param.id} </if>" +
|
|
" <if test='param.goodsBrand != null'> and a.goods_brand = #{param.goodsBrand} </if>" +
|
|
" <if test='param.salePriceS != null'><![CDATA[ and b.sale_price >= #{param.salePriceS} ]]></if>" +
|
|
" <if test='param.salePriceE != null'><![CDATA[ and b.sale_price <= #{param.salePriceE} ]]></if>" +
|
|
" ORDER BY b.sale_price asc" +
|
|
"</script>")
|
|
List<JdGoodsModel> getJdGoodsList(@Param("param") Map<String,Object> param);
|
|
|
|
// @Select("<script>" +
|
|
// " SELECT" +
|
|
// " id ," +
|
|
// " title as title," +
|
|
// " list_img as listImg," +
|
|
// " third_id as thirdId," +
|
|
// " sale_num as saleNum" +
|
|
// " FROM" +
|
|
// " goods_msg where status = 1" +
|
|
// " <if test='param.goodsTypeParent != null'> and goods_type_parent = #{param.goodsTypeParent} </if>" +
|
|
// " <if test='param.title != null'> and title like concat('%',#{param.title},'%') </if>" +
|
|
// " <if test='param.goodsType != null'> and goods_type = #{param.goodsType} </if>" +
|
|
// " <if test='param.showType != null'> and show_type = #{param.showType} </if>" +
|
|
// " <if test='param.goodsBrand != null'> and goods_brand = #{param.goodsBrand} </if>" +
|
|
// " <if test='param.time != 1'>ORDER BY update_time desc</if>" +
|
|
// " <if test='param.time == 1'>ORDER BY create_time desc</if>" +
|
|
// " <if test='param.saleNum == 2'>, sale_num desc</if>" +
|
|
// " <if test='param.limit != null'>limit #{param.limit}</if>" +
|
|
// "</script>")
|
|
// List<GoodsMsg> getGoodsListCrest(@Param("param") Map<String,Object> param);
|
|
|
|
@Select("<script>" +
|
|
" SELECT * from (" +
|
|
" SELECT" +
|
|
" a.goods_type_parent_name as goodsTypeParentName," +
|
|
" a.goods_type_name as goodsTypeName," +
|
|
" a.goods_brand_name as goodsBrandName," +
|
|
" a.title as title," +
|
|
" a.list_img as listImg," +
|
|
" a.sort as sort," +
|
|
" a.automatic_code as automaticCode," +
|
|
" a.sale_num as saleNum," +
|
|
" b.third_price as thirdPrice," +
|
|
" b.original_price as originalPrice," +
|
|
" a.third_id as thirdId," +
|
|
" b.id as specsId ," +
|
|
" a.id as id," +
|
|
" MIN(b.sale_price) as salePrice , " +
|
|
" MIN(b.sale_price) as price , " +
|
|
"a.create_time as createtime ," +
|
|
"a.update_time as updateTime" +
|
|
" FROM" +
|
|
" goods_msg a join goods_specs b on a.id = b.goods_id where a.status = 1" +
|
|
" <if test='param.goodsTypeParent != null'> and a.goods_type_parent = #{param.goodsTypeParent} </if>" +
|
|
" <if test='param.title != null'> and a.title like concat('%',#{param.title},'%') </if>" +
|
|
" <if test='param.goodsType != null'> and a.goods_type = #{param.goodsType} </if>" +
|
|
" <if test='param.showType != null'> and a.show_type = #{param.showType} </if>" +
|
|
" <if test='param.type != null'> and a.third_id is not null </if>" +
|
|
" <if test='param.automatic != null'> and a.automatic_code is null </if>" +
|
|
" <if test='param.automaticCode != null'> and a.automatic_code = #{param.automaticCode} </if>" +
|
|
" <if test='param.specsId != null'> and b.id in <foreach collection='param.specsId' item='item' index='index' open='(' separator=',' close=')'>#{item}</foreach> </if>" +
|
|
" <if test='param.goodsBrand != null'> and a.goods_brand = #{param.goodsBrand} </if>" +
|
|
" <if test='param.salePriceS != null'><![CDATA[ and b.sale_price >= #{param.salePriceS} ]]></if>" +
|
|
" <if test='param.salePriceE != null'><![CDATA[ and b.sale_price <= #{param.salePriceE} ]]></if>" +
|
|
" group by a.id) c" +
|
|
" <if test='param.time == 1'>ORDER BY c.sort asc , c.id</if>" +
|
|
" <if test='param.time == 2'>ORDER BY c.sort asc , c.id</if>" +
|
|
" <if test='param.price == 1'>ORDER BY c.salePrice asc , c.id</if>" +
|
|
" <if test='param.price == 2'>ORDER BY c.salePrice desc , c.id</if>" +
|
|
" <if test='param.saleNum == 2'>ORDER BY c.saleNum desc , c.id</if>" +
|
|
" <if test='param.sort == 2'>ORDER BY c.sort asc , c.id</if>" +
|
|
" <if test='param.rand == 1'>ORDER BY rand()</if>" +
|
|
" <if test='param.limit != null'>limit #{param.limit}</if>" +
|
|
"</script>")
|
|
List<JdGoodsModel> getGoodsListCrest(@Param("param") Map<String,Object> param);
|
|
|
|
|
|
@Update({
|
|
"update goods_msg set automatic_code = null where automatic_code is not null",
|
|
})
|
|
void updateAutomatic();
|
|
} |