diff --git a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java index 6c1001d..5b141ea 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java +++ b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java @@ -2,6 +2,7 @@ package com.hfkj.dao; import com.hfkj.entity.GoodsUserAddress; import com.hfkj.entity.GoodsUserAddressExample; +import com.hfkj.entity.GoodsUserAddressWithBLOBs; import java.util.List; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.DeleteProvider; @@ -45,22 +46,49 @@ public interface GoodsUserAddressMapper extends GoodsUserAddressMapperExt { "whether_default, create_time, ", "update_time, op_id, ", "op_name, ext_1, ext_2, ", - "ext_3)", - "values " + - "(#{userId,jdbcType=BIGINT}, #{consignee,jdbcType=VARCHAR}, ", + "ext_3, province_id, ", + "city_id, county_id, ", + "town_id)", + "values (#{userId,jdbcType=BIGINT}, #{consignee,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", "#{regionId,jdbcType=VARCHAR}, #{regionName,jdbcType=VARCHAR}, ", "#{whetherDefault,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{opId,jdbcType=BIGINT}, ", "#{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", - "#{ext3,jdbcType=VARCHAR})" + "#{ext3,jdbcType=VARCHAR}, #{provinceId,jdbcType=LONGVARCHAR}, ", + "#{cityId,jdbcType=LONGVARCHAR}, #{countyId,jdbcType=LONGVARCHAR}, ", + "#{townId,jdbcType=LONGVARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") - int insert(GoodsUserAddress record); + int insert(GoodsUserAddressWithBLOBs record); @InsertProvider(type=GoodsUserAddressSqlProvider.class, method="insertSelective") @Options(useGeneratedKeys=true,keyProperty="id") - int insertSelective(GoodsUserAddress record); + int insertSelective(GoodsUserAddressWithBLOBs record); + + @SelectProvider(type=GoodsUserAddressSqlProvider.class, method="selectByExampleWithBLOBs") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="consignee", property="consignee", jdbcType=JdbcType.VARCHAR), + @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), + @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), + @Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR), + @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_default", property="whetherDefault", jdbcType=JdbcType.BIT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), + @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="province_id", property="provinceId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="city_id", property="cityId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="county_id", property="countyId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="town_id", property="townId", jdbcType=JdbcType.LONGVARCHAR) + }) + List selectByExampleWithBLOBs(GoodsUserAddressExample example); @SelectProvider(type=GoodsUserAddressSqlProvider.class, method="selectByExample") @Results({ @@ -85,7 +113,8 @@ public interface GoodsUserAddressMapper extends GoodsUserAddressMapperExt { @Select({ "select", "id, user_id, consignee, phone, address, region_id, region_name, whether_default, ", - "create_time, update_time, op_id, op_name, ext_1, ext_2, ext_3", + "create_time, update_time, op_id, op_name, ext_1, ext_2, ext_3, province_id, ", + "city_id, county_id, town_id", "from goods_user_address", "where id = #{id,jdbcType=BIGINT}" }) @@ -104,18 +133,49 @@ public interface GoodsUserAddressMapper extends GoodsUserAddressMapperExt { @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="province_id", property="provinceId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="city_id", property="cityId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="county_id", property="countyId", jdbcType=JdbcType.LONGVARCHAR), + @Result(column="town_id", property="townId", jdbcType=JdbcType.LONGVARCHAR) }) - GoodsUserAddress selectByPrimaryKey(Long id); + GoodsUserAddressWithBLOBs selectByPrimaryKey(Long id); @UpdateProvider(type=GoodsUserAddressSqlProvider.class, method="updateByExampleSelective") - int updateByExampleSelective(@Param("record") GoodsUserAddress record, @Param("example") GoodsUserAddressExample example); + int updateByExampleSelective(@Param("record") GoodsUserAddressWithBLOBs record, @Param("example") GoodsUserAddressExample example); + + @UpdateProvider(type=GoodsUserAddressSqlProvider.class, method="updateByExampleWithBLOBs") + int updateByExampleWithBLOBs(@Param("record") GoodsUserAddressWithBLOBs record, @Param("example") GoodsUserAddressExample example); @UpdateProvider(type=GoodsUserAddressSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") GoodsUserAddress record, @Param("example") GoodsUserAddressExample example); @UpdateProvider(type=GoodsUserAddressSqlProvider.class, method="updateByPrimaryKeySelective") - int updateByPrimaryKeySelective(GoodsUserAddress record); + int updateByPrimaryKeySelective(GoodsUserAddressWithBLOBs record); + + @Update({ + "update goods_user_address", + "set user_id = #{userId,jdbcType=BIGINT},", + "consignee = #{consignee,jdbcType=VARCHAR},", + "phone = #{phone,jdbcType=VARCHAR},", + "address = #{address,jdbcType=VARCHAR},", + "region_id = #{regionId,jdbcType=VARCHAR},", + "region_name = #{regionName,jdbcType=VARCHAR},", + "whether_default = #{whetherDefault,jdbcType=BIT},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "op_id = #{opId,jdbcType=BIGINT},", + "op_name = #{opName,jdbcType=VARCHAR},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "province_id = #{provinceId,jdbcType=LONGVARCHAR},", + "city_id = #{cityId,jdbcType=LONGVARCHAR},", + "county_id = #{countyId,jdbcType=LONGVARCHAR},", + "town_id = #{townId,jdbcType=LONGVARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKeyWithBLOBs(GoodsUserAddressWithBLOBs record); @Update({ "update goods_user_address", diff --git a/service/src/main/java/com/hfkj/dao/GoodsUserAddressSqlProvider.java b/service/src/main/java/com/hfkj/dao/GoodsUserAddressSqlProvider.java index 8123688..695792c 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsUserAddressSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/GoodsUserAddressSqlProvider.java @@ -1,9 +1,9 @@ package com.hfkj.dao; -import com.hfkj.entity.GoodsUserAddress; import com.hfkj.entity.GoodsUserAddressExample.Criteria; import com.hfkj.entity.GoodsUserAddressExample.Criterion; import com.hfkj.entity.GoodsUserAddressExample; +import com.hfkj.entity.GoodsUserAddressWithBLOBs; import java.util.List; import java.util.Map; import org.apache.ibatis.jdbc.SQL; @@ -24,7 +24,7 @@ public class GoodsUserAddressSqlProvider { return sql.toString(); } - public String insertSelective(GoodsUserAddress record) { + public String insertSelective(GoodsUserAddressWithBLOBs record) { SQL sql = new SQL(); sql.INSERT_INTO("goods_user_address"); @@ -84,6 +84,57 @@ public class GoodsUserAddressSqlProvider { sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); } + if (record.getProvinceId() != null) { + sql.VALUES("province_id", "#{provinceId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCityId() != null) { + sql.VALUES("city_id", "#{cityId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCountyId() != null) { + sql.VALUES("county_id", "#{countyId,jdbcType=LONGVARCHAR}"); + } + + if (record.getTownId() != null) { + sql.VALUES("town_id", "#{townId,jdbcType=LONGVARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExampleWithBLOBs(GoodsUserAddressExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("user_id"); + sql.SELECT("consignee"); + sql.SELECT("phone"); + sql.SELECT("address"); + sql.SELECT("region_id"); + sql.SELECT("region_name"); + sql.SELECT("whether_default"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("op_id"); + sql.SELECT("op_name"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.SELECT("province_id"); + sql.SELECT("city_id"); + sql.SELECT("county_id"); + sql.SELECT("town_id"); + sql.FROM("goods_user_address"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + return sql.toString(); } @@ -119,7 +170,7 @@ public class GoodsUserAddressSqlProvider { } public String updateByExampleSelective(Map parameter) { - GoodsUserAddress record = (GoodsUserAddress) parameter.get("record"); + GoodsUserAddressWithBLOBs record = (GoodsUserAddressWithBLOBs) parameter.get("record"); GoodsUserAddressExample example = (GoodsUserAddressExample) parameter.get("example"); SQL sql = new SQL(); @@ -185,6 +236,51 @@ public class GoodsUserAddressSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); } + if (record.getProvinceId() != null) { + sql.SET("province_id = #{record.provinceId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCityId() != null) { + sql.SET("city_id = #{record.cityId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCountyId() != null) { + sql.SET("county_id = #{record.countyId,jdbcType=LONGVARCHAR}"); + } + + if (record.getTownId() != null) { + sql.SET("town_id = #{record.townId,jdbcType=LONGVARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExampleWithBLOBs(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("goods_user_address"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + sql.SET("consignee = #{record.consignee,jdbcType=VARCHAR}"); + sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); + sql.SET("address = #{record.address,jdbcType=VARCHAR}"); + sql.SET("region_id = #{record.regionId,jdbcType=VARCHAR}"); + sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); + sql.SET("whether_default = #{record.whetherDefault,jdbcType=BIT}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); + sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("province_id = #{record.provinceId,jdbcType=LONGVARCHAR}"); + sql.SET("city_id = #{record.cityId,jdbcType=LONGVARCHAR}"); + sql.SET("county_id = #{record.countyId,jdbcType=LONGVARCHAR}"); + sql.SET("town_id = #{record.townId,jdbcType=LONGVARCHAR}"); + + GoodsUserAddressExample example = (GoodsUserAddressExample) parameter.get("example"); applyWhere(sql, example, true); return sql.toString(); } @@ -214,7 +310,7 @@ public class GoodsUserAddressSqlProvider { return sql.toString(); } - public String updateByPrimaryKeySelective(GoodsUserAddress record) { + public String updateByPrimaryKeySelective(GoodsUserAddressWithBLOBs record) { SQL sql = new SQL(); sql.UPDATE("goods_user_address"); @@ -274,6 +370,22 @@ public class GoodsUserAddressSqlProvider { sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); } + if (record.getProvinceId() != null) { + sql.SET("province_id = #{provinceId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCityId() != null) { + sql.SET("city_id = #{cityId,jdbcType=LONGVARCHAR}"); + } + + if (record.getCountyId() != null) { + sql.SET("county_id = #{countyId,jdbcType=LONGVARCHAR}"); + } + + if (record.getTownId() != null) { + sql.SET("town_id = #{townId,jdbcType=LONGVARCHAR}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/service/src/main/java/com/hfkj/entity/GoodsUserAddress.java b/service/src/main/java/com/hfkj/entity/GoodsUserAddress.java index 3958434..b9e92b6 100644 --- a/service/src/main/java/com/hfkj/entity/GoodsUserAddress.java +++ b/service/src/main/java/com/hfkj/entity/GoodsUserAddress.java @@ -209,81 +209,4 @@ public class GoodsUserAddress implements Serializable { public void setExt3(String ext3) { this.ext3 = ext3; } - - @Override - public boolean equals(Object that) { - if (this == that) { - return true; - } - if (that == null) { - return false; - } - if (getClass() != that.getClass()) { - return false; - } - GoodsUserAddress other = (GoodsUserAddress) 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.getConsignee() == null ? other.getConsignee() == null : this.getConsignee().equals(other.getConsignee())) - && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) - && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress())) - && (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId())) - && (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName())) - && (this.getWhetherDefault() == null ? other.getWhetherDefault() == null : this.getWhetherDefault().equals(other.getWhetherDefault())) - && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) - && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) - && (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId())) - && (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName())) - && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) - && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) - && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); - } - - @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 + ((getConsignee() == null) ? 0 : getConsignee().hashCode()); - result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); - result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode()); - result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode()); - result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode()); - result = prime * result + ((getWhetherDefault() == null) ? 0 : getWhetherDefault().hashCode()); - result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); - result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); - result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode()); - result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode()); - result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); - result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); - result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); - return result; - } - - @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(", consignee=").append(consignee); - sb.append(", phone=").append(phone); - sb.append(", address=").append(address); - sb.append(", regionId=").append(regionId); - sb.append(", regionName=").append(regionName); - sb.append(", whetherDefault=").append(whetherDefault); - sb.append(", createTime=").append(createTime); - sb.append(", updateTime=").append(updateTime); - sb.append(", opId=").append(opId); - sb.append(", opName=").append(opName); - sb.append(", ext1=").append(ext1); - sb.append(", ext2=").append(ext2); - sb.append(", ext3=").append(ext3); - sb.append(", serialVersionUID=").append(serialVersionUID); - sb.append("]"); - return sb.toString(); - } } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/GoodsUserAddressWithBLOBs.java b/service/src/main/java/com/hfkj/entity/GoodsUserAddressWithBLOBs.java new file mode 100644 index 0000000..d336c93 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/GoodsUserAddressWithBLOBs.java @@ -0,0 +1,63 @@ +package com.hfkj.entity; + +import java.io.Serializable; + +/** + * goods_user_address + * @author + */ +public class GoodsUserAddressWithBLOBs extends GoodsUserAddress implements Serializable { + /** + * 一级地址编号 + */ + private String provinceId; + + /** + * 二级地址编号 + */ + private String cityId; + + /** + * 三级地址编号 + */ + private String countyId; + + /** + * 四级地址编号 + */ + private String townId; + + private static final long serialVersionUID = 1L; + + public String getProvinceId() { + return provinceId; + } + + public void setProvinceId(String provinceId) { + this.provinceId = provinceId; + } + + public String getCityId() { + return cityId; + } + + public void setCityId(String cityId) { + this.cityId = cityId; + } + + public String getCountyId() { + return countyId; + } + + public void setCountyId(String countyId) { + this.countyId = countyId; + } + + public String getTownId() { + return townId; + } + + public void setTownId(String townId) { + this.townId = townId; + } +} \ No newline at end of file