From e992ea5f4c3d6f027b1030d1898638dbb8f9954b Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 12 Jan 2022 14:45:09 +0800
Subject: [PATCH] 1敏感词限制
---
src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.java | 43 +++++
src/main/java/org/springblade/modules/mgcx/service/IMgcxService.java | 41 +++++
src/main/java/org/springblade/modules/organ/controller/OrganController.java | 4
src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.xml | 20 ++
src/main/java/org/springblade/modules/mgcx/vo/MgcxVO.java | 36 ++++
src/main/java/org/springblade/modules/article/controller/ArticleController.java | 34 ++++
src/main/java/org/springblade/modules/mgcx/service/impl/MgcxServiceImpl.java | 41 +++++
src/main/java/org/springblade/modules/mgcx/controller/MgcxController.java | 126 +++++++++++++++
src/main/java/org/springblade/modules/mgcx/dto/MgcxDTO.java | 34 ++++
src/main/java/org/springblade/modules/mgcx/entity/Mgcx.java | 69 ++++++++
10 files changed, 443 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/springblade/modules/article/controller/ArticleController.java b/src/main/java/org/springblade/modules/article/controller/ArticleController.java
index 08805d7..3473911 100644
--- a/src/main/java/org/springblade/modules/article/controller/ArticleController.java
+++ b/src/main/java/org/springblade/modules/article/controller/ArticleController.java
@@ -7,11 +7,17 @@
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.article.entity.Article;
import org.springblade.modules.article.service.ArticleService;
import org.springblade.modules.article.vo.ArticleVo;
+import org.springblade.modules.mgcx.entity.Mgcx;
+import org.springblade.modules.mgcx.service.IMgcxService;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.words.DemoApplication;
import org.springframework.web.bind.annotation.*;
@@ -31,7 +37,8 @@
public class ArticleController {
private final ArticleService articleService;
-
+ private final IUserService userService;
+ private final IMgcxService mgcxService;
/**
*
@@ -162,7 +169,7 @@
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入article")
- public R submit(@Valid @RequestBody Article article) {
+ public R submit(@Valid @RequestBody ArticleVo article) {
if (null==article.getId()){
if (null==article.getCreateTime()){
article.setCreateTime(new Date());
@@ -179,6 +186,29 @@
article.setContent(content.get("content"));
article.setIswords("1");
article.setWordsContent(content.get("words"));
+ //获取登录信息
+ String userid = article.getUserid();
+ User user = new User();
+ user.setId(Long.parseLong(userid));
+ User detail = userService.getOne(Condition.getQueryWrapper(user));
+ Mgcx mgcx = new Mgcx();
+ mgcx.setUid(userid);
+ Mgcx one = mgcxService.getOne(Condition.getQueryWrapper(mgcx));
+ if (one==null){
+ mgcx.setUid(userid);
+ mgcx.setPhone(detail.getPhone());
+ mgcx.setCardid(detail.getCardid());
+ mgcx.setCountx(10);
+ mgcx.setCounts(1);
+ mgcxService.save(mgcx);
+ }
+ else {
+ Integer counts = one.getCounts();
+ int i = counts + 1;
+ one.setCounts(i);
+ mgcxService.updateById(one);
+ }
+
}
}
diff --git a/src/main/java/org/springblade/modules/mgcx/controller/MgcxController.java b/src/main/java/org/springblade/modules/mgcx/controller/MgcxController.java
new file mode 100644
index 0000000..a114f1c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/controller/MgcxController.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.mgcx.entity.Mgcx;
+import org.springblade.modules.mgcx.service.IMgcxService;
+import org.springblade.modules.mgcx.vo.MgcxVO;
+import org.springblade.modules.parcel.util.JsonUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("blade-mgcx/mgcx")
+@Api(value = "", tags = "接口")
+public class MgcxController extends BladeController {
+
+ private final IMgcxService mgcxService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入mgcx")
+ public R<Mgcx> detail(Mgcx mgcx) {
+ Mgcx detail = mgcxService.getOne(Condition.getQueryWrapper(mgcx));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入mgcx")
+ public R<IPage<Mgcx>> list(Mgcx mgcx, Query query) {
+ IPage<Mgcx> pages = mgcxService.page(Condition.getPage(query), Condition.getQueryWrapper(mgcx));
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入mgcx")
+ public R<IPage<MgcxVO>> page(MgcxVO mgcx, Query query) {
+ IPage<MgcxVO> pages = mgcxService.selectMgcxPage(Condition.getPage(query), mgcx);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入mgcx")
+ public R save(@Valid @RequestBody Mgcx mgcx) {
+ return R.status(mgcxService.save(mgcx));
+ }
+
+ /**
+ * 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入mgcx")
+ public R update(@Valid @RequestBody Mgcx mgcx) {
+ return R.status(mgcxService.updateById(mgcx));
+ }
+
+ /**
+ * 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入mgcx")
+ public R submit(@Valid @RequestBody Mgcx mgcx) {
+ return R.status(mgcxService.saveOrUpdate(mgcx));
+ }
+
+
+ /**
+ * 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(mgcxService.removeByIds(Func.toLongList(ids)));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/dto/MgcxDTO.java b/src/main/java/org/springblade/modules/mgcx/dto/MgcxDTO.java
new file mode 100644
index 0000000..d94ebb8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/dto/MgcxDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.mgcx.entity.Mgcx;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MgcxDTO extends Mgcx {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/entity/Mgcx.java b/src/main/java/org/springblade/modules/mgcx/entity/Mgcx.java
new file mode 100644
index 0000000..ed0509f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/entity/Mgcx.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+@Data
+@TableName("sys_mgcx")
+@ApiModel(value = "Mgcx对象", description = "Mgcx对象")
+public class Mgcx implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @TableId(value = "id",type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 用户id
+ */
+ @ApiModelProperty(value = "用户id")
+ private String uid;
+ /**
+ * 身份证号码
+ */
+ @ApiModelProperty(value = "身份证号码")
+ private String cardid;
+ /**
+ * 电话号码
+ */
+ @ApiModelProperty(value = "电话号码")
+ private String phone;
+ /**
+ * 敏感词限制次数
+ */
+ @ApiModelProperty(value = "敏感词限制次数")
+ private Integer countx;
+ /**
+ * 敏感词次数
+ */
+ @ApiModelProperty(value = "敏感词次数")
+ private Integer counts;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.java b/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.java
new file mode 100644
index 0000000..ca1d5e5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.mgcx.entity.Mgcx;
+import org.springblade.modules.mgcx.vo.MgcxVO;
+
+import java.util.List;
+
+/**
+ * Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+public interface MgcxMapper extends BaseMapper<Mgcx> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param mgcx
+ * @return
+ */
+ List<MgcxVO> selectMgcxPage(IPage page, MgcxVO mgcx);
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.xml b/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.xml
new file mode 100644
index 0000000..bcacac5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/mapper/MgcxMapper.xml
@@ -0,0 +1,20 @@
+<?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="org.springblade.modules.mgcx.mapper.MgcxMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="mgcxResultMap" type="org.springblade.modules.mgcx.entity.Mgcx">
+ <id column="id" property="id"/>
+ <result column="uid" property="uid"/>
+ <result column="cardid" property="cardid"/>
+ <result column="phone" property="phone"/>
+ <result column="countx" property="countx"/>
+ <result column="counts" property="counts"/>
+ </resultMap>
+
+
+ <select id="selectMgcxPage" resultMap="mgcxResultMap">
+ select * from sys_mgcx where is_deleted = 0
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/mgcx/service/IMgcxService.java b/src/main/java/org/springblade/modules/mgcx/service/IMgcxService.java
new file mode 100644
index 0000000..3754305
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/service/IMgcxService.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.mgcx.entity.Mgcx;
+import org.springblade.modules.mgcx.vo.MgcxVO;
+
+/**
+ * 服务类
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+public interface IMgcxService extends IService<Mgcx> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param mgcx
+ * @return
+ */
+ IPage<MgcxVO> selectMgcxPage(IPage<MgcxVO> page, MgcxVO mgcx);
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/service/impl/MgcxServiceImpl.java b/src/main/java/org/springblade/modules/mgcx/service/impl/MgcxServiceImpl.java
new file mode 100644
index 0000000..ca4f0a8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/service/impl/MgcxServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.mgcx.entity.Mgcx;
+import org.springblade.modules.mgcx.mapper.MgcxMapper;
+import org.springblade.modules.mgcx.service.IMgcxService;
+import org.springblade.modules.mgcx.vo.MgcxVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+@Service
+public class MgcxServiceImpl extends ServiceImpl<MgcxMapper, Mgcx> implements IMgcxService {
+
+ @Override
+ public IPage<MgcxVO> selectMgcxPage(IPage<MgcxVO> page, MgcxVO mgcx) {
+ return page.setRecords(baseMapper.selectMgcxPage(page, mgcx));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/mgcx/vo/MgcxVO.java b/src/main/java/org/springblade/modules/mgcx/vo/MgcxVO.java
new file mode 100644
index 0000000..fdba9a5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mgcx/vo/MgcxVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.mgcx.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.mgcx.entity.Mgcx;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "MgcxVO对象", description = "MgcxVO对象")
+public class MgcxVO extends Mgcx {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/organ/controller/OrganController.java b/src/main/java/org/springblade/modules/organ/controller/OrganController.java
index 0dd4cf4..65a36e2 100644
--- a/src/main/java/org/springblade/modules/organ/controller/OrganController.java
+++ b/src/main/java/org/springblade/modules/organ/controller/OrganController.java
@@ -30,6 +30,7 @@
import org.springblade.modules.organ.entity.Organ;
import org.springblade.modules.organ.service.IOrganService;
import org.springblade.modules.organ.vo.OrganVO;
+import org.springblade.modules.parcel.util.JsonUtils;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@@ -121,7 +122,4 @@
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(organService.removeByIds(Func.toLongList(ids)));
}
-
-
-
}
--
Gitblit v1.9.3