Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
17e6a32d
Commit
17e6a32d
authored
Apr 27, 2018
by
zhh
Browse files
添加商品查询、添加、修改功能
parent
edc71542
Changes
25
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/resources/dao/PmsProductVertifyRecordDao.xml
0 → 100644
View file @
17e6a32d
<?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.macro.mall.dao.PmsProductVertifyRecordDao"
>
<!--批量新增回写主键支持-->
<insert
id=
"insertList"
>
insert into pms_product_vertify_record (product_id, create_time, vertify_man,status, detail) values
<foreach
collection=
"list"
separator=
","
item=
"item"
index=
"index"
>
(#{item.productId,jdbcType=BIGINT},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.vertifyMan,jdbcType=VARCHAR},
#{item.status,jdbcType=INTEGER},
#{item.detail,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
\ No newline at end of file
mall-admin/src/test/com/macro/mall/PmsDaoTests.java
View file @
17e6a32d
...
...
@@ -2,13 +2,21 @@ package com.macro.mall;
import
com.macro.mall.dao.PmsMemberPriceDao
;
import
com.macro.mall.dao.PmsProductDao
;
import
com.macro.mall.dto.PmsProductResult
;
import
com.macro.mall.model.PmsMemberPrice
;
import
com.macro.mall.util.JsonUtil
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -18,7 +26,12 @@ import java.util.List;
public
class
PmsDaoTests
{
@Autowired
private
PmsMemberPriceDao
memberPriceDao
;
@Autowired
private
PmsProductDao
productDao
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PmsDaoTests
.
class
);
@Test
@Transactional
@Rollback
public
void
testInsertBatch
(){
List
<
PmsMemberPrice
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
5
;
i
++){
...
...
@@ -31,4 +44,11 @@ public class PmsDaoTests {
int
count
=
memberPriceDao
.
insertList
(
list
);
Assert
.
assertEquals
(
5
,
count
);
}
@Test
public
void
testGetProductUpdateInfo
(){
PmsProductResult
productResult
=
productDao
.
getUpdateInfo
(
7L
);
String
json
=
JsonUtil
.
objectToJson
(
productResult
);
LOGGER
.
info
(
json
);
}
}
mall-mbg/src/main/java/com/macro/mall/model/PmsProduct.java
View file @
17e6a32d
...
...
@@ -223,6 +223,20 @@ public class PmsProduct implements Serializable {
*/
private
Integer
promotionType
;
/**
* 品牌名称
*
* @mbggenerated
*/
private
String
brandName
;
/**
* 商品分类名称
*
* @mbggenerated
*/
private
String
productCategoryName
;
/**
* 商品描述
*
...
...
@@ -560,6 +574,22 @@ public class PmsProduct implements Serializable {
this
.
promotionType
=
promotionType
;
}
public
String
getBrandName
()
{
return
brandName
;
}
public
void
setBrandName
(
String
brandName
)
{
this
.
brandName
=
brandName
;
}
public
String
getProductCategoryName
()
{
return
productCategoryName
;
}
public
void
setProductCategoryName
(
String
productCategoryName
)
{
this
.
productCategoryName
=
productCategoryName
;
}
public
String
getDescription
()
{
return
description
;
}
...
...
@@ -637,6 +667,8 @@ public class PmsProduct implements Serializable {
sb
.
append
(
", promotionEndTime="
).
append
(
promotionEndTime
);
sb
.
append
(
", promotionPerLimit="
).
append
(
promotionPerLimit
);
sb
.
append
(
", promotionType="
).
append
(
promotionType
);
sb
.
append
(
", brandName="
).
append
(
brandName
);
sb
.
append
(
", productCategoryName="
).
append
(
productCategoryName
);
sb
.
append
(
", description="
).
append
(
description
);
sb
.
append
(
", detailDesc="
).
append
(
detailDesc
);
sb
.
append
(
", detailHtml="
).
append
(
detailHtml
);
...
...
mall-mbg/src/main/java/com/macro/mall/model/PmsProductExample.java
View file @
17e6a32d
...
...
@@ -2545,6 +2545,146 @@ public class PmsProductExample {
addCriterion
(
"promotion_type not between"
,
value1
,
value2
,
"promotionType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameIsNull
()
{
addCriterion
(
"brand_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameIsNotNull
()
{
addCriterion
(
"brand_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameEqualTo
(
String
value
)
{
addCriterion
(
"brand_name ="
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameNotEqualTo
(
String
value
)
{
addCriterion
(
"brand_name <>"
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameGreaterThan
(
String
value
)
{
addCriterion
(
"brand_name >"
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"brand_name >="
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameLessThan
(
String
value
)
{
addCriterion
(
"brand_name <"
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"brand_name <="
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameLike
(
String
value
)
{
addCriterion
(
"brand_name like"
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameNotLike
(
String
value
)
{
addCriterion
(
"brand_name not like"
,
value
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"brand_name in"
,
values
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"brand_name not in"
,
values
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"brand_name between"
,
value1
,
value2
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBrandNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"brand_name not between"
,
value1
,
value2
,
"brandName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameIsNull
()
{
addCriterion
(
"product_category_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameIsNotNull
()
{
addCriterion
(
"product_category_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameEqualTo
(
String
value
)
{
addCriterion
(
"product_category_name ="
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameNotEqualTo
(
String
value
)
{
addCriterion
(
"product_category_name <>"
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameGreaterThan
(
String
value
)
{
addCriterion
(
"product_category_name >"
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"product_category_name >="
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameLessThan
(
String
value
)
{
addCriterion
(
"product_category_name <"
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"product_category_name <="
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameLike
(
String
value
)
{
addCriterion
(
"product_category_name like"
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameNotLike
(
String
value
)
{
addCriterion
(
"product_category_name not like"
,
value
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"product_category_name in"
,
values
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"product_category_name not in"
,
values
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"product_category_name between"
,
value1
,
value2
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProductCategoryNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"product_category_name not between"
,
value1
,
value2
,
"productCategoryName"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
mall-mbg/src/main/resources/com/macro/mall/mapper/PmsProductMapper.xml
View file @
17e6a32d
...
...
@@ -41,6 +41,8 @@
<result
column=
"promotion_end_time"
jdbcType=
"TIMESTAMP"
property=
"promotionEndTime"
/>
<result
column=
"promotion_per_limit"
jdbcType=
"INTEGER"
property=
"promotionPerLimit"
/>
<result
column=
"promotion_type"
jdbcType=
"INTEGER"
property=
"promotionType"
/>
<result
column=
"brand_name"
jdbcType=
"VARCHAR"
property=
"brandName"
/>
<result
column=
"product_category_name"
jdbcType=
"VARCHAR"
property=
"productCategoryName"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"com.macro.mall.model.PmsProduct"
>
<result
column=
"description"
jdbcType=
"LONGVARCHAR"
property=
"description"
/>
...
...
@@ -113,7 +115,7 @@
use_point_limit, sub_title, original_price, stock, low_stock, unit, weight, preview_status,
service_ids, keywords, note, album_pics, detail_title, flash_promotion_price, flash_promotion_count,
flash_promotion_sort, promotion_start_time, promotion_end_time, promotion_per_limit,
promotion_type
promotion_type
, brand_name, product_category_name
</sql>
<sql
id=
"Blob_Column_List"
>
description, detail_desc, detail_html, detail_mobile_html
...
...
@@ -183,9 +185,9 @@
album_pics, detail_title, flash_promotion_price,
flash_promotion_count, flash_promotion_sort,
promotion_start_time, promotion_end_time,
promotion_per_limit, promotion_type,
description
,
detail_desc, detail_html, detail_mobile_html
)
promotion_per_limit, promotion_type,
brand_name
,
product_category_name, description, detail_desc,
detail_html, detail_mobile_html
)
values (#{brandId,jdbcType=BIGINT}, #{productCategoryId,jdbcType=BIGINT}, #{feightTemplateId,jdbcType=BIGINT},
#{productAttributeCategoryId,jdbcType=BIGINT}, #{flashPromotionId,jdbcType=INTEGER},
#{name,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR}, #{productSn,jdbcType=VARCHAR},
...
...
@@ -199,9 +201,9 @@
#{albumPics,jdbcType=VARCHAR}, #{detailTitle,jdbcType=VARCHAR}, #{flashPromotionPrice,jdbcType=DECIMAL},
#{flashPromotionCount,jdbcType=INTEGER}, #{flashPromotionSort,jdbcType=INTEGER},
#{promotionStartTime,jdbcType=TIMESTAMP}, #{promotionEndTime,jdbcType=TIMESTAMP},
#{promotionPerLimit,jdbcType=INTEGER}, #{promotionType,jdbcType=INTEGER}, #{
description
,jdbcType=
LONG
VARCHAR},
#{
detailDesc
,jdbcType=
LONG
VARCHAR}, #{de
tailHtml
,jdbcType=LONGVARCHAR}, #{detail
MobileHtml
,jdbcType=LONGVARCHAR}
)
#{promotionPerLimit,jdbcType=INTEGER}, #{promotionType,jdbcType=INTEGER}, #{
brandName
,jdbcType=VARCHAR},
#{
productCategoryName
,jdbcType=VARCHAR}, #{de
scription
,jdbcType=LONGVARCHAR}, #{detail
Desc
,jdbcType=LONGVARCHAR}
,
#{detailHtml,jdbcType=LONGVARCHAR}, #{detailMobileHtml,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.macro.mall.model.PmsProduct"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
...
@@ -323,6 +325,12 @@
<if
test=
"promotionType != null"
>
promotion_type,
</if>
<if
test=
"brandName != null"
>
brand_name,
</if>
<if
test=
"productCategoryName != null"
>
product_category_name,
</if>
<if
test=
"description != null"
>
description,
</if>
...
...
@@ -451,6 +459,12 @@
<if
test=
"promotionType != null"
>
#{promotionType,jdbcType=INTEGER},
</if>
<if
test=
"brandName != null"
>
#{brandName,jdbcType=VARCHAR},
</if>
<if
test=
"productCategoryName != null"
>
#{productCategoryName,jdbcType=VARCHAR},
</if>
<if
test=
"description != null"
>
#{description,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -591,6 +605,12 @@
<if
test=
"record.promotionType != null"
>
promotion_type = #{record.promotionType,jdbcType=INTEGER},
</if>
<if
test=
"record.brandName != null"
>
brand_name = #{record.brandName,jdbcType=VARCHAR},
</if>
<if
test=
"record.productCategoryName != null"
>
product_category_name = #{record.productCategoryName,jdbcType=VARCHAR},
</if>
<if
test=
"record.description != null"
>
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -649,6 +669,8 @@
promotion_end_time = #{record.promotionEndTime,jdbcType=TIMESTAMP},
promotion_per_limit = #{record.promotionPerLimit,jdbcType=INTEGER},
promotion_type = #{record.promotionType,jdbcType=INTEGER},
brand_name = #{record.brandName,jdbcType=VARCHAR},
product_category_name = #{record.productCategoryName,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
detail_desc = #{record.detailDesc,jdbcType=LONGVARCHAR},
detail_html = #{record.detailHtml,jdbcType=LONGVARCHAR},
...
...
@@ -697,7 +719,9 @@
promotion_start_time = #{record.promotionStartTime,jdbcType=TIMESTAMP},
promotion_end_time = #{record.promotionEndTime,jdbcType=TIMESTAMP},
promotion_per_limit = #{record.promotionPerLimit,jdbcType=INTEGER},
promotion_type = #{record.promotionType,jdbcType=INTEGER}
promotion_type = #{record.promotionType,jdbcType=INTEGER},
brand_name = #{record.brandName,jdbcType=VARCHAR},
product_category_name = #{record.productCategoryName,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -819,6 +843,12 @@
<if
test=
"promotionType != null"
>
promotion_type = #{promotionType,jdbcType=INTEGER},
</if>
<if
test=
"brandName != null"
>
brand_name = #{brandName,jdbcType=VARCHAR},
</if>
<if
test=
"productCategoryName != null"
>
product_category_name = #{productCategoryName,jdbcType=VARCHAR},
</if>
<if
test=
"description != null"
>
description = #{description,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -874,6 +904,8 @@
promotion_end_time = #{promotionEndTime,jdbcType=TIMESTAMP},
promotion_per_limit = #{promotionPerLimit,jdbcType=INTEGER},
promotion_type = #{promotionType,jdbcType=INTEGER},
brand_name = #{brandName,jdbcType=VARCHAR},
product_category_name = #{productCategoryName,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
detail_desc = #{detailDesc,jdbcType=LONGVARCHAR},
detail_html = #{detailHtml,jdbcType=LONGVARCHAR},
...
...
@@ -919,7 +951,9 @@
promotion_start_time = #{promotionStartTime,jdbcType=TIMESTAMP},
promotion_end_time = #{promotionEndTime,jdbcType=TIMESTAMP},
promotion_per_limit = #{promotionPerLimit,jdbcType=INTEGER},
promotion_type = #{promotionType,jdbcType=INTEGER}
promotion_type = #{promotionType,jdbcType=INTEGER},
brand_name = #{brandName,jdbcType=VARCHAR},
product_category_name = #{productCategoryName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment