cgy添加使用记录
This commit is contained in:
parent
7e96b047c2
commit
0b2dce823e
10
sql/20210312-zhangsai.sql
Normal file
10
sql/20210312-zhangsai.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- auto-generated definition
|
||||
create table cgy_record
|
||||
(
|
||||
id int not null
|
||||
primary key,
|
||||
browse_count int null comment '浏览次数',
|
||||
download_count int null comment '百度网盘链接打开次数'
|
||||
)
|
||||
comment '成都工业项目使用记录';
|
||||
|
@ -56,6 +56,8 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
whiteList.add("/api/learn/{postId}/message/pagedQuery/postId");
|
||||
whiteList.add("/api/learn/{messageId}/comment");
|
||||
whiteList.add("/api/learn/cgy/updateMessageTime");
|
||||
// 成都工业使用记录
|
||||
whiteList.add("/api/cgy/**");
|
||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package club.joylink.rtss.controller;
|
||||
|
||||
import club.joylink.rtss.services.CgyRecordService;
|
||||
import club.joylink.rtss.vo.client.CgyRecordVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 成都工业
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/cgy")
|
||||
public class CGYController {
|
||||
@Autowired
|
||||
private CgyRecordService cgyRecordService;
|
||||
|
||||
@GetMapping("/record")
|
||||
public CgyRecordVO getBrowseCount() {
|
||||
return cgyRecordService.getRecord();
|
||||
}
|
||||
|
||||
@PutMapping("/browse")
|
||||
public void browseCount() {
|
||||
cgyRecordService.browseCount();
|
||||
}
|
||||
|
||||
@PutMapping("/download")
|
||||
public void downloadCount() {
|
||||
cgyRecordService.downloadCount();
|
||||
}
|
||||
}
|
12
src/main/java/club/joylink/rtss/dao/CgyRecordDAO.java
Normal file
12
src/main/java/club/joylink/rtss/dao/CgyRecordDAO.java
Normal file
@ -0,0 +1,12 @@
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.CgyRecord;
|
||||
import club.joylink.rtss.entity.CgyRecordExample;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* CgyRecordDAO继承基类
|
||||
*/
|
||||
@Repository
|
||||
public interface CgyRecordDAO extends MyBatisBaseDao<CgyRecord, Integer, CgyRecordExample> {
|
||||
}
|
88
src/main/java/club/joylink/rtss/entity/CgyRecord.java
Normal file
88
src/main/java/club/joylink/rtss/entity/CgyRecord.java
Normal file
@ -0,0 +1,88 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* 成都工业项目使用记录
|
||||
*/
|
||||
public class CgyRecord implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 浏览次数
|
||||
*/
|
||||
private Integer browseCount;
|
||||
|
||||
/**
|
||||
* 百度网盘链接打开次数
|
||||
*/
|
||||
private Integer downloadCount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getBrowseCount() {
|
||||
return browseCount;
|
||||
}
|
||||
|
||||
public void setBrowseCount(Integer browseCount) {
|
||||
this.browseCount = browseCount;
|
||||
}
|
||||
|
||||
public Integer getDownloadCount() {
|
||||
return downloadCount;
|
||||
}
|
||||
|
||||
public void setDownloadCount(Integer downloadCount) {
|
||||
this.downloadCount = downloadCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CgyRecord other = (CgyRecord) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getBrowseCount() == null ? other.getBrowseCount() == null : this.getBrowseCount().equals(other.getBrowseCount()))
|
||||
&& (this.getDownloadCount() == null ? other.getDownloadCount() == null : this.getDownloadCount().equals(other.getDownloadCount()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getBrowseCount() == null) ? 0 : getBrowseCount().hashCode());
|
||||
result = prime * result + ((getDownloadCount() == null) ? 0 : getDownloadCount().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(", browseCount=").append(browseCount);
|
||||
sb.append(", downloadCount=").append(downloadCount);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
402
src/main/java/club/joylink/rtss/entity/CgyRecordExample.java
Normal file
402
src/main/java/club/joylink/rtss/entity/CgyRecordExample.java
Normal file
@ -0,0 +1,402 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CgyRecordExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
private Integer limit;
|
||||
|
||||
private Long offset;
|
||||
|
||||
public CgyRecordExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setOffset(Long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Long getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
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(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountIsNull() {
|
||||
addCriterion("browse_count is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountIsNotNull() {
|
||||
addCriterion("browse_count is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountEqualTo(Integer value) {
|
||||
addCriterion("browse_count =", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountNotEqualTo(Integer value) {
|
||||
addCriterion("browse_count <>", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountGreaterThan(Integer value) {
|
||||
addCriterion("browse_count >", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("browse_count >=", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountLessThan(Integer value) {
|
||||
addCriterion("browse_count <", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("browse_count <=", value, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountIn(List<Integer> values) {
|
||||
addCriterion("browse_count in", values, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountNotIn(List<Integer> values) {
|
||||
addCriterion("browse_count not in", values, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountBetween(Integer value1, Integer value2) {
|
||||
addCriterion("browse_count between", value1, value2, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBrowseCountNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("browse_count not between", value1, value2, "browseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountIsNull() {
|
||||
addCriterion("download_count is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountIsNotNull() {
|
||||
addCriterion("download_count is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountEqualTo(Integer value) {
|
||||
addCriterion("download_count =", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountNotEqualTo(Integer value) {
|
||||
addCriterion("download_count <>", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountGreaterThan(Integer value) {
|
||||
addCriterion("download_count >", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("download_count >=", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountLessThan(Integer value) {
|
||||
addCriterion("download_count <", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("download_count <=", value, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountIn(List<Integer> values) {
|
||||
addCriterion("download_count in", values, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountNotIn(List<Integer> values) {
|
||||
addCriterion("download_count not in", values, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountBetween(Integer value1, Integer value2) {
|
||||
addCriterion("download_count between", value1, value2, "downloadCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDownloadCountNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("download_count not between", value1, value2, "downloadCount");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.dao.CgyRecordDAO;
|
||||
import club.joylink.rtss.dao.SysUserLoginDAO;
|
||||
import club.joylink.rtss.entity.CgyRecord;
|
||||
import club.joylink.rtss.entity.SysUserLoginExample;
|
||||
import club.joylink.rtss.vo.client.CgyRecordVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 成都工业项目使用记录
|
||||
*/
|
||||
@Service
|
||||
public class CgyRecordService {
|
||||
@Autowired
|
||||
private SysUserLoginDAO sysUserLoginDAO;
|
||||
|
||||
@Autowired
|
||||
private CgyRecordDAO cgyRecordDAO;
|
||||
|
||||
public CgyRecordVO getRecord() {
|
||||
long loginCount = getLoginCount();
|
||||
CgyRecord entity = findEntity();
|
||||
if (entity == null) {
|
||||
return new CgyRecordVO(loginCount, 0, 0);
|
||||
} else {
|
||||
return new CgyRecordVO(loginCount, entity.getBrowseCount(), entity.getDownloadCount());
|
||||
}
|
||||
}
|
||||
|
||||
public void browseCount() {
|
||||
CgyRecord entity = findEntity();
|
||||
if (entity == null) {
|
||||
CgyRecord cgyRecord = new CgyRecord();
|
||||
cgyRecord.setBrowseCount(1);
|
||||
cgyRecord.setDownloadCount(0);
|
||||
cgyRecordDAO.insert(cgyRecord);
|
||||
} else {
|
||||
entity.setBrowseCount(entity.getBrowseCount() + 1);
|
||||
cgyRecordDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadCount() {
|
||||
CgyRecord entity = findEntity();
|
||||
if (entity == null) {
|
||||
CgyRecord cgyRecord = new CgyRecord();
|
||||
cgyRecord.setBrowseCount(0);
|
||||
cgyRecord.setDownloadCount(1);
|
||||
cgyRecordDAO.insert(cgyRecord);
|
||||
} else {
|
||||
entity.setDownloadCount(entity.getDownloadCount() + 1);
|
||||
cgyRecordDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
}
|
||||
|
||||
private long getLoginCount() {
|
||||
SysUserLoginExample example = new SysUserLoginExample();
|
||||
example.createCriteria().andProjectEqualTo(Project.CGY.name());
|
||||
return sysUserLoginDAO.countByExample(example);
|
||||
}
|
||||
|
||||
private CgyRecord findEntity() {
|
||||
return cgyRecordDAO.selectByPrimaryKey(1);
|
||||
}
|
||||
}
|
25
src/main/java/club/joylink/rtss/vo/client/CgyRecordVO.java
Normal file
25
src/main/java/club/joylink/rtss/vo/client/CgyRecordVO.java
Normal file
@ -0,0 +1,25 @@
|
||||
package club.joylink.rtss.vo.client;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 成都工业使用记录
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class CgyRecordVO {
|
||||
private long loginCount;
|
||||
|
||||
private int browseCount;
|
||||
|
||||
private int downloadCount;
|
||||
|
||||
public CgyRecordVO(long loginCount, int browseCount, int downloadCount) {
|
||||
this.loginCount = loginCount;
|
||||
this.browseCount = browseCount;
|
||||
this.downloadCount = downloadCount;
|
||||
}
|
||||
}
|
181
src/main/resources/mybatis/mapper/CgyRecordDAO.xml
Normal file
181
src/main/resources/mybatis/mapper/CgyRecordDAO.xml
Normal file
@ -0,0 +1,181 @@
|
||||
<?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="club.joylink.rtss.dao.CgyRecordDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CgyRecord">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="browse_count" jdbcType="INTEGER" property="browseCount" />
|
||||
<result column="download_count" jdbcType="INTEGER" property="downloadCount" />
|
||||
</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, browse_count, download_count
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from cgy_record
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limit != null">
|
||||
<if test="offset != null">
|
||||
limit ${offset}, ${limit}
|
||||
</if>
|
||||
<if test="offset == null">
|
||||
limit ${limit}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from cgy_record
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from cgy_record
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample">
|
||||
delete from cgy_record
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CgyRecord" useGeneratedKeys="true">
|
||||
insert into cgy_record (browse_count, download_count)
|
||||
values (#{browseCount,jdbcType=INTEGER}, #{downloadCount,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CgyRecord" useGeneratedKeys="true">
|
||||
insert into cgy_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="browseCount != null">
|
||||
browse_count,
|
||||
</if>
|
||||
<if test="downloadCount != null">
|
||||
download_count,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="browseCount != null">
|
||||
#{browseCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="downloadCount != null">
|
||||
#{downloadCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.CgyRecordExample" resultType="java.lang.Long">
|
||||
select count(*) from cgy_record
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update cgy_record
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.browseCount != null">
|
||||
browse_count = #{record.browseCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.downloadCount != null">
|
||||
download_count = #{record.downloadCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update cgy_record
|
||||
set id = #{record.id,jdbcType=INTEGER},
|
||||
browse_count = #{record.browseCount,jdbcType=INTEGER},
|
||||
download_count = #{record.downloadCount,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CgyRecord">
|
||||
update cgy_record
|
||||
<set>
|
||||
<if test="browseCount != null">
|
||||
browse_count = #{browseCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="downloadCount != null">
|
||||
download_count = #{downloadCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CgyRecord">
|
||||
update cgy_record
|
||||
set browse_count = #{browseCount,jdbcType=INTEGER},
|
||||
download_count = #{downloadCount,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user