diff --git a/hai-service/src/main/java/com/hai/dao/CmsCategoryMapper.java b/hai-service/src/main/java/com/hai/dao/CmsCategoryMapper.java index 0bed2bde..90626123 100644 --- a/hai-service/src/main/java/com/hai/dao/CmsCategoryMapper.java +++ b/hai-service/src/main/java/com/hai/dao/CmsCategoryMapper.java @@ -2,12 +2,22 @@ package com.hai.dao; import com.hai.entity.CmsCategory; import com.hai.entity.CmsCategoryExample; -import org.apache.ibatis.annotations.*; +import java.util.List; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.DeleteProvider; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.UpdateProvider; import org.apache.ibatis.type.JdbcType; import org.springframework.stereotype.Repository; -import java.util.List; - /** * * 代码由工具生成,请勿修改!!! @@ -16,10 +26,10 @@ import java.util.List; **/ @Repository public interface CmsCategoryMapper extends CmsCategoryMapperExt { - @SelectProvider(type= CmsCategorySqlProvider.class, method="countByExample") + @SelectProvider(type=CmsCategorySqlProvider.class, method="countByExample") long countByExample(CmsCategoryExample example); - @DeleteProvider(type= CmsCategorySqlProvider.class, method="deleteByExample") + @DeleteProvider(type=CmsCategorySqlProvider.class, method="deleteByExample") int deleteByExample(CmsCategoryExample example); @Delete({ @@ -29,72 +39,77 @@ public interface CmsCategoryMapper extends CmsCategoryMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into cms_category (parent_id, `name`, ", - "code, sort, cover_img, ", - "`status`, remark, ", - "ext_1, ext_2, ext_3)", - "values (#{parentId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, ", - "#{code,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{coverImg,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "insert into cms_category (`type`, parent_id, ", + "`name`, code, sort, ", + "cover_img, `status`, ", + "remark, ext_1, ext_2, ", + "ext_3)", + "values (#{type,jdbcType=INTEGER}, #{parentId,jdbcType=BIGINT}, ", + "#{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, ", + "#{coverImg,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{remark,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", + "#{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(CmsCategory record); - @InsertProvider(type= CmsCategorySqlProvider.class, method="insertSelective") + @InsertProvider(type=CmsCategorySqlProvider.class, method="insertSelective") @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(CmsCategory record); - @SelectProvider(type= CmsCategorySqlProvider.class, method="selectByExample") + @SelectProvider(type=CmsCategorySqlProvider.class, method="selectByExample") @Results({ - @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), - @Result(column="parent_id", property="parentId", jdbcType= JdbcType.BIGINT), - @Result(column="name", property="name", jdbcType= JdbcType.VARCHAR), - @Result(column="code", property="code", jdbcType= JdbcType.VARCHAR), - @Result(column="sort", property="sort", jdbcType= JdbcType.INTEGER), - @Result(column="cover_img", property="coverImg", jdbcType= JdbcType.VARCHAR), - @Result(column="status", property="status", jdbcType= JdbcType.INTEGER), - @Result(column="remark", property="remark", 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="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT), + @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), + @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR), + @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER), + @Result(column="cover_img", property="coverImg", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", 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) }) List selectByExample(CmsCategoryExample example); @Select({ "select", - "id, parent_id, `name`, code, sort, cover_img, `status`, remark, ext_1, ext_2, ", - "ext_3", + "id, `type`, parent_id, `name`, code, sort, cover_img, `status`, remark, ext_1, ", + "ext_2, ext_3", "from cms_category", "where id = #{id,jdbcType=BIGINT}" }) @Results({ - @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), - @Result(column="parent_id", property="parentId", jdbcType= JdbcType.BIGINT), - @Result(column="name", property="name", jdbcType= JdbcType.VARCHAR), - @Result(column="code", property="code", jdbcType= JdbcType.VARCHAR), - @Result(column="sort", property="sort", jdbcType= JdbcType.INTEGER), - @Result(column="cover_img", property="coverImg", jdbcType= JdbcType.VARCHAR), - @Result(column="status", property="status", jdbcType= JdbcType.INTEGER), - @Result(column="remark", property="remark", 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="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT), + @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), + @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR), + @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER), + @Result(column="cover_img", property="coverImg", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", 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) }) CmsCategory selectByPrimaryKey(Long id); - @UpdateProvider(type= CmsCategorySqlProvider.class, method="updateByExampleSelective") + @UpdateProvider(type=CmsCategorySqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") CmsCategory record, @Param("example") CmsCategoryExample example); - @UpdateProvider(type= CmsCategorySqlProvider.class, method="updateByExample") + @UpdateProvider(type=CmsCategorySqlProvider.class, method="updateByExample") int updateByExample(@Param("record") CmsCategory record, @Param("example") CmsCategoryExample example); - @UpdateProvider(type= CmsCategorySqlProvider.class, method="updateByPrimaryKeySelective") + @UpdateProvider(type=CmsCategorySqlProvider.class, method="updateByPrimaryKeySelective") int updateByPrimaryKeySelective(CmsCategory record); @Update({ "update cms_category", - "set parent_id = #{parentId,jdbcType=BIGINT},", + "set `type` = #{type,jdbcType=INTEGER},", + "parent_id = #{parentId,jdbcType=BIGINT},", "`name` = #{name,jdbcType=VARCHAR},", "code = #{code,jdbcType=VARCHAR},", "sort = #{sort,jdbcType=INTEGER},", @@ -107,4 +122,4 @@ public interface CmsCategoryMapper extends CmsCategoryMapperExt { "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(CmsCategory record); -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/CmsCategorySqlProvider.java b/hai-service/src/main/java/com/hai/dao/CmsCategorySqlProvider.java index 9db5e392..d7f6d55f 100644 --- a/hai-service/src/main/java/com/hai/dao/CmsCategorySqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/CmsCategorySqlProvider.java @@ -1,13 +1,12 @@ package com.hai.dao; import com.hai.entity.CmsCategory; -import com.hai.entity.CmsCategoryExample; import com.hai.entity.CmsCategoryExample.Criteria; import com.hai.entity.CmsCategoryExample.Criterion; -import org.apache.ibatis.jdbc.SQL; - +import com.hai.entity.CmsCategoryExample; import java.util.List; import java.util.Map; +import org.apache.ibatis.jdbc.SQL; public class CmsCategorySqlProvider { @@ -29,6 +28,10 @@ public class CmsCategorySqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("cms_category"); + if (record.getType() != null) { + sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); + } + if (record.getParentId() != null) { sql.VALUES("parent_id", "#{parentId,jdbcType=BIGINT}"); } @@ -79,6 +82,7 @@ public class CmsCategorySqlProvider { } else { sql.SELECT("id"); } + sql.SELECT("`type`"); sql.SELECT("parent_id"); sql.SELECT("`name`"); sql.SELECT("code"); @@ -110,6 +114,10 @@ public class CmsCategorySqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); } + if (record.getType() != null) { + sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); + } + if (record.getParentId() != null) { sql.SET("parent_id = #{record.parentId,jdbcType=BIGINT}"); } @@ -159,6 +167,7 @@ public class CmsCategorySqlProvider { sql.UPDATE("cms_category"); sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); sql.SET("parent_id = #{record.parentId,jdbcType=BIGINT}"); sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); sql.SET("code = #{record.code,jdbcType=VARCHAR}"); @@ -179,6 +188,10 @@ public class CmsCategorySqlProvider { SQL sql = new SQL(); sql.UPDATE("cms_category"); + if (record.getType() != null) { + sql.SET("`type` = #{type,jdbcType=INTEGER}"); + } + if (record.getParentId() != null) { sql.SET("parent_id = #{parentId,jdbcType=BIGINT}"); } @@ -316,4 +329,4 @@ public class CmsCategorySqlProvider { sql.WHERE(sb.toString()); } } -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/CmsCategory.java b/hai-service/src/main/java/com/hai/entity/CmsCategory.java index 25987663..dd458c41 100644 --- a/hai-service/src/main/java/com/hai/entity/CmsCategory.java +++ b/hai-service/src/main/java/com/hai/entity/CmsCategory.java @@ -6,7 +6,6 @@ import java.io.Serializable; * cms_category * @author */ - /** * * 代码由工具生成 @@ -18,6 +17,11 @@ public class CmsCategory implements Serializable { */ private Long id; + /** + * 类型: 1.cms内容 2.数据库数据 + */ + private Integer type; + /** * 父级分类 */ @@ -69,6 +73,14 @@ public class CmsCategory implements Serializable { this.id = id; } + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public Long getParentId() { return parentId; } @@ -162,6 +174,7 @@ public class CmsCategory implements Serializable { } CmsCategory other = (CmsCategory) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId())) && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode())) @@ -179,6 +192,7 @@ public class CmsCategory implements Serializable { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode()); @@ -199,6 +213,7 @@ public class CmsCategory implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", type=").append(type); sb.append(", parentId=").append(parentId); sb.append(", name=").append(name); sb.append(", code=").append(code); @@ -213,4 +228,4 @@ public class CmsCategory implements Serializable { sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/CmsCategoryExample.java b/hai-service/src/main/java/com/hai/entity/CmsCategoryExample.java index 0820f986..0c3c7789 100644 --- a/hai-service/src/main/java/com/hai/entity/CmsCategoryExample.java +++ b/hai-service/src/main/java/com/hai/entity/CmsCategoryExample.java @@ -184,6 +184,66 @@ public class CmsCategoryExample { return (Criteria) this; } + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("`type` =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("`type` <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("`type` >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("`type` >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("`type` <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("`type` <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("`type` between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("`type` not between", value1, value2, "type"); + return (Criteria) this; + } + public Criteria andParentIdIsNull() { addCriterion("parent_id is null"); return (Criteria) this; @@ -949,4 +1009,4 @@ public class CmsCategoryExample { this(condition, value, secondValue, null); } } -} +} \ No newline at end of file