diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java new file mode 100644 index 0000000..b946f97 --- /dev/null +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +/** + * 实体类 + * + * @author Chill + */ +@Data +@TableName("ex_dict") +public class ExDict implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "event_id", type = IdType.INPUT) + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long id; + + /** + * 父主键 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long parentId; + + /** + * 字典码 + */ + private String code; + + /** + * 字典值 + */ + private Integer dictKey; + + /** + * 字典名称 + */ + private String dictValue; + + /** + * 排序 + */ + private Integer sort; + + /** + * 字典备注 + */ + private String remark; + + /** + * 是否已删除 + */ + @TableLogic + private Integer isDeleted; + + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java b/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java new file mode 100644 index 0000000..cf9c082 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ccic.safeliab.entity.ExDict; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface DictMapper extends BaseMapper { + + + /** + * 获取字典表 + * + * @param code 字典编号 + * @return + */ + List getList(String code); + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java b/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java index 4d590cb..22efc9b 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java @@ -26,7 +26,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { //System.out.println("经过了此过滤器"); String uri = httpServletRequest.getRequestURI(); if (uri.indexOf("login") > 0 || uri.indexOf("getWorkId") > 0 || uri.indexOf("userLogin") > 0 - || uri.indexOf("userWxLogin") > 0 || uri.indexOf("demo") > 0) { + || uri.indexOf("userWxLogin") > 0 || uri.indexOf("demo") > 0 || uri.indexOf("ex") > 0) { filterChain.doFilter(httpServletRequest, httpServletResponse); return; } diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java new file mode 100644 index 0000000..66846bc --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ccic.safeliab.entity.ExDict; + +import java.util.List; + +/** + * 服务类 + * + * @author Chill + */ +public interface DictService extends IService { + + /** + * 获取字典表 + * + * @param code 字典编号 + * @return + */ + List getList(String code); +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java new file mode 100644 index 0000000..b41e929 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ccic.safeliab.dao.DictMapper; +import com.ccic.safeliab.entity.ExDict; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 服务实现类 + * + * @author Chill + */ +@Service +public class DictServiceImpl extends ServiceImpl implements DictService { + + + @Override + public List getList(String code) { + return baseMapper.getList(code); + } + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java index a1b68c6..18e2eb9 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/demo") +@RequestMapping("/ex/demo") public class DemoController { @Autowired diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java new file mode 100644 index 0000000..07297df --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.web; + +import com.ccic.safeliab.util.R; +import com.ccic.safeliab.entity.ExDict; +import com.ccic.safeliab.service.DictService; +import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import java.util.List; + + +/** + * 控制器 + * + * @author Chill + */ +@RestController +@RequestMapping("/ex/dict") +public class DictController { + + @Autowired + private DictService dictService; + + /** + * 获取字典 + * + * @return + */ + @GetMapping("/dictionary") + public R dictionary(String code) { + List tree = dictService.getList(code); + return R.ok().data(tree); + } + + +} diff --git a/ccic-exam/src/main/resources/mappers/DictMapper.xml b/ccic-exam/src/main/resources/mappers/DictMapper.xml new file mode 100644 index 0000000..3395eea --- /dev/null +++ b/ccic-exam/src/main/resources/mappers/DictMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + +