提交 f6f2e3d5 编写于 作者: minghao.wu's avatar minghao.wu

feature: 新增提交审批记录,新增三期获取历史轮记录

上级 05f0185d
package com.pica.cloud.online.exam.analysis.common.dto;
/**
* @author wuminghao
* @date 2018/9/4 9:19
*/
public class DoctorDto {
private Integer id;
private String name;
private String hospital;
private String title;
private String avatarImageUrl;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHospital() {
return hospital;
}
public void setHospital(String hospital) {
this.hospital = hospital;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAvatarImageUrl() {
return avatarImageUrl;
}
public void setAvatarImageUrl(String avatarImageUrl) {
this.avatarImageUrl = avatarImageUrl;
}
}
package com.pica.cloud.online.exam.analysis.common.dto;
import java.util.List;
/**
* @author wuminghao
* @date 2018/9/4 9:14
*/
public class MyStarDto {
/**
* 剩余时间 天
*/
Integer remainingDay;
/**
* 剩余时间 小时
*/
Integer remainingHour;
/**
* 剩余时间 分钟
*/
Integer getRemainingMinute;
/**
* 我的集赞数
*/
Integer myStarCount;
/**
* 活动状态 0: 集赞未结束 1: 集赞已结束
*/
Integer isFinished;
/**
* 当选状态: 0: 未当选 1: 已当选
*/
Integer isElected;
/**
* 医生信息
*/
private DoctorDto doctor;
/**
* 轮列表
*/
private List<AnalysisRoundDto> roundList;
/**
* 解析信息
*/
private List<UserExamTitleDto> myExamTitleList;
public Integer getRemainingDay() {
return remainingDay;
}
public void setRemainingDay(Integer remainingDay) {
this.remainingDay = remainingDay;
}
public Integer getRemainingHour() {
return remainingHour;
}
public void setRemainingHour(Integer remainingHour) {
this.remainingHour = remainingHour;
}
public Integer getGetRemainingMinute() {
return getRemainingMinute;
}
public void setGetRemainingMinute(Integer getRemainingMinute) {
this.getRemainingMinute = getRemainingMinute;
}
public Integer getMyStarCount() {
return myStarCount;
}
public void setMyStarCount(Integer myStarCount) {
this.myStarCount = myStarCount;
}
public Integer getIsFinished() {
return isFinished;
}
public void setIsFinished(Integer isFinished) {
this.isFinished = isFinished;
}
public Integer getIsElected() {
return isElected;
}
public void setIsElected(Integer isElected) {
this.isElected = isElected;
}
public DoctorDto getDoctor() {
return doctor;
}
public void setDoctor(DoctorDto doctor) {
this.doctor = doctor;
}
public List<AnalysisRoundDto> getRoundList() {
return roundList;
}
public void setRoundList(List<AnalysisRoundDto> roundList) {
this.roundList = roundList;
}
public List<UserExamTitleDto> getMyExamTitleList() {
return myExamTitleList;
}
public void setMyExamTitleList(List<UserExamTitleDto> myExamTitleList) {
this.myExamTitleList = myExamTitleList;
}
}
package com.pica.cloud.online.exam.analysis.common.dto;
import java.util.List;
/**
* @author wuminghao
* @date 2018/9/4 10:11
*/
public class RoundExamTitleV2Dto {
private Integer analysisId;
private Integer roundId;
private String startTime;
private String endTime;
private Integer totalCount;
private Integer published;
private List<AnalysisRoundDto> roundList;
private List<ExamTitleDto> examTitleList;
public Integer getAnalysisId() {
return analysisId;
}
public void setAnalysisId(Integer analysisId) {
this.analysisId = analysisId;
}
public Integer getRoundId() {
return roundId;
}
public void setRoundId(Integer roundId) {
this.roundId = roundId;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getPublished() {
return published;
}
public void setPublished(Integer published) {
this.published = published;
}
public List<AnalysisRoundDto> getRoundList() {
return roundList;
}
public void setRoundList(List<AnalysisRoundDto> roundList) {
this.roundList = roundList;
}
public List<ExamTitleDto> getExamTitleList() {
return examTitleList;
}
public void setExamTitleList(List<ExamTitleDto> examTitleList) {
this.examTitleList = examTitleList;
}
}
package com.pica.cloud.online.exam.analysis.common.dto;
import java.net.Inet4Address;
/**
* @author wuminghao
* @date 2018/9/4 9:30
*/
public class UserExamTitleDto {
/**
* 题目序号
*/
Integer seqNo;
/**
* 我是否解析: 0: 未解析 1: 已解析
*/
Integer isReplied;
/**
* 获赞数
*/
Integer starCount;
public Integer getSeqNo() {
return seqNo;
}
public void setSeqNo(Integer seqNo) {
this.seqNo = seqNo;
}
public Integer getIsReplied() {
return isReplied;
}
public void setIsReplied(Integer isReplied) {
this.isReplied = isReplied;
}
public Integer getStarCount() {
return starCount;
}
public void setStarCount(Integer starCount) {
this.starCount = starCount;
}
}
......@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -68,6 +69,13 @@ public class AnalysisController {
CHCAnalysisDto analysisDto = analysisService.getCHCAnalysisDtoById(id);
List<AnalysisRoundDto> roundList = analysisService.getRoundListByAnalysisId(id);
/**
* chc活动固定返回两轮, 将第一轮设置为所有
*/
if (roundList.size() == 2) {
roundList.get(0).setRoundId(-1);
}
analysisDto.setRoundList(roundList);
builder.setData(analysisDto);
} catch (Exception e) {
......@@ -443,6 +451,7 @@ public class AnalysisController {
@RequestMapping(value = "/reply/{examTitleId}", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public PicaResponse reply( @PathVariable("examTitleId") Integer examTitleId,
@RequestBody String content,
@RequestHeader String sysCode,
@RequestHeader String token) {
if (token == null) {
PicaResponse picaResponse = ReturnUtil.getPicaResponse(PicaResultCode.SYSTEM_NO_TOKEN);
......@@ -469,7 +478,7 @@ public class AnalysisController {
/**
* 如果判断检测的数据中有垃圾 直接返回
*/
PicaResponse response = antiSpamService.processString(content);
PicaResponse response = antiSpamService.processString(user != null ? user.getId() : 0, sysCode, content);
if (!response.getCode().equals(PicaResultCode.SUCCESS.code())) {
response.setData("");
return response;
......@@ -524,4 +533,51 @@ public class AnalysisController {
return 0;
}
@ApiOperation(value = "获取某一轮的题目V2", response = PicaResponse.class)
@RequestMapping(value = "/roundDetail/v2/{roundId}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public PicaResponse<RoundExamTitleV2Dto> getRoundDetailV2(@PathVariable(value = "roundId") Integer roundId) {
System.out.println("roundDetail: roundId" + roundId);
PicaResponse.Builder<RoundExamTitleV2Dto> builder = new PicaResponse.Builder<>();
try {
RoundExamTitleV2Dto roundExamTitleV2Dto = new RoundExamTitleV2Dto();
if (roundId > 0) {
/**
* 有rounfid传入时设置roundList为空
*/
roundExamTitleV2Dto.setRoundList(new ArrayList<>());
} else {
List<AnalysisRoundDto> roundDtoList = analysisService.getCHCHistoryRound();
/**
* 获取list中第一个的roundId
*/
roundId = roundDtoList.get(0).getRoundId();
roundExamTitleV2Dto.setRoundList(roundDtoList);
}
RoundExamTitleDto roundExamTitleDto = analysisService.getRoundById(roundId);
/**
* 转换格式
*/
roundExamTitleV2Dto.setAnalysisId(roundExamTitleDto.getAnalysisId());
roundExamTitleV2Dto.setRoundId(roundExamTitleDto.getRoundId());
roundExamTitleV2Dto.setStartTime(roundExamTitleV2Dto.getStartTime());
roundExamTitleV2Dto.setEndTime(roundExamTitleV2Dto.getEndTime());
roundExamTitleV2Dto.setTotalCount(roundExamTitleDto.getTotalCount());
roundExamTitleV2Dto.setPublished(roundExamTitleDto.getPublished());
List<ExamTitleDto> examTitleDtoList = analysisService.getExamTitleListByRoundId(roundId);
roundExamTitleV2Dto.setExamTitleList(examTitleDtoList);
builder.setData(roundExamTitleV2Dto);
} catch (Exception e) {
e.printStackTrace();
return ReturnUtil.getPicaResponse(PicaResultCode.SYSTEM_INNER_ERROR);
}
return builder.build();
}
}
package com.pica.cloud.online.exam.analysis.server.controller;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.RedisClient;
import com.pica.cloud.foundation.utils.entity.PICAUser;
import com.pica.cloud.online.exam.analysis.common.CommonUtils;
import com.pica.cloud.online.exam.analysis.common.util.ReturnUtil;
import com.pica.cloud.online.exam.analysis.server.service.AntiSpamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author wuminghao
* @date 2018/9/3 9:35
*/
@RestController
@RequestMapping("/antispam")
@Api(value = "内容甄别解析", description = "检测文本、图片内容")
public class AntiSpamController {
@Autowired
private RedisClient redisClient;
@Autowired
AntiSpamService antiSpamService;
@ApiOperation(value = "回复", response = PicaResponse.class)
@RequestMapping(value = "/", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public PicaResponse process(@RequestBody String content,
@RequestHeader String sysCode,
@RequestHeader String token) {
if (token == null) {
PicaResponse picaResponse = ReturnUtil.getPicaResponse(PicaResultCode.SYSTEM_NO_TOKEN);
picaResponse.setData("");
return picaResponse;
}
PICAUser user = CommonUtils.getUserByToken(redisClient, token);
if (user == null || user.getId().intValue() == 0) {
PicaResponse picaResponse = ReturnUtil.getPicaResponse(PicaResultCode.LOGIN_FAILE);
picaResponse.setData("");
return picaResponse;
}
try {
JSONObject jsonObject = JSONObject.parseObject(content);
content = jsonObject.get("content").toString();
} catch (Exception e) {
System.out.println("parse error: " + content);
return ReturnUtil.getPicaResponse(PicaResultCode.PARAM_IS_INVALID);
}
return antiSpamService.processString(user != null ? user.getId() : 0, sysCode, content);
}
}
package com.pica.cloud.online.exam.analysis.server.entity;
import java.util.Date;
public class AntiSpamRecord {
private Integer id;
private String sysCode;
private String content;
private String result;
private Byte action;
private String label;
private String hint;
private Integer createdId;
private Date createdTime;
private Integer modifiedId;
private Date modifiedTime;
private Boolean isDeleted;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSysCode() {
return sysCode;
}
public void setSysCode(String sysCode) {
this.sysCode = sysCode == null ? null : sysCode.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result == null ? null : result.trim();
}
public Byte getAction() {
return action;
}
public void setAction(Byte action) {
this.action = action;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label == null ? null : label.trim();
}
public String getHint() {
return hint;
}
public void setHint(String hint) {
this.hint = hint == null ? null : hint.trim();
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
public Boolean getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
}
\ No newline at end of file
......@@ -20,4 +20,6 @@ public interface AnalysisRoundMapper {
List<AnalysisRound> selectRoundListById(Integer id);
List<AnalysisRound> selectPSARoundListById(Integer id);
List<AnalysisRound> selectHistoryRoundListById(Integer id);
}
\ No newline at end of file
package com.pica.cloud.online.exam.analysis.server.mapper;
import com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord;
public interface AntiSpamRecordMapper {
int deleteByPrimaryKey(Integer id);
int insert(AntiSpamRecord record);
int insertSelective(AntiSpamRecord record);
AntiSpamRecord selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AntiSpamRecord record);
int updateByPrimaryKey(AntiSpamRecord record);
}
\ No newline at end of file
......@@ -7,9 +7,11 @@ import com.pica.cloud.foundation.entity.PicaResponse;
* @date 2018/8/27 14:38
*/
public interface AntiSpamService {
PicaResponse processString(String content);
PicaResponse processString(Integer userId, String sysCode, String content);
boolean processImageContent(String content);
boolean processImageContent(Integer userId, String sysCode, String content);
boolean processImage(String url);
boolean processImage(Integer userId, String sysCode, String url);
int insertRecord(Integer userId, String sysCode, String content, String result, Byte action, int label, String hint);
}
......@@ -156,4 +156,10 @@ public interface CHCAnalysisService {
* @return
*/
List<Reply> getReplyList(Integer examTitleId);
/**
* 获取所有的历史轮详情
* @return
*/
List<AnalysisRoundDto> getCHCHistoryRound();
}
......@@ -8,6 +8,8 @@ import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.online.exam.analysis.common.util.ReturnUtil;
import com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfiguration;
import com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord;
import com.pica.cloud.online.exam.analysis.server.mapper.AntiSpamRecordMapper;
import com.pica.cloud.online.exam.analysis.server.service.AntiSpamService;
import com.pica.cloud.online.exam.analysis.server.utils.HttpClient4Utils;
import com.pica.cloud.online.exam.analysis.server.utils.SignatureUtils;
......@@ -29,15 +31,18 @@ public class AntiSpamServiceImpl implements AntiSpamService {
@Autowired
private PropertiesConfiguration properties;
@Autowired
private AntiSpamRecordMapper antiSpamRecordMapper;
private static HttpClient httpClient = HttpClient4Utils.createHttpClient(100, 20, 2000, 2000, 2000);
private static HttpClient httpClientImage = HttpClient4Utils.createHttpClient(100, 20, 10000, 2000, 2000);
@Override
public PicaResponse processString(String content) {
public PicaResponse processString(Integer userId, String sysCode, String content) {
/**
* 过滤图片
*/
if (!processImageContent(content)) {
return ReturnUtil.getPicaResponse("400002", "图片包含违禁内容,请修改后重新输入");
if (!processImageContent(userId, sysCode, content)) {
return ReturnUtil.getPicaResponse("400002", "图片包含违禁内容,请修改后重新输入", "");
}
Map<String, String> params = new HashMap<String, String>();
......@@ -100,7 +105,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
* action: 2 不通过
*/
if (action == 0) {
insertRecord(userId, sysCode, content, response, (byte)action, 0, "");
} else {
for (JsonElement labelElement : labelArray) {
JsonObject lObject = labelElement.getAsJsonObject();
......@@ -116,7 +121,8 @@ public class AntiSpamServiceImpl implements AntiSpamService {
else if (label == 600) msg = "输入内容包含谩骂词汇,请修改后重新输入";
else if (label == 700) msg = "输入内容包含灌水词汇,请修改后重新输入";
return ReturnUtil.getPicaResponse("400002", msg);
insertRecord(userId, sysCode, content, response, (byte)action, label, detailsObject.getAsString());
return ReturnUtil.getPicaResponse("400002", msg, "");
}
}
......@@ -129,7 +135,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
@Override
public boolean processImageContent(String content) {
public boolean processImageContent(Integer userId, String sysCode, String content) {
List<String> imageUrlList = new ArrayList<>();
/**
......@@ -150,7 +156,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
/**
* 检测出某张图片失败 则返回
*/
if (!processImage(url)) {
if (!processImage(userId, sysCode, url)) {
return false;
}
}
......@@ -158,7 +164,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
@Override
public boolean processImage(String url) {
public boolean processImage(Integer userId, String sysCode, String url) {
Map<String, String> params = new HashMap<String, String>();
/**
......@@ -226,6 +232,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
*/
int maxLevel = -1;
double maxRate = 0.0;
int maxLable = 0;
// 产品需根据自身需求,自行解析处理,本示例只是简单判断分类级别
for (JsonElement labelElement : labelArray) {
JsonObject lObject = labelElement.getAsJsonObject();
......@@ -234,18 +241,49 @@ public class AntiSpamServiceImpl implements AntiSpamService {
double rate = lObject.get("rate").getAsDouble();
if (label == 100 || label == 110 || label == 210) {
System.out.println(String.format("label:%s, level=%s, rate=%s", label, level, rate));
maxLevel = level > maxLevel ? level : maxLevel;
if (level > maxLevel) {
maxLevel = level;
maxLable = label;
}
maxRate = rate > maxRate ? rate : maxRate;
}
}
if (maxLevel == 2) {
insertRecord(userId, sysCode, url, response, (byte)maxLevel, maxLable, "");
return false;
}
}
} else {
System.out.println(String.format("ERROR: code=%s, msg=%s", code, msg));
}
/**
* 成功
*/
insertRecord(userId, sysCode, url, response, (byte)0,0, "");
return true;
}
@Override
public int insertRecord(Integer userId, String sysCode, String content, String result, Byte action, int label, String hint) {
AntiSpamRecord antiSpamRecord = new AntiSpamRecord();
antiSpamRecord.setSysCode(sysCode);
antiSpamRecord.setContent(content);
antiSpamRecord.setResult(result);
antiSpamRecord.setAction(action);
StringBuilder sb = new StringBuilder();
sb.append(label);
antiSpamRecord.setLabel(sb.toString());
antiSpamRecord.setHint(hint);
antiSpamRecord.setCreatedId(userId);
antiSpamRecord.setCreatedTime(new Date());
antiSpamRecord.setModifiedId(userId);
antiSpamRecord.setModifiedTime(new Date());
antiSpamRecord.setIsDeleted(false);
return antiSpamRecordMapper.insert(antiSpamRecord);
}
}
......@@ -163,14 +163,6 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
public List<ExamTitleDto> getExamTitleListByRoundId(Integer roundId) {
List<AnalysisRoundExamTitle> roundExamTitleList = analysisRoundExamTitleMapper.selectExamTitleListByRoundId(roundId);
/**
* TODO: 上一轮的id 测试用
*/
if (roundId == 2) {
List<AnalysisRoundExamTitle> roundExamTitleList1 = analysisRoundExamTitleMapper.selectExamTitleListByRoundId(1);
roundExamTitleList.addAll(roundExamTitleList1);
}
if (null == roundExamTitleList) {
return null;
}
......@@ -201,15 +193,6 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
examTitleDto.setType(analysisRoundExamTitle.getExamTitleType());
examTitleDto.setQuestion(analysisRoundExamTitle.getSeqNo().toString() + "." + analysisRoundExamTitle.getQuestion());
/**
* TODO: 删除 临时使用
*/
if (analysisRoundExamTitle.getRoundId().intValue() == 1) {
examTitleDto.setQuestion("[第一期]" + examTitleDto.getQuestion());
} else if (analysisRoundExamTitle.getRoundId().intValue() == 2) {
examTitleDto.setQuestion("[第二期]" + examTitleDto.getQuestion());
}
/**
* 设置选项
*/
......@@ -513,4 +496,44 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return replyListOther;
}
@Override
public List<AnalysisRoundDto> getCHCHistoryRound() {
List<AnalysisRound> roundList = new ArrayList<>();
/**
* TODO: 需要前端传入id
*/
roundList = analysisRoundMapper.selectHistoryRoundListById(1);
List<AnalysisRoundDto> roundDtoList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date dt = new Date();
for (AnalysisRound round : roundList) {
AnalysisRoundDto roundDto = new AnalysisRoundDto();
roundDto.setRoundId(round.getId());
roundDto.setAnalysisId(round.getAnalysisId());
roundDto.setName(round.getRoundName());
roundDto.setIntro(round.getIntro());
roundDto.setStartTime(sdf.format(round.getStartTime()));
roundDto.setEndTime(sdf.format(round.getEndTime()));
roundDto.setSeqNo(round.getSeqNo());
/**
* 如果时间过期 设置超时
*/
if (dt.getTime() > round.getEndTime().getTime()) {
roundDto.setPublished(2);
} else {
roundDto.setPublished(round.getIsPublished() ? 1 : 0);
}
roundDtoList.add(roundDto);
}
return roundDtoList;
}
}
......@@ -44,8 +44,9 @@
<table tableName="pica_online_exam.p_analysis_round_exam_title" domainObjectName="AnalysisRoundExamTitle" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="pica_online_exam.p_reply" domainObjectName="Reply" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="pica_online_exam.p_reply_image" domainObjectName="ReplyImage" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
-->
<table tableName="pica_online_exam.p_star_record" domainObjectName="StarRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
-->
<table tableName="pica_online_exam.p_anti_spam_record" domainObjectName="AntiSpamRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
......
......@@ -34,6 +34,7 @@
where analysis_id = #{id,jdbcType=INTEGER}
and is_deleted = 0
and seq_no >= (select seq_no from p_analysis_round where is_published = 1 and is_deleted = 0 limit 1)
order by seq_no
limit 2
</select>
......@@ -47,6 +48,16 @@
limit 1
</select>
<select id="selectHistoryRoundListById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from p_analysis_round
where analysis_id = #{id,jdbcType=INTEGER}
and is_deleted = 0
and seq_no &lt;= (select seq_no from p_analysis_round where is_published = 1 and is_deleted = 0 limit 1)
order by seq_no
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from p_analysis_round
where id = #{id,jdbcType=INTEGER}
......
<?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="com.pica.cloud.online.exam.analysis.server.mapper.AntiSpamRecordMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sys_code" jdbcType="VARCHAR" property="sysCode" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="action" jdbcType="TINYINT" property="action" />
<result column="label" jdbcType="VARCHAR" property="label" />
<result column="hint" jdbcType="VARCHAR" property="hint" />
<result column="created_id" jdbcType="INTEGER" property="createdId" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="modified_id" jdbcType="INTEGER" property="modifiedId" />
<result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
id, sys_code, content, result, action, label, hint, created_id, created_time, modified_id,
modified_time, is_deleted
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from p_anti_spam_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from p_anti_spam_record
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord">
insert into p_anti_spam_record (id, sys_code, content,
result, action, label,
hint, created_id, created_time,
modified_id, modified_time, is_deleted
)
values (#{id,jdbcType=INTEGER}, #{sysCode,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{result,jdbcType=VARCHAR}, #{action,jdbcType=TINYINT}, #{label,jdbcType=VARCHAR},
#{hint,jdbcType=VARCHAR}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord">
insert into p_anti_spam_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sysCode != null">
sys_code,
</if>
<if test="content != null">
content,
</if>
<if test="result != null">
result,
</if>
<if test="action != null">
action,
</if>
<if test="label != null">
label,
</if>
<if test="hint != null">
hint,
</if>
<if test="createdId != null">
created_id,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="modifiedId != null">
modified_id,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
<if test="isDeleted != null">
is_deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="sysCode != null">
#{sysCode,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="action != null">
#{action,jdbcType=TINYINT},
</if>
<if test="label != null">
#{label,jdbcType=VARCHAR},
</if>
<if test="hint != null">
#{hint,jdbcType=VARCHAR},
</if>
<if test="createdId != null">
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="isDeleted != null">
#{isDeleted,jdbcType=BIT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord">
update p_anti_spam_record
<set>
<if test="sysCode != null">
sys_code = #{sysCode,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="result != null">
result = #{result,jdbcType=VARCHAR},
</if>
<if test="action != null">
action = #{action,jdbcType=TINYINT},
</if>
<if test="label != null">
label = #{label,jdbcType=VARCHAR},
</if>
<if test="hint != null">
hint = #{hint,jdbcType=VARCHAR},
</if>
<if test="createdId != null">
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord">
update p_anti_spam_record
set sys_code = #{sysCode,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
result = #{result,jdbcType=VARCHAR},
action = #{action,jdbcType=TINYINT},
label = #{label,jdbcType=VARCHAR},
hint = #{hint,jdbcType=VARCHAR},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
is_deleted = #{isDeleted,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册