This commit is contained in:
王洪庆 2023-03-31 10:35:22 +08:00
parent 7cb7144184
commit 946a7a317c
8 changed files with 86 additions and 34 deletions

View File

@ -7,34 +7,4 @@ package org.springblade.common.utils;
*/
public class CommonUtil {
/**
* 通过身份证号获取性别
*
* @param IdNo String
* @return String
*/
public static String getSexFromId(String IdNo) {
try {
return (Integer.parseInt(IdNo.substring(16,17)) % 2 == 0 ? "" : "");
} catch (Exception ignored) {
}
return "";
}
/**
* 仅用JDK11中的警告
*/
public static void disableWarning() {
try {
java.lang.reflect.Field theUnsafe = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
sun.misc.Unsafe u = (sun.misc.Unsafe) theUnsafe.get(null);
Class<?> cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
java.lang.reflect.Field logger = cls.getDeclaredField("logger");
u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
} catch (Exception e) {
// ignore
}
}
}

View File

@ -0,0 +1,16 @@
package com.kening.vordm.vo;
import lombok.Data;
/**
* @author wanghongqing
* @date 2023/3/31 09:46
**/
@Data
public class DisasterInfo {
private Long id;
private String content;
}

View File

@ -0,0 +1,28 @@
package com.kening.vordm.controller;
import com.kening.vordm.entity.DisasterType;
import com.kening.vordm.service.DisasterTypeService;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author wanghongqing
* @date 2023/3/31 09:38
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/DisasterType")
public class DisasterTypeController {
private final DisasterTypeService disasterTypeService;
@GetMapping("/all")
public R<List<DisasterType>> list() {
return R.data(disasterTypeService.list());
}
}

View File

@ -0,0 +1,34 @@
package com.kening.vordm.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kening.vordm.entity.News;
import com.kening.vordm.entity.Websites;
import com.kening.vordm.service.NewsService;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author wanghongqing
* @date 2023/3/31 09:15
**/
@RestController
@RequiredArgsConstructor
public class NewsController {
private final NewsService newsService;
@GetMapping("/news")
public R<List<News>> getNews(String content) {
// LambdaQueryWrapper<News> qr = new LambdaQueryWrapper<>();
// qr.like(News::getContent, content);
List<News> list = newsService.list(Wrappers.<News>lambdaQuery().like(News::getContent, content));
return R.data(list);
}
}

View File

@ -3,6 +3,9 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kening.vordm.entity.DisasterType;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author G1393
@ -11,6 +14,4 @@ import com.kening.vordm.entity.DisasterType;
* @Entity new.domain.DisasterType
*/
public interface DisasterTypeMapper extends BaseMapper<DisasterType> {
}

View File

@ -12,4 +12,5 @@
<sql id="Base_Column_List">
id,type
</sql>
</mapper>

View File

@ -3,11 +3,12 @@ package com.kening.vordm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.DisasterType;
import java.util.List;
/**
* @author G1393
* @description 针对表disaster_type的数据库操作Service
* @createDate 2023-03-30 17:40:27
*/
public interface DisasterTypeService extends IService<DisasterType> {
}

View File

@ -6,6 +6,8 @@ import com.kening.vordm.mapper.DisasterTypeMapper;
import com.kening.vordm.service.DisasterTypeService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author G1393
* @description 针对表disaster_type的数据库操作Service实现
@ -14,5 +16,4 @@ import org.springframework.stereotype.Service;
@Service
public class DisasterTypeServiceImpl extends ServiceImpl<DisasterTypeMapper, DisasterType>
implements DisasterTypeService {
}