lis字典管理
This commit is contained in:
parent
0b4488d6dd
commit
be312977d8
@ -41,4 +41,9 @@ public class CacheConstants
|
||||
* 登录账户密码错误次数 redis key
|
||||
*/
|
||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||
|
||||
/**
|
||||
* lis字典缓存
|
||||
*/
|
||||
public static final String COM_DICT_KEY = "com_dict:";
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.czlis.liswork.pojo;
|
||||
package com.czlis.common.core.domain.entity;
|
||||
|
||||
import com.czlis.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -7,7 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ComDict {
|
||||
public class ComDict extends BaseEntity {
|
||||
private String zdlb;
|
||||
private String zddh;
|
||||
private String zdmc;
|
||||
@ -0,0 +1,53 @@
|
||||
package com.czlis.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czlis.common.constant.CacheConstants;
|
||||
import com.czlis.common.core.domain.entity.ComDict;
|
||||
import com.czlis.common.core.redis.RedisCache;
|
||||
import com.czlis.common.utils.spring.SpringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* lis字典工具类
|
||||
*/
|
||||
public class ComDictUtils {
|
||||
|
||||
/**
|
||||
* 设置字典缓存
|
||||
*
|
||||
* @param key 参数键
|
||||
* @param dictDatas 字典数据列表
|
||||
*/
|
||||
public static void setDictCache(String key, List<ComDict> dictDatas) {
|
||||
//先清除该key的所有缓存,然后再重新设置该key的缓存
|
||||
SpringUtils.getBean(RedisCache.class).deleteObject(key);
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典缓存
|
||||
*
|
||||
* @param key 参数键
|
||||
* @return dictDatas 字典数据列表
|
||||
*/
|
||||
public static List<ComDict> getDictCache(String key) {
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
||||
if (StringUtils.isNotNull(arrayCache)) {
|
||||
return arrayCache.toList(ComDict.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
public static String getCacheKey(String configKey) {
|
||||
return CacheConstants.COM_DICT_KEY + configKey;
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ import com.czlis.common.utils.StringUtils;
|
||||
/**
|
||||
* spring工具类 方便在非spring管理环境中获取bean
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author admin
|
||||
*/
|
||||
@Component
|
||||
public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware {
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
/**
|
||||
* 限流处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author admin
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
|
||||
@ -110,7 +110,7 @@ public class SecurityConfig {
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/zyreq/**").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
.antMatchers("/doc.html").permitAll() //Knife4j 过滤
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
|
||||
@ -15,32 +15,25 @@ import java.lang.reflect.Method;
|
||||
/**
|
||||
* 防止重复提交拦截器
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author admin
|
||||
*/
|
||||
@Component
|
||||
public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
|
||||
{
|
||||
public abstract class RepeatSubmitInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
|
||||
{
|
||||
if (handler instanceof HandlerMethod)
|
||||
{
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
if (handler instanceof HandlerMethod) {
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
Method method = handlerMethod.getMethod();
|
||||
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
||||
if (annotation != null)
|
||||
{
|
||||
if (this.isRepeatSubmit(request, annotation))
|
||||
{
|
||||
if (annotation != null) {
|
||||
if (this.isRepeatSubmit(request, annotation)) {
|
||||
AjaxResult ajaxResult = AjaxResult.error(annotation.message());
|
||||
ServletUtils.renderString(response, JSON.toJSONString(ajaxResult));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -48,7 +41,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
|
||||
/**
|
||||
* 验证是否重复提交由子类实现具体的防重复提交的规则
|
||||
*
|
||||
* @param request 请求信息
|
||||
* @param request 请求信息
|
||||
* @param annotation 防重复注解参数
|
||||
* @return 结果
|
||||
* @throws Exception
|
||||
|
||||
@ -14,7 +14,7 @@ import java.util.Map;
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author admin
|
||||
*/
|
||||
@Api(tags = "测试用户信息管理")
|
||||
@RestController
|
||||
|
||||
@ -115,10 +115,10 @@ mybatis:
|
||||
#org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: sqlserver
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
#pagehelper:
|
||||
# helperDialect: sqlserver
|
||||
# supportMethodsArguments: true
|
||||
# params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
package com.czlis.liswork.controller.dict;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.czlis.common.core.controller.BaseController;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.liswork.pojo.ComDict;
|
||||
import com.czlis.common.core.page.TableDataInfo;
|
||||
import com.czlis.common.core.domain.entity.ComDict;
|
||||
import com.czlis.liswork.service.ComDictService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,29 +20,43 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/comdict")
|
||||
@Api(tags = "字典管理")
|
||||
public class DictController {
|
||||
@Slf4j
|
||||
public class DictController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ComDictService comDictService;
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
* @param zdlb
|
||||
* @param yljg
|
||||
* @param zddh
|
||||
* @param comDict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询字典列表")
|
||||
@GetMapping("/query")
|
||||
public Result getComDictList(@RequestParam String zdlb, @RequestParam String yljg, @RequestParam String zddh){
|
||||
List<ComDict> comDictList = comDictService.getComDictList(zdlb, zddh, yljg);
|
||||
return new Result("0","获取字典数据成功!",comDictList);
|
||||
public TableDataInfo getComDictList(ComDict comDict){
|
||||
log.info("调用查询字典列表,{}",comDict);
|
||||
startPage();
|
||||
List<ComDict> comDictList = comDictService.getComDictList(comDict);
|
||||
return getDataTable(comDictList);
|
||||
}
|
||||
|
||||
@ApiOperation("新增字典")
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody ComDict comDict){
|
||||
log.info("调用新增字典{}",comDict);
|
||||
return comDictService.insertComDict(comDict);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("测试方法swagger")
|
||||
@GetMapping("/test11")
|
||||
public Result test11(){
|
||||
return new Result("0","测试controller!!!");
|
||||
@DeleteMapping("/del")
|
||||
public Result delComDict(ComDict comDict){
|
||||
log.info("调用删除字典接口{}",comDict);
|
||||
return comDictService.delComDict(comDict);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public Result updateComDict(ComDict comDict){
|
||||
return comDictService.updateComDict(comDict);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package com.czlis.liswork.mapper.dict;
|
||||
|
||||
|
||||
import com.czlis.liswork.pojo.ComDict;
|
||||
import com.czlis.common.core.domain.entity.ComDict;
|
||||
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface ComDictMapper {
|
||||
List<ComDict> getComDictList(String zdlb, String zddh, String yljg);
|
||||
List<ComDict> getComDictList(ComDict comDict);
|
||||
int insertComDict(ComDict comDict);
|
||||
int delComDict(ComDict comDict);
|
||||
|
||||
int updateComDict(ComDict comDict);
|
||||
|
||||
}
|
||||
|
||||
@ -2,10 +2,18 @@ package com.czlis.liswork.service;
|
||||
|
||||
|
||||
|
||||
import com.czlis.liswork.pojo.ComDict;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.ComDict;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ComDictService {
|
||||
List<ComDict> getComDictList(String zdlb, String zddh, String yljg);
|
||||
List<ComDict> getComDictList(ComDict comDict);
|
||||
|
||||
Result insertComDict(ComDict comDict);
|
||||
|
||||
Result delComDict(ComDict comDict);
|
||||
|
||||
Result updateComDict(ComDict comDict);
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,23 @@
|
||||
package com.czlis.liswork.service.impl;
|
||||
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.utils.ComDictUtils;
|
||||
import com.czlis.liswork.mapper.dict.ComDictMapper;
|
||||
import com.czlis.liswork.pojo.ComDict;
|
||||
import com.czlis.common.core.domain.entity.ComDict;
|
||||
import com.czlis.liswork.service.ComDictService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.czlis.common.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* lis字典管理
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ComDictServiceImpl implements ComDictService {
|
||||
@ -20,8 +28,52 @@ public class ComDictServiceImpl implements ComDictService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<ComDict> getComDictList(String zdlb, String zddh, String yljg) {
|
||||
return comDictMapper.getComDictList(zdlb,zddh,yljg);
|
||||
public List<ComDict> getComDictList(ComDict comDict) {
|
||||
//先从redis缓存中获取,如果没有,就从数据库取
|
||||
// List<ComDict> dictCache = ComDictUtils.getDictCache(comDict.getZdlb());
|
||||
// if (dictCache != null) return dictCache;
|
||||
// List<ComDict> comDictList = comDictMapper.getComDictList(comDict);
|
||||
// //加载缓存
|
||||
// ComDictUtils.setDictCache(comDict.getZdlb(),comDictList);
|
||||
// return comDictMapper.getComDictList(comDict);
|
||||
|
||||
|
||||
return comDictMapper.getComDictList(comDict);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Result insertComDict(ComDict comDict) {
|
||||
int row = comDictMapper.insertComDict(comDict);
|
||||
if(row > 0){
|
||||
List<ComDict> comDictList = comDictMapper.getComDictList(comDict);
|
||||
ComDictUtils.setDictCache(comDict.getZdlb(),comDictList);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Result delComDict(ComDict comDict) {
|
||||
String zdlb = comDict.getZdlb();
|
||||
String zddh = comDict.getZddh();
|
||||
String yljg = comDict.getYljg();
|
||||
if(zdlb == null || zdlb.equals("")) return new Result("-1","字典类别不能为空!");
|
||||
if(zddh == null || zddh.equals("")) return new Result("-1","字典代号不能为空!");
|
||||
if(yljg == null || yljg.equals("")) return new Result("-1","医疗机构不能为空!");
|
||||
int row = comDictMapper.delComDict(comDict);
|
||||
return new Result("0","删除成功!");
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Result updateComDict(ComDict comDict) {
|
||||
int row = comDictMapper.updateComDict(comDict);
|
||||
if(row > 0) {
|
||||
List<ComDict> comDictList = comDictMapper.getComDictList(comDict);
|
||||
ComDictUtils.setDictCache(comDict.getZdlb(),comDictList);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
select zdlb,zddh,zdmc,zjf,zdbz,bz,yljg,userflag from com_dict
|
||||
</sql>
|
||||
|
||||
<select id="getComDictList" resultType="com.czlis.liswork.pojo.ComDict" parameterType="string">
|
||||
<select id="getComDictList" resultType="com.czlis.common.core.domain.entity.ComDict">
|
||||
<include refid="selectComDictVo"></include>
|
||||
<where>
|
||||
<if test="zdlb != null and zdlb != ''">
|
||||
@ -19,8 +19,51 @@
|
||||
<if test="yljg != null and yljg != ''">
|
||||
and yljg = #{yljg}
|
||||
</if>
|
||||
<if test="zdmc != null and zdmc != ''">
|
||||
and zdmc like '%'+#{zdmc}+'%'
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertComDict" parameterType="com.czlis.common.core.domain.entity.ComDict">
|
||||
insert into com_dict(
|
||||
<if test="zdlb != null and zdlb != ''">zdlb,</if>
|
||||
<if test="zddh != null and zddh != ''">zddh,</if>
|
||||
<if test="zdmc != null">zdmc,</if>
|
||||
<if test="zjf != null and zjf != ''">zjf,</if>
|
||||
<if test="zdbz != null and zdbz != ''">zdbz,</if>
|
||||
<if test="bz != null and bz != ''">bz,</if>
|
||||
<if test="yljg != null and yljg != ''">yljg,</if>
|
||||
<if test="userflag != null and userflag != ''">userflag,</if>
|
||||
)values(
|
||||
<if test="zdlb != null and zdlb != ''">#{zdlb}</if>
|
||||
<if test="zddh != null and zddh != ''">#{zddh}</if>
|
||||
<if test="zdmc != null">#{zdmc}</if>
|
||||
<if test="zjf != null and zjf != ''">#{zjf}</if>
|
||||
<if test="zdbz != null and zdbz != ''">#{zdbz}</if>
|
||||
<if test="bz != null and bz != ''">#{bz}</if>
|
||||
<if test="yljg != null and yljg != ''">#{yljg}</if>
|
||||
<if test="userflag != null and userflag != ''">#{userflag}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="delComDict" parameterType="com.czlis.common.core.domain.entity.ComDict">
|
||||
delete from com_dict where zdlb = #{zdlb} and zddh = #{zddh} and yljg = #{yljg}
|
||||
</delete>
|
||||
|
||||
<update id="updateComDict" parameterType="com.czlis.common.core.domain.entity.ComDict">
|
||||
update com_dict
|
||||
<set>
|
||||
<if test="zdlb != null and zdlb != ''">zdlb = #{zdlb}</if>
|
||||
<if test="zddh != null and zddh != ''">zddh = #{zddh}</if>
|
||||
<if test="zdmc != null">zdmc= #{zdmc}</if>
|
||||
<if test="zjf != null and zjf != ''">zjf = #{zjf}</if>
|
||||
<if test="zdbz != null and zdbz != ''">zdbz = #{zdbz}</if>
|
||||
<if test="bz != null and bz != ''">bz = #{bz}</if>
|
||||
<if test="yljg != null and yljg != ''">yljg = #{yljg}</if>
|
||||
<if test="userflag != null and userflag != ''">userflag = #{userflag}</if>
|
||||
</set>
|
||||
where zdlb = #{zdlb} and zddh = {zddh} and yljg = #{yljg}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -5,21 +5,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<mapper namespace="com.czlis.zycx.mapper.ZycxMapper">
|
||||
|
||||
<sql id="selectLabReqmainVo">
|
||||
select * from lab_reqmain where 1=1
|
||||
select * from lab_reqmain
|
||||
</sql>
|
||||
|
||||
<select id="getSQDInfo" parameterType="com.czlis.common.core.domain.entity.LabReqmain" resultType="com.czlis.common.core.domain.entity.LabReqmain">
|
||||
<include refid="selectLabReqmainVo"></include>
|
||||
<if test="sqh != null and sqh != ''"> and sqh = #{sqh}</if>
|
||||
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
|
||||
<if test="ksdh != null and ksdh != ''"> and ksdh = #{ksdh}</if>
|
||||
<if test="brly != null and brly != ''"> and brly = #{brly}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND sqsj >= CONVERT(varchar(100), #{params.beginTime}, 120)
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND sqsj <= CONVERT(varchar(100), #{params.endTime}, 120)
|
||||
</if>
|
||||
<where>
|
||||
<if test="sqh != null and sqh != ''"> and sqh = #{sqh}</if>
|
||||
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
|
||||
<if test="ksdh != null and ksdh != ''"> and ksdh = #{ksdh}</if>
|
||||
<if test="brly != null and brly != ''"> and brly = #{brly}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND sqsj >= CONVERT(varchar(100), #{params.beginTime}, 120)
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND sqsj <= CONVERT(varchar(100), #{params.endTime}, 120)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user