demo
This commit is contained in:
parent
7cb7144184
commit
946a7a317c
|
@ -7,34 +7,4 @@ package org.springblade.common.utils;
|
||||||
*/
|
*/
|
||||||
public class CommonUtil {
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,9 @@ package com.kening.vordm.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.kening.vordm.entity.DisasterType;
|
import com.kening.vordm.entity.DisasterType;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author G1393
|
* @author G1393
|
||||||
|
@ -11,6 +14,4 @@ import com.kening.vordm.entity.DisasterType;
|
||||||
* @Entity new.domain.DisasterType
|
* @Entity new.domain.DisasterType
|
||||||
*/
|
*/
|
||||||
public interface DisasterTypeMapper extends BaseMapper<DisasterType> {
|
public interface DisasterTypeMapper extends BaseMapper<DisasterType> {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,5 @@
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,type
|
id,type
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -3,11 +3,12 @@ package com.kening.vordm.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.kening.vordm.entity.DisasterType;
|
import com.kening.vordm.entity.DisasterType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author G1393
|
* @author G1393
|
||||||
* @description 针对表【disaster_type】的数据库操作Service
|
* @description 针对表【disaster_type】的数据库操作Service
|
||||||
* @createDate 2023-03-30 17:40:27
|
* @createDate 2023-03-30 17:40:27
|
||||||
*/
|
*/
|
||||||
public interface DisasterTypeService extends IService<DisasterType> {
|
public interface DisasterTypeService extends IService<DisasterType> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.kening.vordm.mapper.DisasterTypeMapper;
|
||||||
import com.kening.vordm.service.DisasterTypeService;
|
import com.kening.vordm.service.DisasterTypeService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author G1393
|
* @author G1393
|
||||||
* @description 针对表【disaster_type】的数据库操作Service实现
|
* @description 针对表【disaster_type】的数据库操作Service实现
|
||||||
|
@ -14,5 +16,4 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class DisasterTypeServiceImpl extends ServiceImpl<DisasterTypeMapper, DisasterType>
|
public class DisasterTypeServiceImpl extends ServiceImpl<DisasterTypeMapper, DisasterType>
|
||||||
implements DisasterTypeService {
|
implements DisasterTypeService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue