查询专题接口添加
This commit is contained in:
parent
51f1271cc2
commit
0653278125
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,4 +32,14 @@ public class CmsSubjectController {
|
|||||||
List<CmsSubject> subjectList = subjectService.listAll();
|
List<CmsSubject> subjectList = subjectService.listAll();
|
||||||
return new CommonResult().success(subjectList);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,13 @@ import java.util.List;
|
|||||||
* Created by macro on 2018/6/1.
|
* Created by macro on 2018/6/1.
|
||||||
*/
|
*/
|
||||||
public interface CmsSubjectService {
|
public interface CmsSubjectService {
|
||||||
|
/**
|
||||||
|
* 查询所有专题
|
||||||
|
*/
|
||||||
List<CmsSubject> listAll();
|
List<CmsSubject> listAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询专题
|
||||||
|
*/
|
||||||
|
List<CmsSubject> list(String keyword, Integer pageNum, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.CmsSubjectMapper;
|
import com.macro.mall.mapper.CmsSubjectMapper;
|
||||||
import com.macro.mall.model.CmsSubject;
|
import com.macro.mall.model.CmsSubject;
|
||||||
import com.macro.mall.model.CmsSubjectExample;
|
import com.macro.mall.model.CmsSubjectExample;
|
||||||
import com.macro.mall.service.CmsSubjectService;
|
import com.macro.mall.service.CmsSubjectService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -22,4 +24,15 @@ public class CmsSubjectServiceImpl implements CmsSubjectService {
|
|||||||
public List<CmsSubject> listAll() {
|
public List<CmsSubject> listAll() {
|
||||||
return subjectMapper.selectByExample(new CmsSubjectExample());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,13 @@ public class CmsSubject implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer forwardCount;
|
private Integer forwardCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 专题分类名称
|
||||||
|
*
|
||||||
|
* @mbggenerated
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -173,6 +180,14 @@ public class CmsSubject implements Serializable {
|
|||||||
this.forwardCount = forwardCount;
|
this.forwardCount = forwardCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCategoryName() {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryName(String categoryName) {
|
||||||
|
this.categoryName = categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
@ -201,6 +216,7 @@ public class CmsSubject implements Serializable {
|
|||||||
sb.append(", description=").append(description);
|
sb.append(", description=").append(description);
|
||||||
sb.append(", showStatus=").append(showStatus);
|
sb.append(", showStatus=").append(showStatus);
|
||||||
sb.append(", forwardCount=").append(forwardCount);
|
sb.append(", forwardCount=").append(forwardCount);
|
||||||
|
sb.append(", categoryName=").append(categoryName);
|
||||||
sb.append(", content=").append(content);
|
sb.append(", content=").append(content);
|
||||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
|
@ -984,6 +984,76 @@ public class CmsSubjectExample {
|
|||||||
addCriterion("forward_count not between", value1, value2, "forwardCount");
|
addCriterion("forward_count not between", value1, value2, "forwardCount");
|
||||||
return (Criteria) this;
|
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 {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||||
<result column="show_status" jdbcType="INTEGER" property="showStatus" />
|
<result column="show_status" jdbcType="INTEGER" property="showStatus" />
|
||||||
<result column="forward_count" jdbcType="INTEGER" property="forwardCount" />
|
<result column="forward_count" jdbcType="INTEGER" property="forwardCount" />
|
||||||
|
<result column="category_name" jdbcType="VARCHAR" property="categoryName" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.macro.mall.model.CmsSubject">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.macro.mall.model.CmsSubject">
|
||||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||||
@ -80,7 +81,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, category_id, title, pic, product_count, recommend_status, create_time, collect_count,
|
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>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
content
|
content
|
||||||
@ -141,12 +142,14 @@
|
|||||||
product_count, recommend_status, create_time,
|
product_count, recommend_status, create_time,
|
||||||
collect_count, read_count, comment_count,
|
collect_count, read_count, comment_count,
|
||||||
album_pics, description, show_status,
|
album_pics, description, show_status,
|
||||||
forward_count, content)
|
forward_count, category_name, content
|
||||||
|
)
|
||||||
values (#{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR},
|
values (#{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR},
|
||||||
#{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
#{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
||||||
#{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{commentCount,jdbcType=INTEGER},
|
#{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{commentCount,jdbcType=INTEGER},
|
||||||
#{albumPics,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{showStatus,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>
|
||||||
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubject">
|
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubject">
|
||||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||||
@ -193,6 +196,9 @@
|
|||||||
<if test="forwardCount != null">
|
<if test="forwardCount != null">
|
||||||
forward_count,
|
forward_count,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryName != null">
|
||||||
|
category_name,
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content,
|
content,
|
||||||
</if>
|
</if>
|
||||||
@ -237,6 +243,9 @@
|
|||||||
<if test="forwardCount != null">
|
<if test="forwardCount != null">
|
||||||
#{forwardCount,jdbcType=INTEGER},
|
#{forwardCount,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryName != null">
|
||||||
|
#{categoryName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
#{content,jdbcType=LONGVARCHAR},
|
#{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -293,6 +302,9 @@
|
|||||||
<if test="record.forwardCount != null">
|
<if test="record.forwardCount != null">
|
||||||
forward_count = #{record.forwardCount,jdbcType=INTEGER},
|
forward_count = #{record.forwardCount,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.categoryName != null">
|
||||||
|
category_name = #{record.categoryName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.content != null">
|
<if test="record.content != null">
|
||||||
content = #{record.content,jdbcType=LONGVARCHAR},
|
content = #{record.content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -317,6 +329,7 @@
|
|||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
show_status = #{record.showStatus,jdbcType=INTEGER},
|
show_status = #{record.showStatus,jdbcType=INTEGER},
|
||||||
forward_count = #{record.forwardCount,jdbcType=INTEGER},
|
forward_count = #{record.forwardCount,jdbcType=INTEGER},
|
||||||
|
category_name = #{record.categoryName,jdbcType=VARCHAR},
|
||||||
content = #{record.content,jdbcType=LONGVARCHAR}
|
content = #{record.content,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
@ -337,7 +350,8 @@
|
|||||||
album_pics = #{record.albumPics,jdbcType=VARCHAR},
|
album_pics = #{record.albumPics,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
show_status = #{record.showStatus,jdbcType=INTEGER},
|
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">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
@ -384,6 +398,9 @@
|
|||||||
<if test="forwardCount != null">
|
<if test="forwardCount != null">
|
||||||
forward_count = #{forwardCount,jdbcType=INTEGER},
|
forward_count = #{forwardCount,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryName != null">
|
||||||
|
category_name = #{categoryName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content = #{content,jdbcType=LONGVARCHAR},
|
content = #{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -405,6 +422,7 @@
|
|||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
show_status = #{showStatus,jdbcType=INTEGER},
|
show_status = #{showStatus,jdbcType=INTEGER},
|
||||||
forward_count = #{forwardCount,jdbcType=INTEGER},
|
forward_count = #{forwardCount,jdbcType=INTEGER},
|
||||||
|
category_name = #{categoryName,jdbcType=VARCHAR},
|
||||||
content = #{content,jdbcType=LONGVARCHAR}
|
content = #{content,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
@ -422,7 +440,8 @@
|
|||||||
album_pics = #{albumPics,jdbcType=VARCHAR},
|
album_pics = #{albumPics,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
show_status = #{showStatus,jdbcType=INTEGER},
|
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}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user