新增发行接口,开启缓存

This commit is contained in:
wenc000 2020-07-27 14:36:58 +08:00
parent cff52b7409
commit ee47e1ae00
6 changed files with 131 additions and 14 deletions

View File

@ -80,6 +80,16 @@ public class DataAreaAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getareabyid/{areaId}")
public DataAreaDTO getAreaById(@RequestHeader("token") String token, @PathVariable("areaId") String areaId) {
return getAreaByIdRelease(areaId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典详情ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典详情ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "地区字典ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getareabyid" + ISystemConstant.RELEASE_SUFFIX + "/{areaId}")
public DataAreaDTO getAreaByIdRelease(@PathVariable("areaId") String areaId) {
return dataAreaService.getAreaById(areaId);
}
@ -91,6 +101,16 @@ public class DataAreaAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listareabyparentid/{areaParentId}")
public List<DataAreaDTO> listAreaByParentId(@RequestHeader("token") String token, @PathVariable("areaParentId") String areaParentId) {
return listAreaByParentIdRelease(areaParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaParentId", value = "地区字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listareabyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{areaParentId}")
public List<DataAreaDTO> listAreaByParentIdRelease(@PathVariable("areaParentId") String areaParentId) {
return dataAreaService.listAreaByParentId(areaParentId);
}
@ -102,6 +122,16 @@ public class DataAreaAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listareaallbyparentid/{areaParentId}")
public List<DataAreaDTO> listArea(@RequestHeader("token") String token, @PathVariable("areaParentId") String areaParentId) throws SearchException {
return listAreaAllByParentIdRelease(areaParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典全部列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "地区字典全部列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaParentId", value = "地区字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listareaallbyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{areaParentId}")
public List<DataAreaDTO> listAreaAllByParentIdRelease(@PathVariable("areaParentId") String areaParentId) throws SearchException {
return dataAreaService.listAreaAllByParentId(areaParentId);
}
@ -118,6 +148,21 @@ public class DataAreaAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagearea")
public SuccessResultList<List<DataAreaDTO>> listPageArea(@RequestHeader("token") String token, ListPage page) {
return listPageAreaRelease(page);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页地区字典列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页地区字典列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagearea" + ISystemConstant.RELEASE_SUFFIX)
public SuccessResultList<List<DataAreaDTO>> listPageAreaRelease(ListPage page) {
Map<String, Object> params = requestParams();
String areaParentId = "0";
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_PARENT_ID) == null ? null : params.get(ISystemConstant.PARAMS_PARENT_ID).toString())) {
@ -136,6 +181,16 @@ public class DataAreaAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreearea")
public List<ZTreeDTO> listZTreeArea(@RequestHeader("token") String token) throws SearchException {
return listZTreeAreaRelease();
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreearea" + ISystemConstant.RELEASE_SUFFIX)
public List<ZTreeDTO> listZTreeAreaRelease() throws SearchException {
Map<String, Object> params = requestParams();
String areaParentId = "0";
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_ID) == null ? null : params.get(ISystemConstant.PARAMS_ID).toString())) {

View File

@ -80,6 +80,16 @@ public class DataDictionaryAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getdictionarybyid/{dictionaryId}")
public DataDictionaryDTO getDictionaryById(@RequestHeader("token") String token, @PathVariable("dictionaryId") String dictionaryId) {
return getDictionaryByIdRelease(dictionaryId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典详情ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典详情ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryId", value = "字典ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getdictionarybyid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryId}")
public DataDictionaryDTO getDictionaryByIdRelease(@PathVariable("dictionaryId") String dictionaryId) {
return dataDictionaryService.getDictionaryById(dictionaryId);
}
@ -91,6 +101,16 @@ public class DataDictionaryAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionarybyparentid/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryByParentId(@RequestHeader("token") String token, @PathVariable("dictionaryParentId") String dictionaryParentId) {
return listDictionaryByParentIdRelease(dictionaryParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionarybyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryByParentIdRelease(@PathVariable("dictionaryParentId") String dictionaryParentId) {
return dataDictionaryService.listDictionaryByParentId(dictionaryParentId);
}
@ -102,6 +122,16 @@ public class DataDictionaryAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionaryallbyparentid/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionary(@RequestHeader("token") String token, @PathVariable("dictionaryParentId") String dictionaryParentId) throws SearchException {
return listDictionaryRelease(dictionaryParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典全部列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典全部列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionaryallbyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryRelease(@PathVariable("dictionaryParentId") String dictionaryParentId) throws SearchException {
return dataDictionaryService.listDictionaryAllByParentId(dictionaryParentId);
}
@ -118,6 +148,21 @@ public class DataDictionaryAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagedictionary")
public SuccessResultList<List<DataDictionaryDTO>> listPageDictionary(@RequestHeader("token") String token, ListPage page) {
return listPageDictionaryRelease(page);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页字典列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页字典列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagedictionary" + ISystemConstant.RELEASE_SUFFIX)
public SuccessResultList<List<DataDictionaryDTO>> listPageDictionaryRelease(ListPage page) {
Map<String, Object> params = requestParams();
String dictionaryParentId = "0";
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_PARENT_ID) == null ? null : params.get(ISystemConstant.PARAMS_PARENT_ID).toString())) {
@ -136,6 +181,16 @@ public class DataDictionaryAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreedictionary")
public List<ZTreeDTO> listZTreeDictionary(@RequestHeader("token") String token) throws SearchException {
return listZTreeDictionaryRelease();
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreedictionary" + ISystemConstant.RELEASE_SUFFIX)
public List<ZTreeDTO> listZTreeDictionaryRelease() throws SearchException {
Map<String, Object> params = requestParams();
String dictionaryParentId = "0";
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_ID) == null ? null : params.get(ISystemConstant.PARAMS_ID).toString())) {

View File

@ -3,6 +3,7 @@ package com.cm.common.plugin.pojo.dtos.dataarea;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -17,8 +18,9 @@ import java.util.List;
* @Version: 1.0
**/
@ApiModel
public class DataAreaDTO {
public class DataAreaDTO implements Serializable {
private static final long serialVersionUID = 230115030021213880L;
@ApiModelProperty(name = "areaId", value = "地区ID")
private String areaId;
@ApiModelProperty(name = "areaParentId", value = "地区上级ID")

View File

@ -3,6 +3,7 @@ package com.cm.common.plugin.pojo.dtos.datadictionary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -17,7 +18,7 @@ import java.util.List;
* @Version: 1.0
**/
@ApiModel
public class DataDictionaryDTO {
public class DataDictionaryDTO implements Serializable {
@ApiModelProperty(name = "dictionaryId", value = "字典ID")
private String dictionaryId;

View File

@ -2,6 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.common.plugin.dao.dataarea.IDataAreaDao">
<cache/>
<resultMap id="areaDTO" type="com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO">
<id property="areaId" column="area_id"/>
<result property="areaParentId" column="area_parent_id"/>
@ -26,7 +28,7 @@
</resultMap>
<!-- 新增字典 -->
<insert id="saveArea" parameterType="map" useGeneratedKeys="true" keyColumn="areaId">
<insert id="saveArea" parameterType="map" useGeneratedKeys="true" keyColumn="areaId" flushCache="true">
INSERT INTO data_area(
area_parent_id,
area_name,
@ -67,7 +69,7 @@
</insert>
<!-- 删除字典 -->
<update id="removeArea" parameterType="map">
<update id="removeArea" parameterType="map" flushCache="true">
UPDATE
data_area
SET
@ -82,7 +84,7 @@
</update>
<!-- 修改字典 -->
<update id="updateArea" parameterType="map">
<update id="updateArea" parameterType="map" flushCache="true">
UPDATE
data_area
SET
@ -126,7 +128,7 @@
</update>
<!-- ztree列表 -->
<select id="listZTreeArea" parameterType="map" resultMap="areaZTreeDTO">
<select id="listZTreeArea" parameterType="map" resultMap="areaZTreeDTO" useCache="true">
SELECT
*
FROM
@ -140,7 +142,7 @@
</select>
<!-- 字典列表 -->
<select id="listArea" parameterType="map" resultMap="areaDTO">
<select id="listArea" parameterType="map" resultMap="areaDTO" useCache="true">
SELECT
area_id,
area_parent_id,
@ -222,7 +224,7 @@
</select>
<!-- 子节点数量 -->
<select id="countByParentId" parameterType="String" resultType="Integer">
<select id="countByParentId" parameterType="String" resultType="Integer" useCache="true">
SELECT
COUNT(*)
FROM

View File

@ -2,6 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.common.plugin.dao.datadictionary.IDataDictionaryDao">
<cache/>
<resultMap id="dictionaryDTO" type="com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO">
<id property="dictionaryId" column="dictionary_id"/>
<result property="dictionaryParentId" column="dictionary_parent_id"/>
@ -19,7 +21,7 @@
</resultMap>
<!-- 新增字典 -->
<insert id="saveDictionary" parameterType="map">
<insert id="saveDictionary" parameterType="map" flushCache="true">
INSERT INTO data_dictionary(
dictionary_id,
dictionary_parent_id,
@ -48,7 +50,7 @@
</insert>
<!-- 删除字典 -->
<update id="removeDictionary" parameterType="map">
<update id="removeDictionary" parameterType="map" flushCache="true">
UPDATE
data_dictionary
SET
@ -63,7 +65,7 @@
</update>
<!-- 修改字典 -->
<update id="updateDictionary" parameterType="map">
<update id="updateDictionary" parameterType="map" flushCache="true">
UPDATE
data_dictionary
SET
@ -86,7 +88,7 @@
</update>
<!-- ztree列表 -->
<select id="listZTreeDictionary" parameterType="map" resultMap="dictionaryZTreeDTO">
<select id="listZTreeDictionary" parameterType="map" resultMap="dictionaryZTreeDTO" useCache="true">
SELECT
*
FROM
@ -102,7 +104,7 @@
</select>
<!-- 字典列表 -->
<select id="listDictionary" parameterType="map" resultMap="dictionaryDTO">
<select id="listDictionary" parameterType="map" resultMap="dictionaryDTO" useCache="true">
SELECT
dictionary_id,
dictionary_parent_id,
@ -146,7 +148,7 @@
</select>
<!-- 字典详情 -->
<select id="getDictionary" parameterType="map" resultMap="dictionaryDTO">
<select id="getDictionary" parameterType="map" resultMap="dictionaryDTO" useCache="true">
SELECT
t1.*,
t2.dictionary_name dictionary_parent_name