提交 c636662e authored 作者: 张桂's avatar 张桂

添加Lic名称字段,修改查询,增加,update接口

上级 bf296e19
...@@ -350,6 +350,7 @@ CREATE TABLE `undo_log` ( ...@@ -350,6 +350,7 @@ CREATE TABLE `undo_log` (
DROP TABLE IF EXISTS `tb_lic_info`; DROP TABLE IF EXISTS `tb_lic_info`;
CREATE TABLE `tb_lic_info` ( CREATE TABLE `tb_lic_info` (
`lq_lic_name` VARCHAR(128) NOT NULL COMMENT 'lic名称',
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`mac_address` VARCHAR(128) NOT NULL COMMENT 'MAC地址', `mac_address` VARCHAR(128) NOT NULL COMMENT 'MAC地址',
`effective_time` TIMESTAMP NOT NULL COMMENT '导入有效时间', `effective_time` TIMESTAMP NOT NULL COMMENT '导入有效时间',
......
...@@ -49,5 +49,4 @@ public interface LicInfoMapper { ...@@ -49,5 +49,4 @@ public interface LicInfoMapper {
*/ */
LicInfoListOutVoRecords getLicInfoByMacAddress(String macAddress); LicInfoListOutVoRecords getLicInfoByMacAddress(String macAddress);
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<select id="licInfoList" parameterType="com.system.transfer.lic.LicInfoListInVo" resultType="com.system.transfer.lic.LicInfoListOutVoRecords"> <select id="licInfoList" parameterType="com.system.transfer.lic.LicInfoListInVo" resultType="com.system.transfer.lic.LicInfoListOutVoRecords">
SELECT SELECT
id, mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark, create_time id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark, create_time
FROM tb_lic_info FROM tb_lic_info
<where> <where>
<if test="inVo.macAddress != null and inVo.macAddress != ''"> <if test="inVo.macAddress != null and inVo.macAddress != ''">
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
<insert id="licInfoCreate" parameterType="com.system.transfer.lic.LicInfoCreateInVo"> <insert id="licInfoCreate" parameterType="com.system.transfer.lic.LicInfoCreateInVo">
INSERT INTO tb_lic_info ( INSERT INTO tb_lic_info (
mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark
) VALUES ( ) VALUES (
#{macAddress}, #{effectiveTime}, #{fileEffectiveTime}, #{verificationInterval}, #{moduleVerification}, #{remark} #{lqLicName}, #{macAddress}, #{effectiveTime}, #{fileEffectiveTime}, #{verificationInterval}, #{moduleVerification}, #{remark}
) )
</insert> </insert>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<update id="licInfoUpdate" parameterType="com.system.transfer.lic.LicInfoUpdateInVo"> <update id="licInfoUpdate" parameterType="com.system.transfer.lic.LicInfoUpdateInVo">
UPDATE tb_lic_info SET UPDATE tb_lic_info SET
mac_address = #{macAddress}, effective_time = #{effectiveTime}, file_effective_time = #{fileEffectiveTime}, lq_lic_name = #{lqLicName}, mac_address = #{macAddress}, effective_time = #{effectiveTime}, file_effective_time = #{fileEffectiveTime},
verification_interval = #{verificationInterval}, module_verification = #{moduleVerification}, remark = #{remark} verification_interval = #{verificationInterval}, module_verification = #{moduleVerification}, remark = #{remark}
WHERE id = #{id} WHERE id = #{id}
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<select id="getLicInfoByMacAddress" parameterType="java.lang.String" resultType="com.system.transfer.lic.LicInfoListOutVoRecords"> <select id="getLicInfoByMacAddress" parameterType="java.lang.String" resultType="com.system.transfer.lic.LicInfoListOutVoRecords">
SELECT SELECT
id, mac_address, effective_time, file_effective_time, verification_interval, module_verification, create_time id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, create_time
FROM tb_lic_info WHERE mac_address = #{macAddress} FROM tb_lic_info WHERE mac_address = #{macAddress}
</select> </select>
......
...@@ -42,6 +42,7 @@ public class LicInfoServiceImpl implements ILicInfoService { ...@@ -42,6 +42,7 @@ public class LicInfoServiceImpl implements ILicInfoService {
@Override @Override
public void licInfoCreate(LicInfoCreateInVo inVo) { public void licInfoCreate(LicInfoCreateInVo inVo) {
licInfoMapper.licInfoCreate(inVo); licInfoMapper.licInfoCreate(inVo);
} }
...@@ -64,7 +65,7 @@ public class LicInfoServiceImpl implements ILicInfoService { ...@@ -64,7 +65,7 @@ public class LicInfoServiceImpl implements ILicInfoService {
try { try {
String data = RsaUtil.encryptByPrivateKeyToLong(JsonUtil.toString(inVo), rsaKeyConstant.getPrivateKey()); String data = RsaUtil.encryptByPrivateKeyToLong(JsonUtil.toString(inVo), rsaKeyConstant.getPrivateKey());
DownloadUtil.download(response, data); DownloadUtil.download(response, data, records.getMacAddress());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return RestResponse.fail("Lic文件生成失败"); return RestResponse.fail("Lic文件生成失败");
......
...@@ -9,6 +9,11 @@ import lombok.Data; ...@@ -9,6 +9,11 @@ import lombok.Data;
public class LicInfoCreateInVo { public class LicInfoCreateInVo {
/** /**
* lic名称
*/
private String lqLicName;
/**
* MAC地址 * MAC地址
*/ */
private String macAddress; private String macAddress;
......
...@@ -13,6 +13,10 @@ public class LicInfoListOutVoRecords { ...@@ -13,6 +13,10 @@ public class LicInfoListOutVoRecords {
*/ */
private Integer id; private Integer id;
/**
* lic名称
*/
private String lqLicName;
/** /**
* MAC地址 * MAC地址
......
...@@ -13,6 +13,10 @@ public class LicInfoUpdateInVo { ...@@ -13,6 +13,10 @@ public class LicInfoUpdateInVo {
*/ */
private Integer id; private Integer id;
/**
* lic名称
*/
private String lqLicName;
/** /**
* MAC地址 * MAC地址
......
...@@ -13,11 +13,11 @@ import java.nio.charset.StandardCharsets; ...@@ -13,11 +13,11 @@ import java.nio.charset.StandardCharsets;
*/ */
public class DownloadUtil { public class DownloadUtil {
public static void download(HttpServletResponse response, String data) { public static void download(HttpServletResponse response, String data,String mac) {
//设置响应的内容类型 //设置响应的内容类型
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("text/plain"); response.setContentType("text/plain");
response.addHeader("Content-Disposition", "attachment;filename=lic.tmp"); response.addHeader("Content-Disposition", "attachment;filename=lic"+mac+".lqlic");
BufferedOutputStream bufferedOutputStream = null; BufferedOutputStream bufferedOutputStream = null;
ServletOutputStream servletOutputStream = null; ServletOutputStream servletOutputStream = null;
......
...@@ -22,8 +22,8 @@ spring: ...@@ -22,8 +22,8 @@ spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/db_lic?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false url: jdbc:mysql://127.0.0.1:3306/db_lic?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
username: inori username: root
password: inori password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论