提交 3ab76dbf 编写于 作者: yubinCloud's avatar yubinCloud

8-2 增加文档表SQL,并生成相应的持久层代码

上级 7654cbdb
......@@ -43,4 +43,25 @@ insert into `category` (id, parent, name, sort) values (401, 400, 'MySQL', 401);
insert into `category` (id, parent, name, sort) values (500, 000, '其它', 500);
insert into `category` (id, parent, name, sort) values (501, 500, '服务器', 501);
insert into `category` (id, parent, name, sort) values (502, 500, '开发工具', 502);
insert into `category` (id, parent, name, sort) values (503, 500, '热门服务端语言', 503);
\ No newline at end of file
insert into `category` (id, parent, name, sort) values (503, 500, '热门服务端语言', 503);
-- 文档表
drop table if exists `doc`;
create table `doc` (
`id` bigint not null comment 'id',
`ebook_id` bigint not null default 0 comment '电子书id',
`parent` bigint not null default 0 comment '父id',
`name` varchar(50) not null comment '名称',
`sort` int comment '顺序',
`view_count` int default 0 comment '阅读数',
`vote_count` int default 0 comment '点赞数',
primary key (`id`)
) engine=innodb default charset=utf8mb4 comment='文档';
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (1, 1, 0, '文档1', 1, 0, 0);
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (2, 1, 1, '文档1.1', 1, 0, 0);
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (3, 1, 0, '文档2', 2, 0, 0);
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (4, 1, 3, '文档2.1', 1, 0, 0);
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (5, 1, 3, '文档2.2', 2, 0, 0);
insert into `doc` (id, ebook_id, parent, name, sort, view_count, vote_count) values (6, 1, 5, '文档2.2.1', 1, 0, 0);
package io.github.yubincloud.fairywiki.domain;
public class Doc {
private Long id;
private Long ebookId;
private Long parent;
private String name;
private Integer sort;
private Integer viewCount;
private Integer voteCount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getEbookId() {
return ebookId;
}
public void setEbookId(Long ebookId) {
this.ebookId = ebookId;
}
public Long getParent() {
return parent;
}
public void setParent(Long parent) {
this.parent = parent;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(Integer viewCount) {
this.viewCount = viewCount;
}
public Integer getVoteCount() {
return voteCount;
}
public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}
@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(", ebookId=").append(ebookId);
sb.append(", parent=").append(parent);
sb.append(", name=").append(name);
sb.append(", sort=").append(sort);
sb.append(", viewCount=").append(viewCount);
sb.append(", voteCount=").append(voteCount);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package io.github.yubincloud.fairywiki.domain;
import java.util.ArrayList;
import java.util.List;
public class DocExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public DocExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andEbookIdIsNull() {
addCriterion("ebook_id is null");
return (Criteria) this;
}
public Criteria andEbookIdIsNotNull() {
addCriterion("ebook_id is not null");
return (Criteria) this;
}
public Criteria andEbookIdEqualTo(Long value) {
addCriterion("ebook_id =", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdNotEqualTo(Long value) {
addCriterion("ebook_id <>", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdGreaterThan(Long value) {
addCriterion("ebook_id >", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdGreaterThanOrEqualTo(Long value) {
addCriterion("ebook_id >=", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdLessThan(Long value) {
addCriterion("ebook_id <", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdLessThanOrEqualTo(Long value) {
addCriterion("ebook_id <=", value, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdIn(List<Long> values) {
addCriterion("ebook_id in", values, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdNotIn(List<Long> values) {
addCriterion("ebook_id not in", values, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdBetween(Long value1, Long value2) {
addCriterion("ebook_id between", value1, value2, "ebookId");
return (Criteria) this;
}
public Criteria andEbookIdNotBetween(Long value1, Long value2) {
addCriterion("ebook_id not between", value1, value2, "ebookId");
return (Criteria) this;
}
public Criteria andParentIsNull() {
addCriterion("parent is null");
return (Criteria) this;
}
public Criteria andParentIsNotNull() {
addCriterion("parent is not null");
return (Criteria) this;
}
public Criteria andParentEqualTo(Long value) {
addCriterion("parent =", value, "parent");
return (Criteria) this;
}
public Criteria andParentNotEqualTo(Long value) {
addCriterion("parent <>", value, "parent");
return (Criteria) this;
}
public Criteria andParentGreaterThan(Long value) {
addCriterion("parent >", value, "parent");
return (Criteria) this;
}
public Criteria andParentGreaterThanOrEqualTo(Long value) {
addCriterion("parent >=", value, "parent");
return (Criteria) this;
}
public Criteria andParentLessThan(Long value) {
addCriterion("parent <", value, "parent");
return (Criteria) this;
}
public Criteria andParentLessThanOrEqualTo(Long value) {
addCriterion("parent <=", value, "parent");
return (Criteria) this;
}
public Criteria andParentIn(List<Long> values) {
addCriterion("parent in", values, "parent");
return (Criteria) this;
}
public Criteria andParentNotIn(List<Long> values) {
addCriterion("parent not in", values, "parent");
return (Criteria) this;
}
public Criteria andParentBetween(Long value1, Long value2) {
addCriterion("parent between", value1, value2, "parent");
return (Criteria) this;
}
public Criteria andParentNotBetween(Long value1, Long value2) {
addCriterion("parent not between", value1, value2, "parent");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andViewCountIsNull() {
addCriterion("view_count is null");
return (Criteria) this;
}
public Criteria andViewCountIsNotNull() {
addCriterion("view_count is not null");
return (Criteria) this;
}
public Criteria andViewCountEqualTo(Integer value) {
addCriterion("view_count =", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountNotEqualTo(Integer value) {
addCriterion("view_count <>", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountGreaterThan(Integer value) {
addCriterion("view_count >", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountGreaterThanOrEqualTo(Integer value) {
addCriterion("view_count >=", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountLessThan(Integer value) {
addCriterion("view_count <", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountLessThanOrEqualTo(Integer value) {
addCriterion("view_count <=", value, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountIn(List<Integer> values) {
addCriterion("view_count in", values, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountNotIn(List<Integer> values) {
addCriterion("view_count not in", values, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountBetween(Integer value1, Integer value2) {
addCriterion("view_count between", value1, value2, "viewCount");
return (Criteria) this;
}
public Criteria andViewCountNotBetween(Integer value1, Integer value2) {
addCriterion("view_count not between", value1, value2, "viewCount");
return (Criteria) this;
}
public Criteria andVoteCountIsNull() {
addCriterion("vote_count is null");
return (Criteria) this;
}
public Criteria andVoteCountIsNotNull() {
addCriterion("vote_count is not null");
return (Criteria) this;
}
public Criteria andVoteCountEqualTo(Integer value) {
addCriterion("vote_count =", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountNotEqualTo(Integer value) {
addCriterion("vote_count <>", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountGreaterThan(Integer value) {
addCriterion("vote_count >", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountGreaterThanOrEqualTo(Integer value) {
addCriterion("vote_count >=", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountLessThan(Integer value) {
addCriterion("vote_count <", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountLessThanOrEqualTo(Integer value) {
addCriterion("vote_count <=", value, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountIn(List<Integer> values) {
addCriterion("vote_count in", values, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountNotIn(List<Integer> values) {
addCriterion("vote_count not in", values, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountBetween(Integer value1, Integer value2) {
addCriterion("vote_count between", value1, value2, "voteCount");
return (Criteria) this;
}
public Criteria andVoteCountNotBetween(Integer value1, Integer value2) {
addCriterion("vote_count not between", value1, value2, "voteCount");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package io.github.yubincloud.fairywiki.mapper;
import io.github.yubincloud.fairywiki.domain.Doc;
import io.github.yubincloud.fairywiki.domain.DocExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DocMapper {
long countByExample(DocExample example);
int deleteByExample(DocExample example);
int deleteByPrimaryKey(Long id);
int insert(Doc record);
int insertSelective(Doc record);
List<Doc> selectByExample(DocExample example);
Doc selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Doc record, @Param("example") DocExample example);
int updateByExample(@Param("record") Doc record, @Param("example") DocExample example);
int updateByPrimaryKeySelective(Doc record);
int updateByPrimaryKey(Doc record);
}
\ No newline at end of file
......@@ -40,6 +40,6 @@
targetPackage="io.github.yubincloud.fairywiki.mapper"
type="XMLMAPPER"/>
<table tableName="category"/>
<table tableName="doc"/>
</context>
</generatorConfiguration>
<?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="io.github.yubincloud.fairywiki.mapper.DocMapper">
<resultMap id="BaseResultMap" type="io.github.yubincloud.fairywiki.domain.Doc">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="ebook_id" jdbcType="BIGINT" property="ebookId" />
<result column="parent" jdbcType="BIGINT" property="parent" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="view_count" jdbcType="INTEGER" property="viewCount" />
<result column="vote_count" jdbcType="INTEGER" property="voteCount" />
</resultMap>
<sql id="Example_Where_Clause">
<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>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.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>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, ebook_id, parent, `name`, sort, view_count, vote_count
</sql>
<select id="selectByExample" parameterType="io.github.yubincloud.fairywiki.domain.DocExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from doc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from doc
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from doc
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.github.yubincloud.fairywiki.domain.DocExample">
delete from doc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.github.yubincloud.fairywiki.domain.Doc">
insert into doc (id, ebook_id, parent,
`name`, sort, view_count,
vote_count)
values (#{id,jdbcType=BIGINT}, #{ebookId,jdbcType=BIGINT}, #{parent,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{viewCount,jdbcType=INTEGER},
#{voteCount,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="io.github.yubincloud.fairywiki.domain.Doc">
insert into doc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="ebookId != null">
ebook_id,
</if>
<if test="parent != null">
parent,
</if>
<if test="name != null">
`name`,
</if>
<if test="sort != null">
sort,
</if>
<if test="viewCount != null">
view_count,
</if>
<if test="voteCount != null">
vote_count,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="ebookId != null">
#{ebookId,jdbcType=BIGINT},
</if>
<if test="parent != null">
#{parent,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="viewCount != null">
#{viewCount,jdbcType=INTEGER},
</if>
<if test="voteCount != null">
#{voteCount,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.github.yubincloud.fairywiki.domain.DocExample" resultType="java.lang.Long">
select count(*) from doc
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update doc
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.ebookId != null">
ebook_id = #{record.ebookId,jdbcType=BIGINT},
</if>
<if test="record.parent != null">
parent = #{record.parent,jdbcType=BIGINT},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.viewCount != null">
view_count = #{record.viewCount,jdbcType=INTEGER},
</if>
<if test="record.voteCount != null">
vote_count = #{record.voteCount,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update doc
set id = #{record.id,jdbcType=BIGINT},
ebook_id = #{record.ebookId,jdbcType=BIGINT},
parent = #{record.parent,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
view_count = #{record.viewCount,jdbcType=INTEGER},
vote_count = #{record.voteCount,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.github.yubincloud.fairywiki.domain.Doc">
update doc
<set>
<if test="ebookId != null">
ebook_id = #{ebookId,jdbcType=BIGINT},
</if>
<if test="parent != null">
parent = #{parent,jdbcType=BIGINT},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="viewCount != null">
view_count = #{viewCount,jdbcType=INTEGER},
</if>
<if test="voteCount != null">
vote_count = #{voteCount,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.github.yubincloud.fairywiki.domain.Doc">
update doc
set ebook_id = #{ebookId,jdbcType=BIGINT},
parent = #{parent,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
view_count = #{viewCount,jdbcType=INTEGER},
vote_count = #{voteCount,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册