Commit 94463c26 authored by Junling Bu's avatar Junling Bu
Browse files

litemall-db模块更新:

1. mybatis generator更新1.3.7
2. mybatis-generator-plugin更新1.2.12
3. 更新所有自动生成代码
4. OrderMapper,实现基于update_time的乐观锁更新
parent d4b95ef2
......@@ -5,6 +5,24 @@ import java.util.ArrayList;
import java.util.Arrays;
public class LitemallUserFormid {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_user_formid
*
* @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_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static final Boolean IS_DELETED = true;
/**
*
* This field was generated by MyBatis Generator.
......@@ -62,11 +80,29 @@ public class LitemallUserFormid {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_user_formid.version
* This field corresponds to the database column litemall_user_formid.add_time
*
* @mbg.generated
*/
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_user_formid.update_time
*
* @mbg.generated
*/
private LocalDateTime updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_user_formid.deleted
*
* @mbg.generated
*/
private Integer version;
private Boolean deleted;
/**
* This method was generated by MyBatis Generator.
......@@ -214,26 +250,74 @@ public class LitemallUserFormid {
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_user_formid.version
* This method returns the value of the database column litemall_user_formid.add_time
*
* @return the value of litemall_user_formid.version
* @return the value of litemall_user_formid.add_time
*
* @mbg.generated
*/
public Integer getVersion() {
return version;
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_user_formid.version
* This method sets the value of the database column litemall_user_formid.add_time
*
* @param version the value for litemall_user_formid.version
* @param addTime the value for litemall_user_formid.add_time
*
* @mbg.generated
*/
public void setVersion(Integer version) {
this.version = version;
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_user_formid.update_time
*
* @return the value of litemall_user_formid.update_time
*
* @mbg.generated
*/
public LocalDateTime getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_user_formid.update_time
*
* @param updateTime the value for litemall_user_formid.update_time
*
* @mbg.generated
*/
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_user_formid.deleted
*
* @return the value of litemall_user_formid.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_user_formid.deleted
*
* @param deleted the value for litemall_user_formid.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
......@@ -254,7 +338,9 @@ public class LitemallUserFormid {
sb.append(", useamount=").append(useamount);
sb.append(", expireTime=").append(expireTime);
sb.append(", openid=").append(openid);
sb.append(", version=").append(version);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", deleted=").append(deleted);
sb.append("]");
return sb.toString();
}
......@@ -283,7 +369,9 @@ public class LitemallUserFormid {
&& (this.getUseamount() == null ? other.getUseamount() == null : this.getUseamount().equals(other.getUseamount()))
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
&& (this.getOpenid() == null ? other.getOpenid() == null : this.getOpenid().equals(other.getOpenid()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
}
/**
......@@ -302,10 +390,23 @@ public class LitemallUserFormid {
result = prime * result + ((getUseamount() == null) ? 0 : getUseamount().hashCode());
result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
result = prime * result + ((getOpenid() == null) ? 0 : getOpenid().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @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_user_formid
......@@ -320,7 +421,9 @@ public class LitemallUserFormid {
useamount("useAmount", "useamount", "INTEGER", false),
expireTime("expire_time", "expireTime", "TIMESTAMP", false),
openid("openId", "openid", "VARCHAR", false),
version("version", "version", "INTEGER", false);
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
deleted("deleted", "deleted", "BIT", false);
/**
* This field was generated by MyBatis Generator.
......
......@@ -179,6 +179,18 @@ public class LitemallUserFormidExample {
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
LitemallUserFormidExample example = new LitemallUserFormidExample();
return example.createCriteria();
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table litemall_user_formid
......@@ -1038,18 +1050,150 @@ public class LitemallUserFormidExample {
return (Criteria) this;
}
public Criteria andVersionIsNull() {
addCriterion("version is null");
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
}
public Criteria andAddTimeIsNotNull() {
addCriterion("add_time is not null");
return (Criteria) this;
}
public Criteria andAddTimeEqualTo(LocalDateTime value) {
addCriterion("add_time =", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeNotEqualTo(LocalDateTime value) {
addCriterion("add_time <>", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeNotEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThan(LocalDateTime value) {
addCriterion("add_time >", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time >=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeGreaterThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThan(LocalDateTime value) {
addCriterion("add_time <", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("add_time <=", value, "addTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddTimeLessThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("add_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddTimeIn(List<LocalDateTime> values) {
addCriterion("add_time in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotIn(List<LocalDateTime> values) {
addCriterion("add_time not in", values, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andAddTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("add_time not between", value1, value2, "addTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(Integer value) {
addCriterion("version =", value, "version");
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
......@@ -1060,13 +1204,13 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version = ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(Integer value) {
addCriterion("version <>", value, "version");
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
......@@ -1077,13 +1221,13 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionNotEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version <> ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeNotEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionGreaterThan(Integer value) {
addCriterion("version >", value, "version");
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
......@@ -1094,13 +1238,13 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionGreaterThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version > ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeGreaterThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(Integer value) {
addCriterion("version >=", value, "version");
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
......@@ -1111,13 +1255,13 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionGreaterThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version >= ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeGreaterThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionLessThan(Integer value) {
addCriterion("version <", value, "version");
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
......@@ -1128,13 +1272,13 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionLessThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version < ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeLessThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(Integer value) {
addCriterion("version <=", value, "version");
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
......@@ -1145,28 +1289,160 @@ public class LitemallUserFormidExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andVersionLessThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("version <= ").append(column.getEscapedColumnName()).toString());
public Criteria andUpdateTimeLessThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("update_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andVersionIn(List<Integer> values) {
addCriterion("version in", values, "version");
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<Integer> values) {
addCriterion("version not in", values, "version");
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andVersionBetween(Integer value1, Integer value2) {
addCriterion("version between", value1, value2, "version");
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andVersionNotBetween(Integer value1, Integer value2) {
addCriterion("version not between", value1, value2, "version");
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedNotEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedGreaterThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedGreaterThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedLessThanColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDeletedLessThanOrEqualToColumn(LitemallUserFormid.Column column) {
addCriterion(new StringBuilder("deleted <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
}
......@@ -1224,6 +1500,17 @@ public class LitemallUserFormidExample {
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_formid
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLogicalDeleted(boolean deleted) {
return deleted ? andDeletedEqualTo(LitemallUserFormid.IS_DELETED) : andDeletedNotEqualTo(LitemallUserFormid.IS_DELETED);
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table litemall_user_formid
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -57,6 +58,7 @@ public class LitemallAdService {
}
public int updateById(LitemallAd ad) {
ad.setUpdateTime(LocalDateTime.now());
return adMapper.updateByPrimaryKeySelective(ad);
}
......@@ -65,6 +67,8 @@ public class LitemallAdService {
}
public void add(LitemallAd ad) {
ad.setAddTime(LocalDateTime.now());
ad.setUpdateTime(LocalDateTime.now());
adMapper.insertSelective(ad);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -26,10 +27,13 @@ public class LitemallAddressService {
}
public int add(LitemallAddress address) {
address.setAddTime(LocalDateTime.now());
address.setUpdateTime(LocalDateTime.now());
return addressMapper.insertSelective(address);
}
public int update(LitemallAddress address) {
address.setUpdateTime(LocalDateTime.now());
return addressMapper.updateByPrimaryKeySelective(address);
}
......@@ -46,6 +50,7 @@ public class LitemallAddressService {
public void resetDefault(Integer userId) {
LitemallAddress address = new LitemallAddress();
address.setIsDefault(false);
address.setUpdateTime(LocalDateTime.now());
LitemallAddressExample example = new LitemallAddressExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
addressMapper.updateByExampleSelective(address, example);
......
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -24,7 +25,6 @@ public class LitemallAdminService {
public LitemallAdmin findAdmin(Integer id) {
return adminMapper.selectByPrimaryKey(id);
}
private final Column[] result = new Column[]{Column.id, Column.username, Column.avatar};
......@@ -58,6 +58,7 @@ public class LitemallAdminService {
}
public int updateById(LitemallAdmin admin) {
admin.setUpdateTime(LocalDateTime.now());
return adminMapper.updateByPrimaryKeySelective(admin);
}
......@@ -66,6 +67,8 @@ public class LitemallAdminService {
}
public void add(LitemallAdmin admin) {
admin.setAddTime(LocalDateTime.now());
admin.setUpdateTime(LocalDateTime.now());
adminMapper.insertSelective(admin);
}
......
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -71,6 +72,7 @@ public class LitemallBrandService {
}
public int updateById(LitemallBrand brand) {
brand.setUpdateTime(LocalDateTime.now());
return brandMapper.updateByPrimaryKeySelective(brand);
}
......@@ -79,6 +81,8 @@ public class LitemallBrandService {
}
public void add(LitemallBrand brand) {
brand.setAddTime(LocalDateTime.now());
brand.setUpdateTime(LocalDateTime.now());
brandMapper.insertSelective(brand);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -22,10 +23,13 @@ public class LitemallCartService {
}
public void add(LitemallCart cart) {
cart.setAddTime(LocalDateTime.now());
cart.setUpdateTime(LocalDateTime.now());
cartMapper.insertSelective(cart);
}
public int updateById(LitemallCart cart) {
cart.setUpdateTime(LocalDateTime.now());
return cartMapper.updateByPrimaryKeySelective(cart);
}
......@@ -57,6 +61,7 @@ public class LitemallCartService {
example.or().andUserIdEqualTo(userId).andProductIdIn(idsList).andDeletedEqualTo(false);
LitemallCart cart = new LitemallCart();
cart.setChecked(checked);
cart.setUpdateTime(LocalDateTime.now());
return cartMapper.updateByExampleSelective(cart, example);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -87,6 +88,7 @@ public class LitemallCategoryService {
}
public int updateById(LitemallCategory category) {
category.setUpdateTime(LocalDateTime.now());
return categoryMapper.updateByPrimaryKeySelective(category);
}
......@@ -95,6 +97,8 @@ public class LitemallCategoryService {
}
public void add(LitemallCategory category) {
category.setAddTime(LocalDateTime.now());
category.setUpdateTime(LocalDateTime.now());
categoryMapper.insertSelective(category);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -46,6 +47,8 @@ public class LitemallCollectService {
}
public int add(LitemallCollect collect) {
collect.setAddTime(LocalDateTime.now());
collect.setUpdateTime(LocalDateTime.now());
return collectMapper.insertSelective(collect);
}
......
......@@ -9,6 +9,7 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -61,6 +62,8 @@ public class LitemallCommentService {
}
public int save(LitemallComment comment) {
comment.setAddTime(LocalDateTime.now());
comment.setUpdateTime(LocalDateTime.now());
return commentMapper.insertSelective(comment);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -20,6 +21,8 @@ public class LitemallFeedbackService {
private LitemallFeedbackMapper feedbackMapper;
public Integer add(LitemallFeedback feedback) {
feedback.setAddTime(LocalDateTime.now());
feedback.setUpdateTime(LocalDateTime.now());
return feedbackMapper.insertSelective(feedback);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -38,6 +39,8 @@ public class LitemallFootprintService {
}
public void add(LitemallFootprint footprint) {
footprint.setAddTime(LocalDateTime.now());
footprint.setUpdateTime(LocalDateTime.now());
footprintMapper.insertSelective(footprint);
}
......
......@@ -7,6 +7,7 @@ import org.linlinjava.litemall.db.domain.LitemallGoodsAttributeExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -21,6 +22,8 @@ public class LitemallGoodsAttributeService {
}
public void add(LitemallGoodsAttribute goodsAttribute) {
goodsAttribute.setAddTime(LocalDateTime.now());
goodsAttribute.setUpdateTime(LocalDateTime.now());
goodsAttributeMapper.insertSelective(goodsAttribute);
}
......
package org.linlinjava.litemall.db.service;
import org.linlinjava.litemall.db.dao.LitemallGoodsProductMapper;
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
import org.linlinjava.litemall.db.domain.LitemallGoodsProductExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class LitemallGoodsProductService {
@Resource
private LitemallGoodsProductMapper goodsProductMapper;
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
return goodsProductMapper.selectByExample(example);
}
public LitemallGoodsProduct findById(Integer id) {
return goodsProductMapper.selectByPrimaryKey(id);
}
public int updateById(LitemallGoodsProduct goodsProduct) {
goodsProduct.setUpdateTime(LocalDateTime.now());
return goodsProductMapper.updateByPrimaryKeySelective(goodsProduct);
}
public void deleteById(Integer id) {
goodsProductMapper.logicalDeleteByPrimaryKey(id);
}
public void add(LitemallGoodsProduct goodsProduct) {
goodsProduct.setAddTime(LocalDateTime.now());
goodsProduct.setUpdateTime(LocalDateTime.now());
goodsProductMapper.insertSelective(goodsProduct);
}
public int count() {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andDeletedEqualTo(false);
return (int)goodsProductMapper.countByExample(example);
}
public void deleteByGid(Integer gid) {
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andGoodsIdEqualTo(gid);
goodsProductMapper.logicalDeleteByExample(example);
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
......@@ -171,7 +172,11 @@ public class LitemallGoodsService {
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
criteria.andIsOnSaleEqualTo(true).andDeletedEqualTo(false);
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, size);
return goodsMapper.selectByExampleWithBLOBs(example);
......@@ -187,7 +192,7 @@ public class LitemallGoodsService {
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
criteria.andIsOnSaleEqualTo(true).andDeletedEqualTo(false);
criteria.andDeletedEqualTo(false);
return (int) goodsMapper.countByExample(example);
}
......@@ -229,6 +234,7 @@ public class LitemallGoodsService {
}
public int updateById(LitemallGoods goods) {
goods.setUpdateTime(LocalDateTime.now());
return goodsMapper.updateByPrimaryKeySelective(goods);
}
......@@ -237,6 +243,8 @@ public class LitemallGoodsService {
}
public void add(LitemallGoods goods) {
goods.setAddTime(LocalDateTime.now());
goods.setUpdateTime(LocalDateTime.now());
goodsMapper.insertSelective(goods);
}
......
......@@ -7,6 +7,7 @@ import org.linlinjava.litemall.db.domain.LitemallGoodsSpecificationExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -34,6 +35,8 @@ public class LitemallGoodsSpecificationService {
}
public void add(LitemallGoodsSpecification goodsSpecification) {
goodsSpecification.setAddTime(LocalDateTime.now());
goodsSpecification.setUpdateTime(LocalDateTime.now());
goodsSpecificationMapper.insertSelective(goodsSpecification);
}
......
......@@ -24,6 +24,8 @@ public class LitemallGrouponRulesService {
private LitemallGoodsMapper goodsMapper;
public int createRules(LitemallGrouponRules rules) {
rules.setAddTime(LocalDateTime.now());
rules.setUpdateTime(LocalDateTime.now());
return mapper.insertSelective(rules);
}
......@@ -144,6 +146,7 @@ public class LitemallGrouponRulesService {
}
public int updateById(LitemallGrouponRules grouponRules) {
grouponRules.setUpdateTime(LocalDateTime.now());
return mapper.updateByPrimaryKeySelective(grouponRules);
}
}
\ No newline at end of file
......@@ -3,17 +3,20 @@ package org.linlinjava.litemall.db.service;
import com.alibaba.druid.util.StringUtils;
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGrouponMapper;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponExample;
import org.linlinjava.litemall.db.domain.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class LitemallGrouponService {
@Resource
LitemallGrouponMapper mapper;
private LitemallGrouponMapper mapper;
/**
* 获取用户发起的团购记录
......@@ -91,6 +94,7 @@ public class LitemallGrouponService {
}
public int updateById(LitemallGroupon groupon) {
groupon.setUpdateTime(LocalDateTime.now());
return mapper.updateByPrimaryKeySelective(groupon);
}
......@@ -101,6 +105,8 @@ public class LitemallGrouponService {
* @return
*/
public int createGroupon(LitemallGroupon groupon) {
groupon.setAddTime(LocalDateTime.now());
groupon.setUpdateTime(LocalDateTime.now());
return mapper.insertSelective(groupon);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -26,6 +27,8 @@ public class LitemallIssueService {
}
public void add(LitemallIssue issue) {
issue.setAddTime(LocalDateTime.now());
issue.setUpdateTime(LocalDateTime.now());
issueMapper.insertSelective(issue);
}
......@@ -59,6 +62,7 @@ public class LitemallIssueService {
}
public int updateById(LitemallIssue issue) {
issue.setUpdateTime(LocalDateTime.now());
return issueMapper.updateByPrimaryKeySelective(issue);
}
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -72,6 +73,8 @@ public class LitemallKeywordService {
}
public void add(LitemallKeyword keywords) {
keywords.setAddTime(LocalDateTime.now());
keywords.setUpdateTime(LocalDateTime.now());
keywordsMapper.insertSelective(keywords);
}
......@@ -80,6 +83,7 @@ public class LitemallKeywordService {
}
public int updateById(LitemallKeyword keywords) {
keywords.setUpdateTime(LocalDateTime.now());
return keywordsMapper.updateByPrimaryKeySelective(keywords);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment