【优化】添加多语言支持
This commit is contained in:
parent
7831ffaeeb
commit
65eb449fea
|
|
@ -46,7 +46,6 @@ import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典相关
|
* 字典相关
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -68,7 +67,6 @@ public class DictionaryController extends ControllerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索字典
|
* 搜索字典
|
||||||
*
|
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
* @return 字典列表
|
* @return 字典列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -218,8 +216,8 @@ public class DictionaryController extends ControllerBase {
|
||||||
* @return 字典值列表
|
* @return 字典值列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("getListByDictionaryCode")
|
@GetMapping("getListByDictionaryCode")
|
||||||
@ApiMark(moduleName = "字典管理", apiName = "根据字典编码获取字典值列表",isPublic = true)
|
@ApiMark(moduleName = "字典管理", apiName = "根据字典编码获取字典值列表", isPublic = true)
|
||||||
public ApiResult<List<DictionaryItem>> getListByDictionaryCode(@Valid @RequestParam @NotBlank String dictionaryCode){
|
public ApiResult<List<DictionaryItem>> getListByDictionaryCode(@Valid @RequestParam @NotBlank String dictionaryCode) {
|
||||||
return ApiResult.success(dictionaryItemService.getListByDictionaryCode(dictionaryCode, MultilingualUtil.getLanguage()));
|
return ApiResult.success(dictionaryItemService.getListByDictionaryCode(dictionaryCode, MultilingualUtil.getLanguage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@
|
||||||
<select id="getName" resultType="java.lang.String">
|
<select id="getName" resultType="java.lang.String">
|
||||||
SELECT di.`name`
|
SELECT di.`name`
|
||||||
FROM dictionary d
|
FROM dictionary d
|
||||||
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
||||||
WHERE d.`code`=#{dictionaryCode} AND di.`code`=#{itemCode}
|
WHERE d.`code`=#{dictionaryCode} AND di.`code`=#{itemCode}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getListByDictionaryCode" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
<select id="getListByDictionaryCode" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
||||||
SELECT fun_isBlank(dit.value,di.`name`) as 'name',di.*
|
SELECT fun_isBlank(dit.value,di.`name`) as 'value',di.*
|
||||||
FROM dictionary d
|
FROM dictionary d
|
||||||
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
||||||
LEFT JOIN dictionary_item_translate dit ON dit.dictionary_item_id=di.id and dit.language_code=#{language}
|
LEFT JOIN dictionary_item_translate dit ON dit.dictionary_item_id=di.id and dit.language_code=#{language}
|
||||||
WHERE d.`code`=#{code}
|
WHERE d.`code`=#{code}
|
||||||
ORDER BY di.id
|
ORDER BY di.id
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<select id="getByCode" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
<select id="getByCode" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
||||||
SELECT di.*
|
SELECT di.*
|
||||||
FROM dictionary d
|
FROM dictionary d
|
||||||
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
|
||||||
WHERE d.`code`= #{dictionaryCode} AND di.`code`= #{dictionaryItemCode}
|
WHERE d.`code`= #{dictionaryCode} AND di.`code`= #{dictionaryItemCode}
|
||||||
</select>
|
</select>
|
||||||
<select id="getListByDictionaryCodeAndType" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
<select id="getListByDictionaryCodeAndType" resultType="com.nflg.mobilebroken.repository.entity.DictionaryItem">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue