小程序后端意见反馈实现

This commit is contained in:
usgeek
2018-08-27 12:26:37 +08:00
committed by linlinjava
parent 19e3167f8d
commit 04e9bbb819
6 changed files with 3937 additions and 0 deletions

View File

@@ -0,0 +1,214 @@
package org.linlinjava.litemall.db.dao;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.domain.LitemallFeedback;
import org.linlinjava.litemall.db.domain.LitemallFeedbackExample;
import java.util.List;
public interface LitemallFeedbackMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
long countByExample(LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int deleteWithVersionByExample(@Param("version") Integer version, @Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int deleteByExample(LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int deleteWithVersionByPrimaryKey(@Param("version") Integer version, @Param("key") Integer key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int insert(LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int insertSelective(LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallFeedback selectOneByExample(LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallFeedback selectOneByExampleSelective(@Param("example") LitemallFeedbackExample example, @Param("selective") LitemallFeedback.Column... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<LitemallFeedback> selectByExampleSelective(@Param("example") LitemallFeedbackExample example, @Param("selective") LitemallFeedback.Column... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
List<LitemallFeedback> selectByExample(LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallFeedback selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallFeedback.Column... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
LitemallFeedback selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallFeedback selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int updateWithVersionByExample(@Param("version") Integer version, @Param("record") LitemallFeedback record, @Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int updateWithVersionByExampleSelective(@Param("version") Integer version, @Param("record") LitemallFeedback record, @Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") LitemallFeedback record, @Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int updateByExample(@Param("record") LitemallFeedback record, @Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int updateWithVersionByPrimaryKey(@Param("version") Integer version, @Param("record") LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int updateWithVersionByPrimaryKeySelective(@Param("version") Integer version, @Param("record") LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
int updateByPrimaryKey(LitemallFeedback record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByExample(@Param("example") LitemallFeedbackExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByPrimaryKey(Integer id);
}

View File

@@ -0,0 +1,703 @@
package org.linlinjava.litemall.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
public class LitemallFeedback {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean NOT_DELETED = false;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean IS_DELETED = true;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.user_id
*
* @mbg.generated
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.username
*
* @mbg.generated
*/
private String username;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.mobile
*
* @mbg.generated
*/
private String mobile;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.feed_type
*
* @mbg.generated
*/
private String feedType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.content
*
* @mbg.generated
*/
private String content;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.status
*
* @mbg.generated
*/
private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.has_picture
*
* @mbg.generated
*/
private Boolean hasPicture;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.pic_urls
*
* @mbg.generated
*/
private String[] picUrls;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.add_time
*
* @mbg.generated
*/
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.deleted
*
* @mbg.generated
*/
private Boolean deleted;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_feedback.version
*
* @mbg.generated
*/
private Integer version;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.id
*
* @return the value of litemall_feedback.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.id
*
* @param id the value for litemall_feedback.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.user_id
*
* @return the value of litemall_feedback.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.user_id
*
* @param userId the value for litemall_feedback.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.username
*
* @return the value of litemall_feedback.username
*
* @mbg.generated
*/
public String getUsername() {
return username;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.username
*
* @param username the value for litemall_feedback.username
*
* @mbg.generated
*/
public void setUsername(String username) {
this.username = username;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.mobile
*
* @return the value of litemall_feedback.mobile
*
* @mbg.generated
*/
public String getMobile() {
return mobile;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.mobile
*
* @param mobile the value for litemall_feedback.mobile
*
* @mbg.generated
*/
public void setMobile(String mobile) {
this.mobile = mobile;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.feed_type
*
* @return the value of litemall_feedback.feed_type
*
* @mbg.generated
*/
public String getFeedType() {
return feedType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.feed_type
*
* @param feedType the value for litemall_feedback.feed_type
*
* @mbg.generated
*/
public void setFeedType(String feedType) {
this.feedType = feedType;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.content
*
* @return the value of litemall_feedback.content
*
* @mbg.generated
*/
public String getContent() {
return content;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.content
*
* @param content the value for litemall_feedback.content
*
* @mbg.generated
*/
public void setContent(String content) {
this.content = content;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.status
*
* @return the value of litemall_feedback.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.status
*
* @param status the value for litemall_feedback.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.has_picture
*
* @return the value of litemall_feedback.has_picture
*
* @mbg.generated
*/
public Boolean getHasPicture() {
return hasPicture;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.has_picture
*
* @param hasPicture the value for litemall_feedback.has_picture
*
* @mbg.generated
*/
public void setHasPicture(Boolean hasPicture) {
this.hasPicture = hasPicture;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.pic_urls
*
* @return the value of litemall_feedback.pic_urls
*
* @mbg.generated
*/
public String[] getPicUrls() {
return picUrls;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.pic_urls
*
* @param picUrls the value for litemall_feedback.pic_urls
*
* @mbg.generated
*/
public void setPicUrls(String[] picUrls) {
this.picUrls = picUrls;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.add_time
*
* @return the value of litemall_feedback.add_time
*
* @mbg.generated
*/
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.add_time
*
* @param addTime the value for litemall_feedback.add_time
*
* @mbg.generated
*/
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.deleted
*
* @return the value of litemall_feedback.deleted
*
* @mbg.generated
*/
public Boolean getDeleted() {
return deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.deleted
*
* @param deleted the value for litemall_feedback.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_feedback.version
*
* @return the value of litemall_feedback.version
*
* @mbg.generated
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_feedback.version
*
* @param version the value for litemall_feedback.version
*
* @mbg.generated
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", username=").append(username);
sb.append(", mobile=").append(mobile);
sb.append(", feedType=").append(feedType);
sb.append(", content=").append(content);
sb.append(", status=").append(status);
sb.append(", hasPicture=").append(hasPicture);
sb.append(", picUrls=").append(picUrls);
sb.append(", addTime=").append(addTime);
sb.append(", deleted=").append(deleted);
sb.append(", version=").append(version);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
LitemallFeedback other = (LitemallFeedback) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
&& (this.getMobile() == null ? other.getMobile() == null : this.getMobile().equals(other.getMobile()))
&& (this.getFeedType() == null ? other.getFeedType() == null : this.getFeedType().equals(other.getFeedType()))
&& (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getHasPicture() == null ? other.getHasPicture() == null : this.getHasPicture().equals(other.getHasPicture()))
&& (Arrays.equals(this.getPicUrls(), other.getPicUrls()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
result = prime * result + ((getMobile() == null) ? 0 : getMobile().hashCode());
result = prime * result + ((getFeedType() == null) ? 0 : getFeedType().hashCode());
result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getHasPicture() == null) ? 0 : getHasPicture().hashCode());
result = prime * result + (Arrays.hashCode(getPicUrls()));
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void andLogicalDeleted(boolean deleted) {
setDeleted(deleted ? IS_DELETED : NOT_DELETED);
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
userId("user_id", "userId", "INTEGER", false),
username("username", "username", "VARCHAR", false),
mobile("mobile", "mobile", "VARCHAR", false),
feedType("feed_type", "feedType", "VARCHAR", false),
content("content", "content", "VARCHAR", false),
status("status", "status", "INTEGER", true),
hasPicture("has_picture", "hasPicture", "BIT", false),
picUrls("pic_urls", "picUrls", "VARCHAR", false),
addTime("add_time", "addTime", "TIMESTAMP", false),
deleted("deleted", "deleted", "BIT", false),
version("version", "version", "INTEGER", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_feedback
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}

View File

@@ -0,0 +1,72 @@
package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallFeedbackMapper;
import org.linlinjava.litemall.db.domain.LitemallFeedback;
import org.linlinjava.litemall.db.domain.LitemallFeedbackExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* @author Yogeek
* @date 2018/8/27 11:39
*/
@Service
public class LitemallFeedbackService {
@Autowired
private LitemallFeedbackMapper feedbackMapper;
//提交
public Integer add(LitemallFeedback feedback) {
return feedbackMapper.insertSelective(feedback);
}
public List<LitemallFeedback> querySelective(Integer userId, String username, Integer page, Integer limit, String sort, String order) {
LitemallFeedbackExample example = new LitemallFeedbackExample();
LitemallFeedbackExample.Criteria criteria = example.createCriteria();
if(userId != null){
criteria.andUserIdEqualTo(userId);
}
if(!StringUtils.isEmpty(username)){
criteria.andUsernameLike("%" + username + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, limit);
return feedbackMapper.selectByExample(example);
}
public int countSelective(Integer userId, String username, Integer page, Integer limit, String sort, String order) {
LitemallFeedbackExample example = new LitemallFeedbackExample();
LitemallFeedbackExample.Criteria criteria = example.createCriteria();
if(userId != null){
criteria.andUserIdEqualTo(userId);
}
if(!StringUtils.isEmpty(username)){
criteria.andUsernameLike("%" + username + "%");
}
criteria.andDeletedEqualTo(false);
return (int)feedbackMapper.countByExample(example);
}
public LitemallFeedback findById(Integer id) {
return feedbackMapper.selectByPrimaryKey(id);
}
public void updateById(LitemallFeedback feedback) {
feedbackMapper.updateByPrimaryKeySelective(feedback);
}
public void delete(Integer id) {
feedbackMapper.logicalDeleteByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,774 @@
<?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="org.linlinjava.litemall.db.dao.LitemallFeedbackMapper">
<resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallFeedback">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="feed_type" jdbcType="VARCHAR" property="feedType" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="has_picture" jdbcType="BIT" property="hasPicture" />
<result column="pic_urls" jdbcType="VARCHAR" property="picUrls" typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="version" jdbcType="INTEGER" property="version" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
<foreach collection="criteria.picUrlsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach close=")" collection="example.oredCriteria" item="criteria" open="and (" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
<foreach collection="criteria.picUrlsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_With_Version_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
<where >
version = #{version,jdbcType=INTEGER}
<if test="example.oredCriteria.size() > 0">
<foreach close=")" collection="example.oredCriteria" item="criteria" open="and (" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
<foreach collection="criteria.picUrlsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</if>
</where >
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, username, mobile, feed_type, content, `status`, has_picture, pic_urls,
add_time, deleted, version
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedbackExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from litemall_feedback
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, username, mobile, feed_type, content, `status`, has_picture, pic_urls,
add_time, deleted, version
</otherwise>
</choose>
from litemall_feedback
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_feedback
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from litemall_feedback
where id = #{id,jdbcType=INTEGER}
and deleted =
<choose>
<when test="andLogicalDeleted">
'1'
</when>
<otherwise>
'0'
</otherwise>
</choose>
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, username, mobile, feed_type, content, `status`, has_picture, pic_urls,
add_time, deleted, version
</otherwise>
</choose>
from litemall_feedback
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_feedback
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedbackExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_feedback
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedback">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_feedback (user_id, username, mobile,
feed_type, content, `status`,
has_picture, pic_urls,
add_time, deleted, version
)
values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{feedType,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{hasPicture,jdbcType=BIT}, #{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
#{addTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedback">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="username != null">
username,
</if>
<if test="mobile != null">
mobile,
</if>
<if test="feedType != null">
feed_type,
</if>
<if test="content != null">
content,
</if>
<if test="status != null">
`status`,
</if>
<if test="hasPicture != null">
has_picture,
</if>
<if test="picUrls != null">
pic_urls,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="version != null">
version,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="mobile != null">
#{mobile,jdbcType=VARCHAR},
</if>
<if test="feedType != null">
#{feedType,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="hasPicture != null">
#{hasPicture,jdbcType=BIT},
</if>
<if test="picUrls != null">
#{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedbackExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from litemall_feedback
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_feedback
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.mobile != null">
mobile = #{record.mobile,jdbcType=VARCHAR},
</if>
<if test="record.feedType != null">
feed_type = #{record.feedType,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.hasPicture != null">
has_picture = #{record.hasPicture,jdbcType=BIT},
</if>
<if test="record.picUrls != null">
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_feedback
set id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
mobile = #{record.mobile,jdbcType=VARCHAR},
feed_type = #{record.feedType,jdbcType=VARCHAR},
content = #{record.content,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
has_picture = #{record.hasPicture,jdbcType=BIT},
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT},
version = #{record.version,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedback">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_feedback
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="mobile != null">
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if test="feedType != null">
feed_type = #{feedType,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="hasPicture != null">
has_picture = #{hasPicture,jdbcType=BIT},
</if>
<if test="picUrls != null">
pic_urls = #{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedback">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_feedback
set user_id = #{userId,jdbcType=INTEGER},
username = #{username,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
feed_type = #{feedType,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
has_picture = #{hasPicture,jdbcType=BIT},
pic_urls = #{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
add_time = #{addTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT},
version = #{version,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallFeedbackExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from litemall_feedback
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, username, mobile, feed_type, content, `status`, has_picture, pic_urls,
add_time, deleted, version
</otherwise>
</choose>
from litemall_feedback
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
<update id="logicalDeleteByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback set deleted = 1
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback set deleted = 1
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteWithVersionByPrimaryKey" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
delete from litemall_feedback
where version = #{version,jdbcType=INTEGER}
and id = #{key,jdbcType=INTEGER}
</delete>
<delete id="deleteWithVersionByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
delete from litemall_feedback
<if test="_parameter != null">
<include refid="Update_By_Example_With_Version_Where_Clause" />
</if>
</delete>
<update id="updateWithVersionByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback
set version = version + 1,
id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
mobile = #{record.mobile,jdbcType=VARCHAR},
feed_type = #{record.feedType,jdbcType=VARCHAR},
content = #{record.content,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
has_picture = #{record.hasPicture,jdbcType=BIT},
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_With_Version_Where_Clause" />
</if>
</update>
<update id="updateWithVersionByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback
<set>
<trim suffixOverrides=",">
version = version + 1,
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.mobile != null">
mobile = #{record.mobile,jdbcType=VARCHAR},
</if>
<if test="record.feedType != null">
feed_type = #{record.feedType,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.hasPicture != null">
has_picture = #{record.hasPicture,jdbcType=BIT},
</if>
<if test="record.picUrls != null">
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
</trim>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_With_Version_Where_Clause" />
</if>
</update>
<update id="updateWithVersionByPrimaryKey" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback
set version = version + 1,
user_id = #{record.userId,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
mobile = #{record.mobile,jdbcType=VARCHAR},
feed_type = #{record.feedType,jdbcType=VARCHAR},
content = #{record.content,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
has_picture = #{record.hasPicture,jdbcType=BIT},
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT}
where version = #{version,jdbcType=INTEGER}
and id = #{record.id,jdbcType=INTEGER}
</update>
<update id="updateWithVersionByPrimaryKeySelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
update litemall_feedback
<set>
<trim suffixOverrides=",">
version = version + 1,
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.mobile != null">
mobile = #{record.mobile,jdbcType=VARCHAR},
</if>
<if test="record.feedType != null">
feed_type = #{record.feedType,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.hasPicture != null">
has_picture = #{record.hasPicture,jdbcType=BIT},
</if>
<if test="record.picUrls != null">
pic_urls = #{record.picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
</trim>
</set>
where version = #{version,jdbcType=INTEGER}
and id = #{record.id,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -0,0 +1,102 @@
package org.linlinjava.litemall.wx.web;
import com.alibaba.fastjson.JSONObject;
import org.linlinjava.litemall.core.util.RegexUtil;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallFeedback;
import org.linlinjava.litemall.db.domain.LitemallUser;
import org.linlinjava.litemall.db.service.LitemallFeedbackService;
import org.linlinjava.litemall.db.service.LitemallUserService;
import org.linlinjava.litemall.wx.annotation.LoginUser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.time.LocalDateTime;
/**
* @author Yogeek
* @date 2018/8/25 14:10
*/
@RestController
@RequestMapping("/wx/feedback")
@Validated
public class WxFeedbackController {
private final Log logger = LogFactory.getLog(WxFeedbackController.class);
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
protected HttpServletRequest request;
@Autowired
private LitemallUserService userService;
/**
* 意见反馈
*/
@PostMapping("submit")
@ResponseBody
public Object save(@LoginUser Integer userId){
if(userId == null){
return ResponseUtil.unlogin();
}
LitemallUser user = userService.findById(userId);
String username = user.getUsername();
//获取客户端对象
JSONObject feedbackJson = this.getJsonRequest();
if (null != feedbackJson) {
LitemallFeedback feedback = new LitemallFeedback();
String mobile = feedbackJson.getString("mobile");
// 测试手机号码是否正确
if (!RegexUtil.isMobileExact(mobile)) {
return ResponseUtil.badArgument();
}
String[] feedType = new String [] {"请选择反馈类型", "商品相关", "功能异常", "优化建议", "其他"};
int index = feedbackJson.getInteger("index");
String content = feedbackJson.getString("content");
feedback.setUserId(userId);
feedback.setUsername(username);
feedback.setMobile(mobile);
feedback.setAddTime(LocalDateTime.now());
feedback.setFeedType(feedType[index]);
//状态默认是01表示状态已发生变化
feedback.setStatus(1);
feedback.setContent(content);
feedbackService.add(feedback);
return ResponseUtil.ok("感谢您的反馈");
}
return ResponseUtil.badArgument();
}
private JSONObject getJsonRequest() {
JSONObject result = null;
StringBuilder sb = new StringBuilder();
try (BufferedReader reader = request.getReader();) {
char[] buff = new char[1024];
int len;
while ((len = reader.read(buff)) != -1) {
sb.append(buff, 0, len);
}
result = JSONObject.parseObject(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
}