Browse Source

激活码相关表改动

master
tianziyan 16 hours ago
parent
commit
ebe39f0207
  1. 119
      mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookActivateBatchController.java
  2. 30
      mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookActivateController.java
  3. 10
      mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookController.java
  4. 2
      mmxt-admin/src/main/resources/application-pro.yml
  5. 102
      mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivate.java
  6. 167
      mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivateBatch.java
  7. 42
      mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivateLog.java
  8. 129
      mmxt-business/src/main/java/com/mmxt/business/domain/vo/MmxtMeiyuTextbookActivateVo.java
  9. 68
      mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookActivateBatchMapper.java
  10. 29
      mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookActivateMapper.java
  11. 7
      mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookMapper.java
  12. 72
      mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookActivateBatchService.java
  13. 8
      mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookActivateService.java
  14. 7
      mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookService.java
  15. 233
      mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookActivateBatchServiceImpl.java
  16. 107
      mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookActivateServiceImpl.java
  17. 10
      mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookServiceImpl.java
  18. 146
      mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateBatchMapper.xml
  19. 25
      mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateLogMapper.xml
  20. 153
      mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateMapper.xml
  21. 6
      mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookMapper.xml
  22. 3
      mmxt-framework/src/main/java/com/mmxt/framework/manager/factory/AsyncFactory.java
  23. 52
      mmxt-system/src/main/java/com/mmxt/system/domain/SysLogininfor.java
  24. 43
      mmxt-system/src/main/resources/mapper/system/SysLogininforMapper.xml

119
mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookActivateBatchController.java

@ -0,0 +1,119 @@
package com.mmxt.web.controller.mmxt;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mmxt.common.annotation.Log;
import com.mmxt.common.core.controller.BaseController;
import com.mmxt.common.core.domain.AjaxResult;
import com.mmxt.common.enums.BusinessType;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch;
import com.mmxt.business.service.IMmxtMeiyuTextbookActivateBatchService;
import com.mmxt.common.utils.poi.ExcelUtil;
import com.mmxt.common.core.page.TableDataInfo;
/**
* 美美学堂智慧美育教材学习卡激活批次Controller
*
* @author mmxt
* @date 2026-03-04
*/
@RestController
@RequestMapping("/mmxt/mmxtMeiyuTextbookActivateBatch")
public class MmxtMeiyuTextbookActivateBatchController extends BaseController
{
@Autowired
private IMmxtMeiyuTextbookActivateBatchService mmxtMeiyuTextbookActivateBatchService;
/**
* 查询美美学堂智慧美育教材学习卡激活批次列表
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:list')")
@GetMapping("/list")
public TableDataInfo list(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
startPage();
List<MmxtMeiyuTextbookActivateBatch> list = mmxtMeiyuTextbookActivateBatchService.selectMmxtMeiyuTextbookActivateBatchList(mmxtMeiyuTextbookActivateBatch);
return getDataTable(list);
}
/**
* 导出美美学堂智慧美育教材学习卡激活批次列表
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:export')")
@Log(title = "美美学堂智慧美育教材学习卡激活批次", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
List<MmxtMeiyuTextbookActivateBatch> list = mmxtMeiyuTextbookActivateBatchService.selectMmxtMeiyuTextbookActivateBatchList(mmxtMeiyuTextbookActivateBatch);
ExcelUtil<MmxtMeiyuTextbookActivateBatch> util = new ExcelUtil<MmxtMeiyuTextbookActivateBatch>(MmxtMeiyuTextbookActivateBatch.class);
util.exportExcel(response, list, "美美学堂智慧美育教材学习卡激活批次数据");
}
/**
* 获取美美学堂智慧美育教材学习卡激活批次详细信息
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:query')")
@GetMapping(value = "/{batchId}")
public AjaxResult getInfo(@PathVariable("batchId") Long batchId)
{
return success(mmxtMeiyuTextbookActivateBatchService.selectMmxtMeiyuTextbookActivateBatchByBatchId(batchId));
}
/**
* 新增美美学堂智慧美育教材学习卡激活批次
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:add')")
@Log(title = "美美学堂智慧美育教材学习卡激活批次", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
return toAjax(mmxtMeiyuTextbookActivateBatchService.insertMmxtMeiyuTextbookActivateBatch(mmxtMeiyuTextbookActivateBatch));
}
/**
* 修改美美学堂智慧美育教材学习卡激活批次
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:edit')")
@Log(title = "美美学堂智慧美育教材学习卡激活批次", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
return toAjax(mmxtMeiyuTextbookActivateBatchService.updateMmxtMeiyuTextbookActivateBatch(mmxtMeiyuTextbookActivateBatch));
}
/**
* 删除美美学堂智慧美育教材学习卡激活批次
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivateBatch:remove')")
@Log(title = "美美学堂智慧美育教材学习卡激活批次", businessType = BusinessType.DELETE)
@DeleteMapping("/{batchIds}")
public AjaxResult remove(@PathVariable Long[] batchIds)
{
return toAjax(mmxtMeiyuTextbookActivateBatchService.deleteMmxtMeiyuTextbookActivateBatchByBatchIds(batchIds));
}
/**
* 批量生成激活码
* @param param
* @return
*/
@PostMapping("/batchInsertTextbookActivate")
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(@RequestBody MmxtMeiyuTextbookActivateBatch param){
return success(mmxtMeiyuTextbookActivateBatchService.batchInsertMmxtMeiyuTextbookActivate(param));
}
}

30
mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookActivateController.java

@ -1,5 +1,6 @@
package com.mmxt.web.controller.mmxt;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import com.mmxt.common.annotation.Log;
import com.mmxt.common.core.controller.BaseController;
import com.mmxt.common.core.domain.AjaxResult;
@ -97,17 +98,28 @@ public class MmxtMeiyuTextbookActivateController extends BaseController
}
/**
* 批量生成激活码
* @param param
* 查询已经激活的激活码列表
* @param mmxtMeiyuTextbookActivateVo
* @return
*/
@PostMapping("/batchInsertMmxtMeiyuTextbookActivate")
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(@RequestBody MmxtMeiyuTextbookActivate param){
Integer count = param.getGenerateCount();
if (count == null || count <= 0) {
return AjaxResult.error("请输入有效的激活码生成数量");
}
return mmxtMeiyuTextbookActivateService.batchInsertMmxtMeiyuTextbookActivate(param);
@GetMapping("/selectActivationList")
public TableDataInfo selectActivationList(MmxtMeiyuTextbookActivateVo mmxtMeiyuTextbookActivateVo){
startPage();
List<MmxtMeiyuTextbookActivateVo> list = mmxtMeiyuTextbookActivateService.selectActivationList(mmxtMeiyuTextbookActivateVo);
return getDataTable(list);
}
/**
* 导出已经激活的激活码列表
*/
@PreAuthorize("@ss.hasPermi('mmxt:mmxtMeiyuTextbookActivate:export')")
@Log(title = "已经激活的激活码列表", businessType = BusinessType.EXPORT)
@PostMapping("/exportActivate")
public void exportActivate(HttpServletResponse response, MmxtMeiyuTextbookActivateVo mmxtMeiyuTextbookActivateVo)
{
List<MmxtMeiyuTextbookActivateVo> list = mmxtMeiyuTextbookActivateService.selectActivationList(mmxtMeiyuTextbookActivateVo);
ExcelUtil<MmxtMeiyuTextbookActivateVo> util = new ExcelUtil<MmxtMeiyuTextbookActivateVo>(MmxtMeiyuTextbookActivateVo.class);
util.exportExcel(response, list, "美美学堂智慧美育教材学习卡已经激活的激活码数据");
}
}

10
mmxt-admin/src/main/java/com/mmxt/web/controller/mmxt/MmxtMeiyuTextbookController.java

@ -1034,5 +1034,15 @@ public class MmxtMeiyuTextbookController extends BaseController
logger.error("提取教材内容失败", e);
}
}
/**
* 查询教材 easy
* @param mmxtMeiyuTextbook
* @return
*/
@GetMapping("/selectTextbookEasy")
public AjaxResult selectTextbookEasy(MmxtMeiyuTextbook mmxtMeiyuTextbook){
return success(mmxtMeiyuTextbookService.selectTextbookEasy(mmxtMeiyuTextbook));
}
}

2
mmxt-admin/src/main/resources/application-pro.yml

@ -7,7 +7,7 @@ mmxt:
# 版权年份
copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: /home/mmxt/uploadPath
profile: /home/mmxtdata/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证

102
mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivate.java

@ -1,15 +1,15 @@
package com.mmxt.business.domain;
import com.mmxt.common.annotation.Excel;
import com.mmxt.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.mmxt.common.annotation.Excel;
import com.mmxt.common.core.domain.BaseEntity;
/**
* 美美学堂智慧美育教材学习卡激活码对象 mmxt_meiyu_textbook_activate
*
* @author tzy
* @date 2025-12-17
* @author mmxt
* @date 2026-03-04
*/
public class MmxtMeiyuTextbookActivate extends BaseEntity
{
@ -18,23 +18,11 @@ public class MmxtMeiyuTextbookActivate extends BaseEntity
/** 记录id */
private Long recordId;
/** 教材id(关联mmxt_meiyu_textbook) */
private String textbookId;
/** 教材名称 */
@Excel(name = "教材名称")
private String textbookName;
/** 批次id 关联mmxt_meiyu_textbook_activate_batch */
private Long batchId;
/** 批次 */
@Excel(name = "批次")
private String batch;
/** 地域id (关联mmxt_meiyu_region) */
private Long regionId;
/** 完整地区名称 */
@Excel(name = "完整地区名称")
private String regionAddr;
@Excel(name = "批次名称")
private String batchName;
/** 激活码 */
@Excel(name = "激活码")
@ -47,44 +35,12 @@ public class MmxtMeiyuTextbookActivate extends BaseEntity
/** 删除标志 0存在 1删除 */
private String delFlag;
/** 生成数量 */
private Integer generateCount;
/**
* 学科 0美术 1书法 2新三科
*/
private String channel;
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getTextbookName() {
return textbookName;
}
public void setTextbookName(String textbookName) {
this.textbookName = textbookName;
}
public String getRegionAddr() {
return regionAddr;
public String getBatchName() {
return batchName;
}
public void setRegionAddr(String regionAddr) {
this.regionAddr = regionAddr;
}
public Integer getGenerateCount() {
return generateCount;
}
public void setGenerateCount(Integer generateCount) {
this.generateCount = generateCount;
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public void setRecordId(Long recordId)
@ -97,34 +53,14 @@ public class MmxtMeiyuTextbookActivate extends BaseEntity
return recordId;
}
public void setTextbookId(String textbookId)
{
this.textbookId = textbookId;
}
public String getTextbookId()
{
return textbookId;
}
public void setBatch(String batch)
{
this.batch = batch;
}
public String getBatch()
{
return batch;
}
public void setRegionId(Long regionId)
public void setBatchId(Long batchId)
{
this.regionId = regionId;
this.batchId = batchId;
}
public Long getRegionId()
public Long getBatchId()
{
return regionId;
return batchId;
}
public void setActivateCode(String activateCode)
@ -161,15 +97,11 @@ public class MmxtMeiyuTextbookActivate extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("recordId", getRecordId())
.append("textbookId", getTextbookId())
.append("batch", getBatch())
.append("regionId", getRegionId())
.append("batchId", getBatchId())
.append("activateCode", getActivateCode())
.append("qrCode", getQrCode())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}

167
mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivateBatch.java

@ -0,0 +1,167 @@
package com.mmxt.business.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.mmxt.common.annotation.Excel;
import com.mmxt.common.core.domain.BaseEntity;
/**
* 美美学堂智慧美育教材学习卡激活批次对象 mmxt_meiyu_textbook_activate_batch
*
* @author mmxt
* @date 2026-03-04
*/
public class MmxtMeiyuTextbookActivateBatch extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 批次id */
private Long batchId;
/** 教材id(关联mmxt_meiyu_textbook) */
private String textbookId;
/** 批次名称 */
@Excel(name = "批次名称")
private String batchName;
/** 地域id (关联mmxt_meiyu_region) */
private Long regionId;
/** 地域地址 */
@Excel(name = "地域地址")
private String regionAddr;
/** 已激活数量 */
@Excel(name = "已激活数量")
private Long activationCount;
/** 未激活数量 */
@Excel(name = "未激活数量")
private Long unactivationCount;
/** 删除标志 0存在 1删除 */
private String delFlag;
/** 生成数量 */
private Integer generateCount;
/**
* 学科 美术 书法 舞蹈戏剧影视
*/
private String subject;
public String getRegionAddr() {
return regionAddr;
}
public void setRegionAddr(String regionAddr) {
this.regionAddr = regionAddr;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public Integer getGenerateCount() {
return generateCount;
}
public void setGenerateCount(Integer generateCount) {
this.generateCount = generateCount;
}
public void setBatchId(Long batchId)
{
this.batchId = batchId;
}
public Long getBatchId()
{
return batchId;
}
public void setTextbookId(String textbookId)
{
this.textbookId = textbookId;
}
public String getTextbookId()
{
return textbookId;
}
public void setBatchName(String batchName)
{
this.batchName = batchName;
}
public String getBatchName()
{
return batchName;
}
public void setRegionId(Long regionId)
{
this.regionId = regionId;
}
public Long getRegionId()
{
return regionId;
}
public void setActivationCount(Long activationCount)
{
this.activationCount = activationCount;
}
public Long getActivationCount()
{
return activationCount;
}
public void setUnactivationCount(Long unactivationCount)
{
this.unactivationCount = unactivationCount;
}
public Long getUnactivationCount()
{
return unactivationCount;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("batchId", getBatchId())
.append("textbookId", getTextbookId())
.append("batchName", getBatchName())
.append("regionId", getRegionId())
.append("activationCount", getActivationCount())
.append("unactivationCount", getUnactivationCount())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}
}

42
mmxt-business/src/main/java/com/mmxt/business/domain/MmxtMeiyuTextbookActivateLog.java

@ -27,15 +27,9 @@ public class MmxtMeiyuTextbookActivateLog extends BaseEntity
@Excel(name = "学生名称")
private String studentName;
/** 教材id */
private String textbookId;
@Excel(name = "教材名称")
private String textbookName;
/** 激活码 */
@Excel(name = "激活码")
private String activateCode;
/** 激活码记录id 关联 mmxt_meiyu_textbook_activate */
@Excel(name = "激活码记录id 关联 mmxt_meiyu_textbook_activate")
private Long recordId;
/** IP地址 */
@Excel(name = "IP地址")
@ -62,13 +56,6 @@ public class MmxtMeiyuTextbookActivateLog extends BaseEntity
this.studentName = studentName;
}
public String getTextbookName() {
return textbookName;
}
public void setTextbookName(String textbookName) {
this.textbookName = textbookName;
}
public void setLogId(Long logId)
{
@ -90,24 +77,12 @@ public class MmxtMeiyuTextbookActivateLog extends BaseEntity
return studentId;
}
public void setTextbookId(String textbookId)
{
this.textbookId = textbookId;
public Long getRecordId() {
return recordId;
}
public String getTextbookId()
{
return textbookId;
}
public void setActivateCode(String activateCode)
{
this.activateCode = activateCode;
}
public String getActivateCode()
{
return activateCode;
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public void setIpaddr(String ipaddr)
@ -155,12 +130,11 @@ public class MmxtMeiyuTextbookActivateLog extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("logId", getLogId())
.append("studentId", getStudentId())
.append("textbookId", getTextbookId())
.append("activateCode", getActivateCode())
.append("ipaddr", getIpaddr())
.append("browser", getBrowser())
.append("os", getOs())
.append("logTime", getLogTime())
.append("recordId", getRecordId())
.toString();
}
}

129
mmxt-business/src/main/java/com/mmxt/business/domain/vo/MmxtMeiyuTextbookActivateVo.java

@ -0,0 +1,129 @@
package com.mmxt.business.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mmxt.common.annotation.Excel;
import com.mmxt.common.core.domain.BaseEntity;
import java.util.Date;
public class MmxtMeiyuTextbookActivateVo extends BaseEntity {
/** 批次id 关联mmxt_meiyu_textbook_activate_batch */
private Long batchId;
@Excel(name = "批次名称")
private String batchName;
/** 激活码 */
@Excel(name = "激活码")
private String activateCode;
/** 二维码 */
@Excel(name = "二维码")
private String qrCode;
@Excel(name = "学生名称")
private String studentName;
/** IP地址 */
@Excel(name = "IP地址")
private String ipaddr;
/** 浏览器类型 */
@Excel(name = "浏览器类型")
private String browser;
/** 操作系统 */
@Excel(name = "操作系统")
private String os;
/** 激活时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date logTime;
public String getBatchName() {
return batchName;
}
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public Long getBatchId() {
return batchId;
}
public void setBatchId(Long batchId) {
this.batchId = batchId;
}
public String getActivateCode() {
return activateCode;
}
public void setActivateCode(String activateCode) {
this.activateCode = activateCode;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getIpaddr() {
return ipaddr;
}
public void setIpaddr(String ipaddr) {
this.ipaddr = ipaddr;
}
public String getBrowser() {
return browser;
}
public void setBrowser(String browser) {
this.browser = browser;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
public Date getLogTime() {
return logTime;
}
public void setLogTime(Date logTime) {
this.logTime = logTime;
}
@Override
public String toString() {
return "MmxtMeiyuTextbookActivateVo{" +
"batchId=" + batchId +
", activateCode='" + activateCode + '\'' +
", qrCode='" + qrCode + '\'' +
", studentName='" + studentName + '\'' +
", ipaddr='" + ipaddr + '\'' +
", browser='" + browser + '\'' +
", os='" + os + '\'' +
", logTime=" + logTime +
'}';
}
}

68
mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookActivateBatchMapper.java

@ -0,0 +1,68 @@
package com.mmxt.business.mapper;
import java.util.List;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch;
/**
* 美美学堂智慧美育教材学习卡激活批次Mapper接口
*
* @author mmxt
* @date 2026-03-04
*/
public interface MmxtMeiyuTextbookActivateBatchMapper
{
/**
* 查询美美学堂智慧美育教材学习卡激活批次
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 美美学堂智慧美育教材学习卡激活批次
*/
public MmxtMeiyuTextbookActivateBatch selectMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId);
/**
* 查询美美学堂智慧美育教材学习卡激活批次列表
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 美美学堂智慧美育教材学习卡激活批次集合
*/
public List<MmxtMeiyuTextbookActivateBatch> selectMmxtMeiyuTextbookActivateBatchList(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 新增美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
public int insertMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 修改美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
public int updateMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 删除美美学堂智慧美育教材学习卡激活批次
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 结果
*/
public int deleteMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId);
/**
* 批量删除美美学堂智慧美育教材学习卡激活批次
*
* @param batchIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMmxtMeiyuTextbookActivateBatchByBatchIds(Long[] batchIds);
/**
* 修改批次未激活数量
* @param mmxtMeiyuTextbookActivateBatch
* @return
*/
public int updateBatchUnactivationCount(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
}

29
mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookActivateMapper.java

@ -1,6 +1,7 @@
package com.mmxt.business.mapper;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivate;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -61,6 +62,20 @@ public interface MmxtMeiyuTextbookActivateMapper
*/
public int deleteMmxtMeiyuTextbookActivateByRecordIds(Long[] recordIds);
/**
* 批量删除激活码批次
* @param batchIds
* @return
*/
public int deleteMmxtMeiyuTextbookActivateByBatchIds(Long[] batchIds);
/**
* 删除激活码批次
* @param batchId
* @return
*/
public int deleteMmxtMeiyuTextbookActivateByBatchId(Long batchId);
/**
* 批量插入
@ -69,4 +84,18 @@ public interface MmxtMeiyuTextbookActivateMapper
*/
public int batchInsertMmxtMeiyuTextbookActivate(@Param("list") List<MmxtMeiyuTextbookActivate> list);
/**
* 根据recordIds查询batchId
* @param recordIds
* @return
*/
public Long selectBatchIdByRecordIds(Long[] recordIds);
/**
* 查询已经激活的激活码列表
* @param mmxtMeiyuTextbookActivateVo
* @return
*/
public List<MmxtMeiyuTextbookActivateVo> selectActivationList(MmxtMeiyuTextbookActivateVo mmxtMeiyuTextbookActivateVo);
}

7
mmxt-business/src/main/java/com/mmxt/business/mapper/MmxtMeiyuTextbookMapper.java

@ -67,4 +67,11 @@ public interface MmxtMeiyuTextbookMapper
* @return 结果
*/
public int deleteMmxtMeiyuTextbookByTextbookIds(String[] textbookIds);
/**
* 查询教材 easy
* @param mmxtMeiyuTextbook
* @return
*/
public List<MmxtMeiyuTextbook> selectTextbookEasy(MmxtMeiyuTextbook mmxtMeiyuTextbook);
}

72
mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookActivateBatchService.java

@ -0,0 +1,72 @@
package com.mmxt.business.service;
import java.util.List;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import com.mmxt.common.core.domain.AjaxResult;
/**
* 美美学堂智慧美育教材学习卡激活批次Service接口
*
* @author mmxt
* @date 2026-03-04
*/
public interface IMmxtMeiyuTextbookActivateBatchService
{
/**
* 查询美美学堂智慧美育教材学习卡激活批次
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 美美学堂智慧美育教材学习卡激活批次
*/
public MmxtMeiyuTextbookActivateBatch selectMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId);
/**
* 查询美美学堂智慧美育教材学习卡激活批次列表
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 美美学堂智慧美育教材学习卡激活批次集合
*/
public List<MmxtMeiyuTextbookActivateBatch> selectMmxtMeiyuTextbookActivateBatchList(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 新增美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
public int insertMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 修改美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
public int updateMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch);
/**
* 批量删除美美学堂智慧美育教材学习卡激活批次
*
* @param batchIds 需要删除的美美学堂智慧美育教材学习卡激活批次主键集合
* @return 结果
*/
public int deleteMmxtMeiyuTextbookActivateBatchByBatchIds(Long[] batchIds);
/**
* 删除美美学堂智慧美育教材学习卡激活批次信息
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 结果
*/
public int deleteMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId);
/**
* 批量生成激活码
* @param param
* @return
*/
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(MmxtMeiyuTextbookActivateBatch param);
}

8
mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookActivateService.java

@ -1,6 +1,7 @@
package com.mmxt.business.service;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivate;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import com.mmxt.common.core.domain.AjaxResult;
import java.util.List;
@ -62,9 +63,10 @@ public interface IMmxtMeiyuTextbookActivateService
public int deleteMmxtMeiyuTextbookActivateByRecordId(Long recordId);
/**
* 批量生成激活码
* @param param
* 查询已经激活的激活码列表
* @param mmxtMeiyuTextbookActivateVo
* @return
*/
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(MmxtMeiyuTextbookActivate param);
public List<MmxtMeiyuTextbookActivateVo> selectActivationList(MmxtMeiyuTextbookActivateVo mmxtMeiyuTextbookActivateVo);
}

7
mmxt-business/src/main/java/com/mmxt/business/service/IMmxtMeiyuTextbookService.java

@ -66,4 +66,11 @@ public interface IMmxtMeiyuTextbookService
* @return 结果
*/
public int deleteMmxtMeiyuTextbookByTextbookId(String textbookId);
/**
* 查询教材 easy
* @param mmxtMeiyuTextbook
* @return
*/
public List<MmxtMeiyuTextbook> selectTextbookEasy(MmxtMeiyuTextbook mmxtMeiyuTextbook);
}

233
mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookActivateBatchServiceImpl.java

@ -0,0 +1,233 @@
package com.mmxt.business.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivate;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import com.mmxt.business.mapper.MmxtMeiyuTextbookActivateMapper;
import com.mmxt.business.mapper.MmxtMeiyuTextbookMapper;
import com.mmxt.common.constant.Constants;
import com.mmxt.common.core.domain.AjaxResult;
import com.mmxt.common.exception.ServiceException;
import com.mmxt.common.utils.DateUtils;
import com.mmxt.common.utils.QrCodeUtil;
import com.mmxt.common.utils.RandomCodeUtil;
import com.mmxt.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mmxt.business.mapper.MmxtMeiyuTextbookActivateBatchMapper;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch;
import com.mmxt.business.service.IMmxtMeiyuTextbookActivateBatchService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import static com.mmxt.common.utils.OSSUtil.uploadQrCodeToOss;
import static com.mmxt.common.utils.SecurityUtils.getUsername;
/**
* 美美学堂智慧美育教材学习卡激活批次Service业务层处理
*
* @author mmxt
* @date 2026-03-04
*/
@Service
public class MmxtMeiyuTextbookActivateBatchServiceImpl implements IMmxtMeiyuTextbookActivateBatchService
{
@Autowired
private MmxtMeiyuTextbookActivateBatchMapper mmxtMeiyuTextbookActivateBatchMapper;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private MmxtMeiyuTextbookActivateMapper mmxtMeiyuTextbookActivateMapper;
private static final ExecutorService EXECUTOR = new ThreadPoolExecutor(
8, 16, 60L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(1000),
new ThreadFactoryBuilder().setNameFormat("qr-gen-%d").build(),
new ThreadPoolExecutor.CallerRunsPolicy() // 队列满时由主线程执行,起到限流作用
);
/**
* 查询美美学堂智慧美育教材学习卡激活批次
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 美美学堂智慧美育教材学习卡激活批次
*/
@Override
public MmxtMeiyuTextbookActivateBatch selectMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId)
{
return mmxtMeiyuTextbookActivateBatchMapper.selectMmxtMeiyuTextbookActivateBatchByBatchId(batchId);
}
/**
* 查询美美学堂智慧美育教材学习卡激活批次列表
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 美美学堂智慧美育教材学习卡激活批次
*/
@Override
public List<MmxtMeiyuTextbookActivateBatch> selectMmxtMeiyuTextbookActivateBatchList(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
return mmxtMeiyuTextbookActivateBatchMapper.selectMmxtMeiyuTextbookActivateBatchList(mmxtMeiyuTextbookActivateBatch);
}
/**
* 新增美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
@Override
public int insertMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
mmxtMeiyuTextbookActivateBatch.setCreateTime(DateUtils.getNowDate());
mmxtMeiyuTextbookActivateBatch.setCreateBy(getUsername());
return mmxtMeiyuTextbookActivateBatchMapper.insertMmxtMeiyuTextbookActivateBatch(mmxtMeiyuTextbookActivateBatch);
}
/**
* 修改美美学堂智慧美育教材学习卡激活批次
*
* @param mmxtMeiyuTextbookActivateBatch 美美学堂智慧美育教材学习卡激活批次
* @return 结果
*/
@Override
public int updateMmxtMeiyuTextbookActivateBatch(MmxtMeiyuTextbookActivateBatch mmxtMeiyuTextbookActivateBatch)
{
mmxtMeiyuTextbookActivateBatch.setUpdateTime(DateUtils.getNowDate());
mmxtMeiyuTextbookActivateBatch.setUpdateBy(getUsername());
return mmxtMeiyuTextbookActivateBatchMapper.updateMmxtMeiyuTextbookActivateBatch(mmxtMeiyuTextbookActivateBatch);
}
/**
* 批量删除美美学堂智慧美育教材学习卡激活批次
*
* @param batchIds 需要删除的美美学堂智慧美育教材学习卡激活批次主键
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteMmxtMeiyuTextbookActivateBatchByBatchIds(Long[] batchIds)
{
for (Long batchId : batchIds){
MmxtMeiyuTextbookActivateBatch batch = mmxtMeiyuTextbookActivateBatchMapper.selectMmxtMeiyuTextbookActivateBatchByBatchId(batchId);
if (batch.getActivationCount() > 0){
throw new ServiceException(batch.getBatchName() +"批次下有激活码已经激活,不能删除该批次");
}
}
// 删除当前批次下的所有激活码
mmxtMeiyuTextbookActivateMapper.deleteMmxtMeiyuTextbookActivateByBatchIds(batchIds);
return mmxtMeiyuTextbookActivateBatchMapper.deleteMmxtMeiyuTextbookActivateBatchByBatchIds(batchIds);
}
/**
* 删除美美学堂智慧美育教材学习卡激活批次信息
*
* @param batchId 美美学堂智慧美育教材学习卡激活批次主键
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteMmxtMeiyuTextbookActivateBatchByBatchId(Long batchId)
{
MmxtMeiyuTextbookActivateBatch batch = mmxtMeiyuTextbookActivateBatchMapper.selectMmxtMeiyuTextbookActivateBatchByBatchId(batchId);
if (batch.getActivationCount() > 0){
throw new ServiceException(batch.getBatchName() +"批次下有激活码已经激活,不能删除该批次");
}
// 删除当前批次下的所有激活码
mmxtMeiyuTextbookActivateMapper.deleteMmxtMeiyuTextbookActivateByBatchId(batchId);
return mmxtMeiyuTextbookActivateBatchMapper.deleteMmxtMeiyuTextbookActivateBatchByBatchId(batchId);
}
/**
* 批量生成激活码
* @param param
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(MmxtMeiyuTextbookActivateBatch param) {
Integer count = param.getGenerateCount();
if (count == null || count <= 0) {
return AjaxResult.error("生成数量必须大于0");
}
// 新增激活码批次
param.setUnactivationCount(count.longValue());
param.setActivationCount(0L);
param.setCreateTime(DateUtils.getNowDate());
param.setCreateBy(getUsername());
mmxtMeiyuTextbookActivateBatchMapper.insertMmxtMeiyuTextbookActivateBatch(param);
// 提前获取上下文信息,防止子线程丢失
String createBy = getUsername();
String ossDir = isSite(param.getSubject()) + Constants.OSS_IMAGE;
List<CompletableFuture<MmxtMeiyuTextbookActivate>> futures = new ArrayList<>();
// 并行处理耗时的 OSS 上传和二维码生成
for (int i = 0; i < count; i++) {
futures.add(CompletableFuture.supplyAsync(() -> {
MmxtMeiyuTextbookActivate entity = new MmxtMeiyuTextbookActivate();
entity.setBatchId(param.getBatchId());
entity.setRecordId(null);
String activateCode = RandomCodeUtil.generateCode();
entity.setActivateCode(activateCode);
byte[] qrBytes = QrCodeUtil.generateBarcode(activateCode, 200, 100);
String qrUrl = uploadQrCodeToOss(qrBytes, ossDir);
entity.setQrCode(qrUrl);
entity.setCreateBy(createBy);
return entity;
}, EXECUTOR));
}
try {
// 等待所有并行任务完成
List<MmxtMeiyuTextbookActivate> list = futures.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList());
// 3. 使用 TransactionTemplate 执行数据库操作
transactionTemplate.execute(status -> {
batchInsertInChunks(list, 500);
return null;
});
return AjaxResult.success("批量生成激活码成功,共生成 " + count + " 条");
} catch (Exception e) {
return AjaxResult.error("操作失败:" + e.getMessage());
}
}
private void batchInsertInChunks(List<MmxtMeiyuTextbookActivate> list, int chunkSize) {
for (int i = 0; i < list.size(); i += chunkSize) {
int end = Math.min(i + chunkSize, list.size());
List<MmxtMeiyuTextbookActivate> subList = list.subList(i, end);
mmxtMeiyuTextbookActivateMapper.batchInsertMmxtMeiyuTextbookActivate(subList);
}
}
public String isSite(String flag) {
if ("美术".equals(flag)) {
return Constants.OSS_list + Constants.MEISHU_SITE;
}
if ("书法".equals(flag)) {
return Constants.OSS_list + Constants.SHUFA365_SITE;
}
return Constants.OSS_list + Constants.XINSANKE_SITE;
}
}

107
mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookActivateServiceImpl.java

@ -1,8 +1,13 @@
package com.mmxt.business.service.impl;
import com.mmxt.business.domain.MmxtMeiyuTextbook;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivate;
import com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch;
import com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo;
import com.mmxt.business.mapper.MmxtMeiyuTextbookActivateBatchMapper;
import com.mmxt.business.mapper.MmxtMeiyuTextbookActivateMapper;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.mmxt.business.mapper.MmxtMeiyuTextbookMapper;
import com.mmxt.common.constant.Constants;
import com.mmxt.common.core.domain.AjaxResult;
import com.mmxt.common.utils.DateUtils;
@ -12,6 +17,7 @@ import com.mmxt.common.utils.bean.BeanUtils;
import com.mmxt.business.service.IMmxtMeiyuTextbookActivateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.ArrayList;
@ -35,14 +41,8 @@ public class MmxtMeiyuTextbookActivateServiceImpl implements IMmxtMeiyuTextbookA
private MmxtMeiyuTextbookActivateMapper mmxtMeiyuTextbookActivateMapper;
@Autowired
private TransactionTemplate transactionTemplate;
private MmxtMeiyuTextbookActivateBatchMapper mmxtMeiyuTextbookActivateBatchMapper;
private static final ExecutorService EXECUTOR = new ThreadPoolExecutor(
8, 16, 60L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(1000),
new ThreadFactoryBuilder().setNameFormat("qr-gen-%d").build(),
new ThreadPoolExecutor.CallerRunsPolicy() // 队列满时由主线程执行,起到限流作用
);
/**
* 查询美美学堂智慧美育教材学习卡激活码
@ -104,8 +104,18 @@ public class MmxtMeiyuTextbookActivateServiceImpl implements IMmxtMeiyuTextbookA
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteMmxtMeiyuTextbookActivateByRecordIds(Long[] recordIds)
{
// 1. 查询 batch_id
Long batchId = mmxtMeiyuTextbookActivateMapper.selectBatchIdByRecordIds(recordIds);
// 2. 扣减数量
MmxtMeiyuTextbookActivateBatch batch = new MmxtMeiyuTextbookActivateBatch();
batch.setBatchId(batchId);
batch.setUnactivationCount((long) recordIds.length);
mmxtMeiyuTextbookActivateBatchMapper.updateBatchUnactivationCount(batch);
return mmxtMeiyuTextbookActivateMapper.deleteMmxtMeiyuTextbookActivateByRecordIds(recordIds);
}
@ -118,82 +128,29 @@ public class MmxtMeiyuTextbookActivateServiceImpl implements IMmxtMeiyuTextbookA
@Override
public int deleteMmxtMeiyuTextbookActivateByRecordId(Long recordId)
{
Long recordIds[] = new Long[]{recordId};
// 1. 查询 batch_id
Long batchId = mmxtMeiyuTextbookActivateMapper.selectBatchIdByRecordIds(recordIds);
// 2. 扣减数量
MmxtMeiyuTextbookActivateBatch batch = new MmxtMeiyuTextbookActivateBatch();
batch.setBatchId(batchId);
batch.setUnactivationCount((long) recordIds.length);
mmxtMeiyuTextbookActivateBatchMapper.updateBatchUnactivationCount(batch);
return mmxtMeiyuTextbookActivateMapper.deleteMmxtMeiyuTextbookActivateByRecordId(recordId);
}
/**
* 批量生成激活码
* @param param
* 查询已经激活的激活码列表
* @param mmxtMeiyuTextbookActivateVo
* @return
*/
@Override
public AjaxResult batchInsertMmxtMeiyuTextbookActivate(MmxtMeiyuTextbookActivate param) {
Integer count = param.getGenerateCount();
if (count == null || count <= 0) {
return AjaxResult.error("生成数量必须大于0");
}
// 提前获取上下文信息,防止子线程丢失
String createBy = getUsername();
String ossDir = isSite(param.getChannel()) + Constants.OSS_IMAGE;
List<CompletableFuture<MmxtMeiyuTextbookActivate>> futures = new ArrayList<>();
// 并行处理耗时的 OSS 上传和二维码生成
for (int i = 0; i < count; i++) {
futures.add(CompletableFuture.supplyAsync(() -> {
MmxtMeiyuTextbookActivate entity = new MmxtMeiyuTextbookActivate();
BeanUtils.copyProperties(param, entity);
entity.setRecordId(null);
String activateCode = RandomCodeUtil.generateCode();
entity.setActivateCode(activateCode);
byte[] qrBytes = QrCodeUtil.generateBarcode(activateCode, 200, 100);
String qrUrl = uploadQrCodeToOss(qrBytes, ossDir);
entity.setQrCode(qrUrl);
entity.setCreateBy(createBy);
return entity;
}, EXECUTOR));
}
try {
// 等待所有并行任务完成
List<MmxtMeiyuTextbookActivate> list = futures.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList());
// 3. 使用 TransactionTemplate 执行数据库操作
transactionTemplate.execute(status -> {
batchInsertInChunks(list, 500);
return null;
});
return AjaxResult.success("批量生成激活码成功,共生成 " + count + " 条");
} catch (Exception e) {
return AjaxResult.error("操作失败:" + e.getMessage());
}
}
private void batchInsertInChunks(List<MmxtMeiyuTextbookActivate> list, int chunkSize) {
for (int i = 0; i < list.size(); i += chunkSize) {
int end = Math.min(i + chunkSize, list.size());
List<MmxtMeiyuTextbookActivate> subList = list.subList(i, end);
mmxtMeiyuTextbookActivateMapper.batchInsertMmxtMeiyuTextbookActivate(subList);
}
public List<MmxtMeiyuTextbookActivateVo> selectActivationList(MmxtMeiyuTextbookActivateVo mmxtMeiyuTextbookActivateVo){
return mmxtMeiyuTextbookActivateMapper.selectActivationList(mmxtMeiyuTextbookActivateVo);
}
public String isSite(String flag){
switch (flag) {
case "0":
return Constants.OSS_list + Constants.MEISHU_SITE;
case "1":
return Constants.OSS_list + Constants.SHUFA365_SITE;
case "2":
return Constants.OSS_list + Constants.XINSANKE_SITE;
}
return "";
}
}

10
mmxt-business/src/main/java/com/mmxt/business/service/impl/MmxtMeiyuTextbookServiceImpl.java

@ -225,4 +225,14 @@ public class MmxtMeiyuTextbookServiceImpl implements IMmxtMeiyuTextbookService
mmxtMeiyuTextbookActivityService.deleteMmxtMeiyuTextbookActivityByTextbookId(textbookId);
return mmxtMeiyuTextbookMapper.deleteMmxtMeiyuTextbookByTextbookId(textbookId);
}
/**
* 查询教材 easy
* @param mmxtMeiyuTextbook
* @return
*/
@Override
public List<MmxtMeiyuTextbook> selectTextbookEasy(MmxtMeiyuTextbook mmxtMeiyuTextbook){
return mmxtMeiyuTextbookMapper.selectTextbookEasy(mmxtMeiyuTextbook);
}
}

146
mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateBatchMapper.xml

@ -0,0 +1,146 @@
<?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.mmxt.business.mapper.MmxtMeiyuTextbookActivateBatchMapper">
<resultMap type="com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch" id="MmxtMeiyuTextbookActivateBatchResult">
<result property="batchId" column="batch_id" />
<result property="textbookId" column="textbook_id" />
<result property="batchName" column="batch_name" />
<result property="regionId" column="region_id" />
<result property="activationCount" column="activation_count" />
<result property="unactivationCount" column="unactivation_count" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectMmxtMeiyuTextbookActivateBatchVo">
select batch_id, textbook_id, batch_name, region_id, activation_count, unactivation_count, create_time, create_by, update_time, update_by, del_flag from mmxt_meiyu_textbook_activate_batch
</sql>
<select id="selectMmxtMeiyuTextbookActivateBatchList" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch" resultMap="MmxtMeiyuTextbookActivateBatchResult">
WITH RECURSIVE region_tree AS (
-- 激活码表关联的最底层区域
SELECT
r.region_id,
r.region_name,
r.parent_id,
r.region_id AS leaf_region_id,
CAST(r.region_name AS CHAR(500)) AS full_path
FROM mmxt_meiyu_region r
WHERE r.region_id IN (
SELECT DISTINCT region_id FROM mmxt_meiyu_textbook_activate_batch
)
UNION ALL
-- 向上递归父级
SELECT
parent.region_id,
parent.region_name,
parent.parent_id,
child.leaf_region_id,
CONCAT(parent.region_name, '', child.full_path) AS full_path
FROM mmxt_meiyu_region parent
INNER JOIN region_tree child
ON child.parent_id = parent.region_id
)
SELECT
a.batch_id,
a.textbook_id,
a.batch_name,
a.region_id,
a.activation_count,
a.unactivation_count,
a.create_time,
a.create_by,
a.update_time,
a.update_by,
rt.full_path AS regionAddr
FROM mmxt_meiyu_textbook_activate_batch a
LEFT JOIN region_tree rt
ON a.region_id = rt.leaf_region_id
<where>
a.del_flag = 0 and (rt.parent_id = 0 OR rt.parent_id IS NULL)
<if test="textbookId != null and textbookId != ''"> and a.textbook_id = #{textbookId}</if>
<if test="batchName != null and batchName != ''"> and a.batch_name like concat('%', #{batchName}, '%')</if>
<if test="regionId != null "> and a.region_id = #{regionId}</if>
<if test="activationCount != null "> and a.activation_count = #{activationCount}</if>
<if test="unactivationCount != null "> and a.unactivation_count = #{unactivationCount}</if>
</where>
order by a.create_time desc,a.batch_id desc
</select>
<select id="selectMmxtMeiyuTextbookActivateBatchByBatchId" parameterType="Long" resultMap="MmxtMeiyuTextbookActivateBatchResult">
<include refid="selectMmxtMeiyuTextbookActivateBatchVo"/>
where batch_id = #{batchId} and del_flag = 0
</select>
<insert id="insertMmxtMeiyuTextbookActivateBatch" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch" useGeneratedKeys="true" keyProperty="batchId">
insert into mmxt_meiyu_textbook_activate_batch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">textbook_id,</if>
<if test="batchName != null">batch_name,</if>
<if test="regionId != null">region_id,</if>
<if test="activationCount != null">activation_count,</if>
<if test="unactivationCount != null">unactivation_count,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">#{textbookId},</if>
<if test="batchName != null">#{batchName},</if>
<if test="regionId != null">#{regionId},</if>
<if test="activationCount != null">#{activationCount},</if>
<if test="unactivationCount != null">#{unactivationCount},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateMmxtMeiyuTextbookActivateBatch" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch">
update mmxt_meiyu_textbook_activate_batch
<trim prefix="SET" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">textbook_id = #{textbookId},</if>
<if test="batchName != null">batch_name = #{batchName},</if>
<if test="regionId != null">region_id = #{regionId},</if>
<if test="activationCount != null">activation_count = #{activationCount},</if>
<if test="unactivationCount != null">unactivation_count = #{unactivationCount},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where batch_id = #{batchId}
</update>
<update id="updateBatchUnactivationCount" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateBatch">
update mmxt_meiyu_textbook_activate_batch
set unactivation_count = unactivation_count - #{unactivationCount}
where batch_id = #{batchId}
and unactivation_count > 0
</update>
<update id="deleteMmxtMeiyuTextbookActivateBatchByBatchId" parameterType="Long">
update mmxt_meiyu_textbook_activate_batch set del_flag = 1 where batch_id = #{batchId}
</update>
<update id="deleteMmxtMeiyuTextbookActivateBatchByBatchIds" parameterType="String">
update mmxt_meiyu_textbook_activate_batch set del_flag = 1 where batch_id in
<foreach item="batchId" collection="array" open="(" separator="," close=")">
#{batchId}
</foreach>
</update>
</mapper>

25
mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateLogMapper.xml

@ -6,9 +6,8 @@
<resultMap type="com.mmxt.business.domain.MmxtMeiyuTextbookActivateLog" id="MmxtMeiyuTextbookActivateLogResult">
<result property="logId" column="log_id" />
<result property="recordId" column="record_id" />
<result property="studentId" column="student_id" />
<result property="textbookId" column="textbook_id" />
<result property="activateCode" column="activate_code" />
<result property="ipaddr" column="ipaddr" />
<result property="browser" column="browser" />
<result property="os" column="os" />
@ -16,28 +15,23 @@
</resultMap>
<sql id="selectMmxtMeiyuTextbookActivateLogVo">
select log_id, student_id, textbook_id, activate_code, ipaddr, browser, os, log_time from mmxt_meiyu_textbook_activate_log
select log_id, record_id, student_id, ipaddr, browser, os, log_time from mmxt_meiyu_textbook_activate_log
</sql>
<select id="selectMmxtMeiyuTextbookActivateLogList" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateLog" resultMap="MmxtMeiyuTextbookActivateLogResult">
SELECT
a.log_id,
a.record_id,
a.student_id,
b.student_name as studentName,
a.textbook_id,
c.textbook_name as textbookName,
a.activate_code,
a.ipaddr,
a.browser,
a.os,
a.log_time
a.log_time,
b.student_name as studentName
FROM
mmxt_meiyu_textbook_activate_log a LEFT JOIN mmxt_meiyu_student b on a.student_id = b.id
left join mmxt_meiyu_textbook c on a.textbook_id = c.textbook_id
<where>
<if test="studentId != null "> and a.student_id = #{studentId}</if>
<if test="textbookId != null and textbookId != ''"> and a.textbook_id = #{textbookId}</if>
<if test="activateCode != null and activateCode != ''"> and a.activate_code = #{activateCode}</if>
<if test="ipaddr != null and ipaddr != ''"> and a.ipaddr = #{ipaddr}</if>
<if test="browser != null and browser != ''"> and a.browser = #{browser}</if>
<if test="os != null and os != ''"> and a.os = #{os}</if>
@ -53,18 +47,16 @@
<insert id="insertMmxtMeiyuTextbookActivateLog" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateLog" useGeneratedKeys="true" keyProperty="logId">
insert into mmxt_meiyu_textbook_activate_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="studentId != null">student_id,</if>
<if test="textbookId != null">textbook_id,</if>
<if test="activateCode != null">activate_code,</if>
<if test="ipaddr != null">ipaddr,</if>
<if test="browser != null">browser,</if>
<if test="os != null">os,</if>
<if test="logTime != null">log_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="studentId != null">#{studentId},</if>
<if test="textbookId != null">#{textbookId},</if>
<if test="activateCode != null">#{activateCode},</if>
<if test="ipaddr != null">#{ipaddr},</if>
<if test="browser != null">#{browser},</if>
<if test="os != null">#{os},</if>
@ -75,9 +67,8 @@
<update id="updateMmxtMeiyuTextbookActivateLog" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivateLog">
update mmxt_meiyu_textbook_activate_log
<trim prefix="SET" suffixOverrides=",">
<if test="recordId != null">record_id = #{recordId},</if>
<if test="studentId != null">student_id = #{studentId},</if>
<if test="textbookId != null">textbook_id = #{textbookId},</if>
<if test="activateCode != null">activate_code = #{activateCode},</if>
<if test="ipaddr != null">ipaddr = #{ipaddr},</if>
<if test="browser != null">browser = #{browser},</if>
<if test="os != null">os = #{os},</if>

153
mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookActivateMapper.xml

@ -5,30 +5,22 @@
<mapper namespace="com.mmxt.business.mapper.MmxtMeiyuTextbookActivateMapper">
<resultMap type="com.mmxt.business.domain.MmxtMeiyuTextbookActivate" id="MmxtMeiyuTextbookActivateResult">
<result property="recordId" column="record_id"/>
<result property="textbookId" column="textbook_id"/>
<result property="batch" column="batch"/>
<result property="regionId" column="region_id"/>
<result property="activateCode" column="activate_code"/>
<result property="qrCode" column="qr_code"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="recordId" column="record_id" />
<result property="batchId" column="batch_id" />
<result property="activateCode" column="activate_code" />
<result property="qrCode" column="qr_code" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectMmxtMeiyuTextbookActivateVo">
select record_id,
textbook_id,
batch,
region_id,
batch_id,
activate_code,
qr_code,
create_time,
create_by,
update_time,
update_by,
del_flag
from mmxt_meiyu_textbook_activate
</sql>
@ -36,62 +28,21 @@
<select id="selectMmxtMeiyuTextbookActivateList"
parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivate"
resultMap="MmxtMeiyuTextbookActivateResult">
WITH RECURSIVE region_tree AS (
-- 1️⃣ 起点:激活码表关联的最底层区域
SELECT
r.region_id,
r.region_name,
r.parent_id,
r.region_id AS leaf_region_id,
CAST(r.region_name AS CHAR(500)) AS full_path
FROM mmxt_meiyu_region r
WHERE r.region_id IN (
SELECT DISTINCT region_id FROM mmxt_meiyu_textbook_activate
)
UNION ALL
-- 2️⃣ 向上递归父级
SELECT
parent.region_id,
parent.region_name,
parent.parent_id,
child.leaf_region_id,
CONCAT(parent.region_name, '', child.full_path) AS full_path
FROM mmxt_meiyu_region parent
INNER JOIN region_tree child
ON child.parent_id = parent.region_id
)
SELECT
zmta.record_id,
zmta.textbook_id,
zmta.batch,
zmta.region_id,
zmta.batch_id,
zmta.activate_code,
zmta.qr_code,
zmta.create_time,
zmta.create_by,
zmta.update_time,
zmta.update_by,
zmta.del_flag,
zmt.textbook_name AS textbookName,
rt.full_path AS regionAddr
b.batch_name as batchName
FROM mmxt_meiyu_textbook_activate zmta
LEFT JOIN mmxt_meiyu_textbook zmt
ON zmta.textbook_id = zmt.textbook_id
LEFT JOIN region_tree rt
ON zmta.region_id = rt.leaf_region_id
left join mmxt_meiyu_textbook_activate_batch b on zmta.batch_id = b.batch_id
<where>
zmta.del_flag = 0 and (rt.parent_id = 0 OR rt.parent_id IS NULL)
<if test="textbookId != null and textbookId != ''">and zmta.textbook_id = #{textbookId}</if>
<if test="batch != null and batch != ''">and zmta.batch = #{batch}</if>
<if test="regionId != null ">and zmta.region_id = #{regionId}</if>
zmta.del_flag = 0
<if test="activateCode != null and activateCode != ''">and zmta.activate_code = #{activateCode}</if>
<if test="qrCode != null and qrCode != ''">and zmta.qr_code = #{qrCode}</if>
<if test="batchId != null">and zmta.batch_id = #{batchId}</if>
</where>
order by zmta.record_id desc
</select>
@ -102,31 +53,61 @@
where record_id = #{recordId} and del_flag = 0
</select>
<select id="selectBatchIdByRecordIds" resultType="long" parameterType="String">
select batch_id
from mmxt_meiyu_textbook_activate
where del_flag = 0
and record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
limit 1
</select>
<select id="selectActivationList" parameterType="com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo"
resultType="com.mmxt.business.domain.vo.MmxtMeiyuTextbookActivateVo">
SELECT
a.record_id as recordId,
a.qr_code as qrCode,
a.activate_code as activateCode,
l.ipaddr as ipAddr,
l.browser AS browser,
l.os AS os,
l.log_time AS logTime,
s.student_name AS studentName,
b.batch_name as batchName
FROM
mmxt_meiyu_textbook_activate a
INNER JOIN mmxt_meiyu_textbook_activate_log l
ON a.record_id = l.record_id
LEFT JOIN mmxt_meiyu_student s
ON l.student_id = s.id
LEFT JOIN mmxt_meiyu_textbook_activate_batch b
on a.batch_id = b.batch_id
WHERE
a.del_flag = 0
AND a.batch_id = #{batchId}
<if test="activateCode != null and activateCode !=''">and a.activate_code = #{activateCode}</if>
<if test="studentName != null and studentName !=''">and s.student_name like concat('%',#{studentName},'%')</if>
</select>
<insert id="insertMmxtMeiyuTextbookActivate" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivate"
useGeneratedKeys="true" keyProperty="recordId">
insert into mmxt_meiyu_textbook_activate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">textbook_id,</if>
<if test="batch != null">batch,</if>
<if test="regionId != null">region_id,</if>
<if test="batchId != null">batch_id,</if>
<if test="activateCode != null">activate_code,</if>
<if test="qrCode != null">qr_code,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">#{textbookId},</if>
<if test="batch != null">#{batch},</if>
<if test="regionId != null">#{regionId},</if>
<if test="batchId != null">#{batchId},</if>
<if test="activateCode != null">#{activateCode},</if>
<if test="qrCode != null">#{qrCode},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
@ -134,9 +115,7 @@
<insert id="batchInsertMmxtMeiyuTextbookActivate">
INSERT INTO mmxt_meiyu_textbook_activate
(
textbook_id,
batch,
region_id,
batch_id,
activate_code,
qr_code,
create_by,
@ -145,9 +124,7 @@
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.textbookId},
#{item.batch},
#{item.regionId},
#{item.batchId},
#{item.activateCode},
#{item.qrCode},
#{item.createBy},
@ -160,15 +137,11 @@
<update id="updateMmxtMeiyuTextbookActivate" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbookActivate">
update mmxt_meiyu_textbook_activate
<trim prefix="SET" suffixOverrides=",">
<if test="textbookId != null and textbookId != ''">textbook_id = #{textbookId},</if>
<if test="batch != null">batch = #{batch},</if>
<if test="regionId != null">region_id = #{regionId},</if>
<if test="batchId != null">batch_id = #{batchId},</if>
<if test="activateCode != null">activate_code = #{activateCode},</if>
<if test="qrCode != null">qr_code = #{qrCode},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where record_id = #{recordId}
@ -186,4 +159,18 @@
#{recordId}
</foreach>
</update>
<update id="deleteMmxtMeiyuTextbookActivateByBatchId" parameterType="Long">
update mmxt_meiyu_textbook_activate
set del_flag = 1
where batch_id = #{batchId}
</update>
<update id="deleteMmxtMeiyuTextbookActivateByBatchIds" parameterType="String">
update mmxt_meiyu_textbook_activate set del_flag = 1 where batch_id in
<foreach item="batchId" collection="array" open="(" separator="," close=")">
#{batchId}
</foreach>
</update>
</mapper>

6
mmxt-business/src/main/resources/mapper/business/MmxtMeiyuTextbookMapper.xml

@ -41,6 +41,12 @@
</where>
</select>
<select id="selectTextbookEasy" parameterType="com.mmxt.business.domain.MmxtMeiyuTextbook" resultMap="MmxtMeiyuTextbookResult">
select textbook_id,textbook_name
from mmxt_meiyu_textbook
where del_flag = '0' and status = 2
</select>
<select id="selectMmxtMeiyuTextbookByTextbookId" parameterType="String" resultMap="MmxtMeiyuTextbookResult">
<include refid="selectMmxtMeiyuTextbookVo"/>
where textbook_id = #{textbookId} and del_flag = '0'

3
mmxt-framework/src/main/java/com/mmxt/framework/manager/factory/AsyncFactory.java

@ -61,6 +61,9 @@ public class AsyncFactory
SysLogininfor logininfor = new SysLogininfor();
logininfor.setUserName(username);
logininfor.setIpaddr(ip);
logininfor.setLoginLocation(address);
logininfor.setBrowser(browser);
logininfor.setOs(os);
logininfor.setMsg(message);
// 日志状态
if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))

52
mmxt-system/src/main/java/com/mmxt/system/domain/SysLogininfor.java

@ -31,6 +31,18 @@ public class SysLogininfor extends BaseEntity
@Excel(name = "登录地址")
private String ipaddr;
/** 登录地点 */
@Excel(name = "登录地点")
private String loginLocation;
/** 浏览器类型 */
@Excel(name = "浏览器")
private String browser;
/** 操作系统 */
@Excel(name = "操作系统")
private String os;
/** 提示消息 */
@Excel(name = "提示消息")
private String msg;
@ -38,7 +50,7 @@ public class SysLogininfor extends BaseEntity
/** 访问时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date accessTime;
private Date loginTime;
public Long getInfoId()
{
@ -80,7 +92,35 @@ public class SysLogininfor extends BaseEntity
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public String getMsg()
{
@ -92,11 +132,13 @@ public class SysLogininfor extends BaseEntity
this.msg = msg;
}
public Date getAccessTime() {
return accessTime;
public Date getLoginTime()
{
return loginTime;
}
public void setAccessTime(Date accessTime) {
this.accessTime = accessTime;
public void setLoginTime(Date loginTime)
{
this.loginTime = loginTime;
}
}

43
mmxt-system/src/main/resources/mapper/system/SysLogininforMapper.xml

@ -1,7 +1,7 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmxt.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult">
@ -9,17 +9,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="loginLocation" column="login_location" />
<result property="browser" column="browser" />
<result property="os" column="os" />
<result property="msg" column="msg" />
<result property="accessTime" column="access_time" />
<result property="loginTime" column="login_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, msg, access_time)
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
@ -31,24 +34,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND access_time &gt;= #{params.beginTime}
AND login_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND access_time &lt;= #{params.endTime}
AND login_time &lt;= #{params.endTime}
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
</mapper>
Loading…
Cancel
Save