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
06532781
Commit
06532781
authored
Nov 13, 2018
by
zhh
Browse files
查询专题接口添加
parent
51f1271c
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
document/pdm/mall.pdb
View file @
06532781
This diff is collapsed.
Click to expand it.
document/pdm/mall.pdm
View file @
06532781
This diff is collapsed.
Click to expand it.
mall-admin/src/main/java/com/macro/mall/controller/CmsSubjectController.java
View file @
06532781
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
...
...
@@ -31,4 +32,14 @@ public class CmsSubjectController {
List
<
CmsSubject
>
subjectList
=
subjectService
.
listAll
();
return
new
CommonResult
().
success
(
subjectList
);
}
@ApiOperation
(
value
=
"根据专题名称分页获取专题"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
List
<
CmsSubject
>
subjectList
=
subjectService
.
list
(
keyword
,
pageNum
,
pageSize
);
return
new
CommonResult
().
pageSuccess
(
subjectList
);
}
}
mall-admin/src/main/java/com/macro/mall/service/CmsSubjectService.java
View file @
06532781
...
...
@@ -9,5 +9,13 @@ import java.util.List;
* Created by macro on 2018/6/1.
*/
public
interface
CmsSubjectService
{
/**
* 查询所有专题
*/
List
<
CmsSubject
>
listAll
();
/**
* 分页查询专题
*/
List
<
CmsSubject
>
list
(
String
keyword
,
Integer
pageNum
,
Integer
pageSize
);
}
mall-admin/src/main/java/com/macro/mall/service/impl/CmsSubjectServiceImpl.java
View file @
06532781
package
com.macro.mall.service.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.macro.mall.mapper.CmsSubjectMapper
;
import
com.macro.mall.model.CmsSubject
;
import
com.macro.mall.model.CmsSubjectExample
;
import
com.macro.mall.service.CmsSubjectService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -22,4 +24,15 @@ public class CmsSubjectServiceImpl implements CmsSubjectService {
public
List
<
CmsSubject
>
listAll
()
{
return
subjectMapper
.
selectByExample
(
new
CmsSubjectExample
());
}
@Override
public
List
<
CmsSubject
>
list
(
String
keyword
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
CmsSubjectExample
example
=
new
CmsSubjectExample
();
CmsSubjectExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
criteria
.
andTitleLike
(
"%"
+
keyword
+
"%"
);
}
return
subjectMapper
.
selectByExample
(
example
);
}
}
mall-mbg/src/main/java/com/macro/mall/model/CmsSubject.java
View file @
06532781
...
...
@@ -57,6 +57,13 @@ public class CmsSubject implements Serializable {
*/
private
Integer
forwardCount
;
/**
* 专题分类名称
*
* @mbggenerated
*/
private
String
categoryName
;
private
String
content
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -173,6 +180,14 @@ public class CmsSubject implements Serializable {
this
.
forwardCount
=
forwardCount
;
}
public
String
getCategoryName
()
{
return
categoryName
;
}
public
void
setCategoryName
(
String
categoryName
)
{
this
.
categoryName
=
categoryName
;
}
public
String
getContent
()
{
return
content
;
}
...
...
@@ -201,6 +216,7 @@ public class CmsSubject implements Serializable {
sb
.
append
(
", description="
).
append
(
description
);
sb
.
append
(
", showStatus="
).
append
(
showStatus
);
sb
.
append
(
", forwardCount="
).
append
(
forwardCount
);
sb
.
append
(
", categoryName="
).
append
(
categoryName
);
sb
.
append
(
", content="
).
append
(
content
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
...
...
mall-mbg/src/main/java/com/macro/mall/model/CmsSubjectExample.java
View file @
06532781
...
...
@@ -984,6 +984,76 @@ public class CmsSubjectExample {
addCriterion
(
"forward_count not between"
,
value1
,
value2
,
"forwardCount"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameIsNull
()
{
addCriterion
(
"category_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameIsNotNull
()
{
addCriterion
(
"category_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameEqualTo
(
String
value
)
{
addCriterion
(
"category_name ="
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameNotEqualTo
(
String
value
)
{
addCriterion
(
"category_name <>"
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameGreaterThan
(
String
value
)
{
addCriterion
(
"category_name >"
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"category_name >="
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameLessThan
(
String
value
)
{
addCriterion
(
"category_name <"
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"category_name <="
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameLike
(
String
value
)
{
addCriterion
(
"category_name like"
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameNotLike
(
String
value
)
{
addCriterion
(
"category_name not like"
,
value
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"category_name in"
,
values
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"category_name not in"
,
values
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"category_name between"
,
value1
,
value2
,
"categoryName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCategoryNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"category_name not between"
,
value1
,
value2
,
"categoryName"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
mall-mbg/src/main/resources/com/macro/mall/mapper/CmsSubjectMapper.xml
View file @
06532781
...
...
@@ -16,6 +16,7 @@
<result
column=
"description"
jdbcType=
"VARCHAR"
property=
"description"
/>
<result
column=
"show_status"
jdbcType=
"INTEGER"
property=
"showStatus"
/>
<result
column=
"forward_count"
jdbcType=
"INTEGER"
property=
"forwardCount"
/>
<result
column=
"category_name"
jdbcType=
"VARCHAR"
property=
"categoryName"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"com.macro.mall.model.CmsSubject"
>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
...
...
@@ -80,7 +81,7 @@
</sql>
<sql
id=
"Base_Column_List"
>
id, category_id, title, pic, product_count, recommend_status, create_time, collect_count,
read_count, comment_count, album_pics, description, show_status, forward_count
read_count, comment_count, album_pics, description, show_status, forward_count
, category_name
</sql>
<sql
id=
"Blob_Column_List"
>
content
...
...
@@ -141,12 +142,14 @@
product_count, recommend_status, create_time,
collect_count, read_count, comment_count,
album_pics, description, show_status,
forward_count, content)
forward_count, category_name, content
)
values (#{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR},
#{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{commentCount,jdbcType=INTEGER},
#{albumPics,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER},
#{forwardCount,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR})
#{forwardCount,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.macro.mall.model.CmsSubject"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
...
@@ -193,6 +196,9 @@
<if
test=
"forwardCount != null"
>
forward_count,
</if>
<if
test=
"categoryName != null"
>
category_name,
</if>
<if
test=
"content != null"
>
content,
</if>
...
...
@@ -237,6 +243,9 @@
<if
test=
"forwardCount != null"
>
#{forwardCount,jdbcType=INTEGER},
</if>
<if
test=
"categoryName != null"
>
#{categoryName,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -293,6 +302,9 @@
<if
test=
"record.forwardCount != null"
>
forward_count = #{record.forwardCount,jdbcType=INTEGER},
</if>
<if
test=
"record.categoryName != null"
>
category_name = #{record.categoryName,jdbcType=VARCHAR},
</if>
<if
test=
"record.content != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -317,6 +329,7 @@
description = #{record.description,jdbcType=VARCHAR},
show_status = #{record.showStatus,jdbcType=INTEGER},
forward_count = #{record.forwardCount,jdbcType=INTEGER},
category_name = #{record.categoryName,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -337,7 +350,8 @@
album_pics = #{record.albumPics,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
show_status = #{record.showStatus,jdbcType=INTEGER},
forward_count = #{record.forwardCount,jdbcType=INTEGER}
forward_count = #{record.forwardCount,jdbcType=INTEGER},
category_name = #{record.categoryName,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -384,6 +398,9 @@
<if
test=
"forwardCount != null"
>
forward_count = #{forwardCount,jdbcType=INTEGER},
</if>
<if
test=
"categoryName != null"
>
category_name = #{categoryName,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
content = #{content,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -405,6 +422,7 @@
description = #{description,jdbcType=VARCHAR},
show_status = #{showStatus,jdbcType=INTEGER},
forward_count = #{forwardCount,jdbcType=INTEGER},
category_name = #{categoryName,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
...
...
@@ -422,7 +440,8 @@
album_pics = #{albumPics,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
show_status = #{showStatus,jdbcType=INTEGER},
forward_count = #{forwardCount,jdbcType=INTEGER}
forward_count = #{forwardCount,jdbcType=INTEGER},
category_name = #{categoryName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
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