增加接口

This commit is contained in:
wanggeng 2023-02-20 15:42:03 +08:00
parent 2cc0729bdc
commit 7b4a97f670
5 changed files with 135 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException; import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.pojo.pos.datadictionary.DataDictionaryPO;
import com.cm.common.pojo.dtos.ZTreeDTO; import com.cm.common.pojo.dtos.ZTreeDTO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -54,6 +55,15 @@ public interface IDataDictionaryDao {
*/ */
List<DataDictionaryDTO> listDictionary(Map<String, Object> params) throws SearchException; List<DataDictionaryDTO> listDictionary(Map<String, Object> params) throws SearchException;
/**
* 字典列表
*
* @param params
* @return
* @throws SearchException
*/
List<DataDictionaryPO> listPO(Map<String, Object> params) throws SearchException;
/** /**
* 字典详情 * 字典详情
* *
@ -63,6 +73,16 @@ public interface IDataDictionaryDao {
*/ */
DataDictionaryDTO getDictionary(Map<String, Object> params) throws SearchException; DataDictionaryDTO getDictionary(Map<String, Object> params) throws SearchException;
/**
* 字典详情
*
* @param params
* @return
* @throws SearchException
*/
DataDictionaryPO getPO(Map<String, Object> params) throws SearchException;
/** /**
* 获取最后一个字字典 * 获取最后一个字字典
* *

View File

@ -0,0 +1,74 @@
package com.cm.common.plugin.pojo.pos.datadictionary;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: DictionaryDTO
* @Description: 字典
* @Author: WangGeng
* @Date: 2019/11/18 14:17
* @Version: 1.0
**/
@ApiModel
public class DataDictionaryPO implements Serializable {
private String dictionaryId;
private String dictionaryParentId;
private String dictionaryName;
private String dictionarySummary;
private String dictionaryCode;
private String dictionarySort;
public String getDictionaryId() {
return dictionaryId == null ? "" : dictionaryId.trim();
}
public void setDictionaryId(String dictionaryId) {
this.dictionaryId = dictionaryId;
}
public String getDictionaryParentId() {
return dictionaryParentId == null ? "" : dictionaryParentId.trim();
}
public void setDictionaryParentId(String dictionaryParentId) {
this.dictionaryParentId = dictionaryParentId;
}
public String getDictionaryName() {
return dictionaryName == null ? "" : dictionaryName.trim();
}
public void setDictionaryName(String dictionaryName) {
this.dictionaryName = dictionaryName;
}
public String getDictionarySummary() {
return dictionarySummary == null ? "" : dictionarySummary.trim();
}
public void setDictionarySummary(String dictionarySummary) {
this.dictionarySummary = dictionarySummary;
}
public String getDictionaryCode() {
return dictionaryCode == null ? "" : dictionaryCode.trim();
}
public void setDictionaryCode(String dictionaryCode) {
this.dictionaryCode = dictionaryCode;
}
public String getDictionarySort() {
return dictionarySort == null ? "" : dictionarySort.trim();
}
public void setDictionarySort(String dictionarySort) {
this.dictionarySort = dictionarySort;
}
}

View File

@ -1,10 +1,9 @@
package com.cm.common.plugin.service.datadictionary; package com.cm.common.plugin.service.datadictionary;
import com.cm.common.exception.RemoveException; import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.pojo.pos.datadictionary.DataDictionaryPO;
import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO; import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO;
import com.cm.common.pojo.ListPage; import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.ZTreeDTO; import com.cm.common.pojo.dtos.ZTreeDTO;
@ -112,6 +111,15 @@ public interface IDataDictionaryService {
*/ */
DataDictionaryDTO getDictionaryById(String dictionaryId) throws SearchException; DataDictionaryDTO getDictionaryById(String dictionaryId) throws SearchException;
/**
* 通过ID获取字典
*
* @param dictionaryId
* @return
* @throws SearchException
*/
DataDictionaryPO getPOById(String dictionaryId) throws SearchException;
/** /**
* 通过上级ID获取字典列表 * 通过上级ID获取字典列表
* *

View File

@ -6,6 +6,7 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import com.cm.common.plugin.dao.datadictionary.IDataDictionaryDao; import com.cm.common.plugin.dao.datadictionary.IDataDictionaryDao;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.pojo.pos.datadictionary.DataDictionaryPO;
import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO; import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO;
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
import com.cm.common.pojo.ListPage; import com.cm.common.pojo.ListPage;
@ -136,6 +137,13 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
return dictionaryDao.getDictionary(params); return dictionaryDao.getDictionary(params);
} }
@Override
public DataDictionaryPO getPOById(String dictionaryId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("dictionaryId", dictionaryId);
return dictionaryDao.getPO(params);
}
@Override @Override
public List<DataDictionaryDTO> listDictionaryByParentId(String dictionaryParentId) throws SearchException { public List<DataDictionaryDTO> listDictionaryByParentId(String dictionaryParentId) throws SearchException {
Map<String, Object> params = getHashMap(1); Map<String, Object> params = getHashMap(1);

View File

@ -14,6 +14,15 @@
<result property="dictionarySort" column="dictionary_sort"/> <result property="dictionarySort" column="dictionary_sort"/>
</resultMap> </resultMap>
<resultMap id="dictionaryPO" type="com.cm.common.plugin.pojo.pos.datadictionary.DataDictionaryPO">
<id property="dictionaryId" column="dictionary_id"/>
<result property="dictionaryParentId" column="dictionary_parent_id"/>
<result property="dictionaryName" column="dictionary_name"/>
<result property="dictionarySummary" column="dictionary_summary"/>
<result property="dictionaryCode" column="dictionary_code"/>
<result property="dictionarySort" column="dictionary_sort"/>
</resultMap>
<resultMap id="dictionaryZTreeDTO" type="com.cm.common.pojo.dtos.ZTreeDTO"> <resultMap id="dictionaryZTreeDTO" type="com.cm.common.pojo.dtos.ZTreeDTO">
<id property="id" column="dictionary_id"/> <id property="id" column="dictionary_id"/>
<result property="pId" column="dictionary_parent_id"/> <result property="pId" column="dictionary_parent_id"/>
@ -168,6 +177,20 @@
</if> </if>
</select> </select>
<!-- 字典详情 -->
<select id="getPO" parameterType="map" resultMap="dictionaryPO" useCache="true">
SELECT
t1.*
FROM
data_dictionary t1
WHERE
t1.is_delete = 0
<if test="dictionaryId != null and dictionaryId != ''">
AND
t1.dictionary_id = #{dictionaryId}
</if>
</select>
<!-- 子节点数量 --> <!-- 子节点数量 -->
<select id="countByParentId" parameterType="String" resultType="Integer"> <select id="countByParentId" parameterType="String" resultType="Integer">
SELECT SELECT