add 会议随机码 生成和追加

This commit is contained in:
lijiarao
2022-06-21 11:38:11 +08:00
parent b0f92a620b
commit 862312aa66
5 changed files with 78 additions and 4 deletions
@@ -102,6 +102,30 @@ public class PayRandomCodeController extends JeroController<PayRandomCode, PayR
return Result.OK("编辑成功!");
}
/**
* 生成
*/
@RequiresPermissions("internationalSeminarGenerateCode:edit")
@AutoLog(value = "随机码表-生成")
@ApiOperation(value="随机码表-生成", notes="随机码表-生成")
@PostMapping(value = "/generate")
public Result<?> generate(@Validated @RequestBody PayRandomCode randomCode) {
payRandomCodeService.generate(randomCode);
return Result.OK("生成成功!");
}
/**
* 追加
*/
@RequiresPermissions("internationalSeminarGenerateCode:edit")
@AutoLog(value = "随机码表-追加")
@ApiOperation(value="随机码表-追加", notes="随机码表-追加")
@PostMapping(value = "/additional")
public Result<?> additional(@Validated @RequestBody PayRandomCode randomCode) {
payRandomCodeService.additional(randomCode);
return Result.OK("追加成功!");
}
/**
* 导出excel
*/
@@ -42,7 +42,7 @@ public class PayRandomCodeLink {
@TableField(value = "random_code")
@Excel(name = "随机码", width = 15)
@ApiModelProperty(value="随机码")
private Integer randomCode;
private String randomCode;
/**
* 是否使用
@@ -1,4 +1,6 @@
package com.jero.meeting.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.meeting.entity.PayRandomCodeLink;
@@ -9,4 +11,7 @@ import com.jero.meeting.entity.PayRandomCodeLink;
*@date 2022-06-21 10:20
*/
public interface PayRandomCodeLinkMapper extends BaseMapper<PayRandomCodeLink> {
int insertList(@Param("list")List<PayRandomCodeLink> list);
}
@@ -13,4 +13,22 @@
<!--@mbg.generated-->
id, random_code_id, random_code, use_flag
</sql>
<!--auto generated by MybatisCodeHelper on 2022-06-21-->
<insert id="insertList">
INSERT INTO pay_random_code_link(
id,
random_code_id,
random_code,
use_flag
)VALUES
<foreach collection="list" item="element" index="index" separator=",">
(
#{element.id,jdbcType=VARCHAR},
#{element.randomCodeId,jdbcType=VARCHAR},
#{element.randomCode,jdbcType=BOOLEAN},
#{element.useFlag,jdbcType=BOOLEAN}
)
</foreach>
</insert>
</mapper>
@@ -1,7 +1,11 @@
package com.jero.meeting.service;
import cn.hutool.core.util.RandomUtil;
import com.jero.meeting.entity.PayRandomCodeLink;
import com.jero.meeting.mapper.PayRandomCodeLinkMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.meeting.mapper.PayRandomCodeMapper;
@@ -13,11 +17,34 @@ import com.jero.meeting.entity.PayRandomCode;
*/
@Service
public class PayRandomCodeService extends ServiceImpl<PayRandomCodeMapper, PayRandomCode> {
public void editById(PayRandomCode randomCode) {
}
@Resource
private PayRandomCodeMapper randomCodeMapper;
@Resource
private PayRandomCodeLinkMapper randomCodeLinkMapper;
public void add(PayRandomCode randomCode) {
randomCodeMapper.insert(randomCode);
String randomCodeId = randomCode.getRandomCodeId();
List<PayRandomCodeLink> randomCodeLinkList = new ArrayList<>();
for (Integer i = 0; i < randomCode.getRandomCodeCount(); i++) {
PayRandomCodeLink randomCodeLink = new PayRandomCodeLink();
randomCodeLink.setRandomCodeId(randomCodeId);
randomCodeLink.setRandomCode(RandomUtil.randomString(6));
randomCodeLinkList.add(randomCodeLink);
}
randomCodeLinkMapper.insertList(randomCodeLinkList);
}
public void editById(PayRandomCode randomCode) {
}
public void generate(PayRandomCode randomCode) {
}
public void additional(PayRandomCode randomCode) {
}
}