Merge branch 'dev' into paris
This commit is contained in:
@ -2,6 +2,7 @@ package com.ho.user.controller;
|
||||
|
||||
import com.ho.common.tools.annotation.LogAnnotation;
|
||||
import com.ho.common.tools.constant.ContextConstant;
|
||||
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||
import com.ho.common.tools.entity.PageVO;
|
||||
import com.ho.common.tools.exception.BaseResponseCode;
|
||||
import com.ho.common.tools.exception.BusinessException;
|
||||
@ -16,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@ -47,10 +49,12 @@ public class DictController {
|
||||
@PostMapping("typeList")
|
||||
@ApiOperation(value = "查询字典列表接口(根据类型)")
|
||||
// @LogAnnotation(title = "字典管理",action = "根据类型查询字典")
|
||||
public DataResult<DictRespVo> dictList(@RequestBody @Valid DictSearchReqVO vo) {
|
||||
public DataResult<DictRespVo> dictList(@RequestBody @Valid DictSearchReqVO vo,HttpServletRequest request) {
|
||||
String lang =request.getHeader(RedisKeyConstant.User.LANG);
|
||||
DataResult<DictRespVo> result = DataResult.success();
|
||||
DictTypeAndLabelReqVO typeAndLabelReqVO = new DictTypeAndLabelReqVO();
|
||||
typeAndLabelReqVO.setType(vo.getType());
|
||||
typeAndLabelReqVO.setLang(lang);
|
||||
result.setData(dictService.selectDict(typeAndLabelReqVO));
|
||||
return result;
|
||||
}
|
||||
@ -75,9 +79,10 @@ public class DictController {
|
||||
|
||||
@PostMapping("typeAll")
|
||||
@ApiOperation(value = "查询所有字典列表接口")
|
||||
public DataResult<List<DictRespVo>> typeList() {
|
||||
public DataResult<List<DictRespVo>> typeList(HttpServletRequest request) {
|
||||
String lang =request.getHeader(RedisKeyConstant.User.LANG);
|
||||
DataResult<List<DictRespVo>> result = DataResult.success();
|
||||
result.setData(dictService.selectDictType());
|
||||
result.setData(dictService.selectDictType(lang));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public interface SysDictMapper {
|
||||
SysSubDict selectBySubId(Integer id);
|
||||
|
||||
|
||||
List<SysSubDict> selectSubDictByType(String type);
|
||||
List<SysSubDict> selectSubDictByType(@Param("type") String type,@Param("lang") String lang);
|
||||
|
||||
List<SysSubDict> selectSubDictByTypeList(@Param("typeList") List<String> typeList);
|
||||
|
||||
|
||||
@ -34,11 +34,11 @@ public interface DictService {
|
||||
|
||||
// void deletedByType(String type);
|
||||
|
||||
List<DictRespVo> selectDictType();
|
||||
List<DictRespVo> selectDictType(String lang);
|
||||
|
||||
SysSubDict selectSubDictByValue(DictAddReqVO vo);
|
||||
|
||||
List<SysSubDict> selectSubDictByType(String type);
|
||||
List<SysSubDict> selectSubDictByType(String type,String lang);
|
||||
|
||||
List<SysSubDict> selectSubDictByTypeList(List<String> typeList);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public class DictServiceImpl implements DictService {
|
||||
}
|
||||
int upDictRet = dictMapper.updateDict(dict);
|
||||
log.info("修改sys_dict记录数:" + upDictRet);
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(sysDict.getType());
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(sysDict.getType(),null);
|
||||
int upSubDictRet = 0;
|
||||
for (SysSubDict sysSubDict : sysSubDicts) {
|
||||
sysSubDict.setType(vo.getType());
|
||||
@ -96,7 +96,7 @@ public class DictServiceImpl implements DictService {
|
||||
|
||||
SysSubDict subDict = new SysSubDict();
|
||||
BeanUtils.copyProperties(vo,subDict);
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(vo.getType());
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(vo.getType(),null);
|
||||
if (sysSubDicts.size() == 0){
|
||||
throw new BusinessException(BaseResponseCode.DICT_DELETED_EXISTS);
|
||||
}
|
||||
@ -150,8 +150,8 @@ public class DictServiceImpl implements DictService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysSubDict> selectSubDictByType(String type) {
|
||||
List<SysSubDict> sysSubDicts = dictMapper.selectSubDictByType(type);
|
||||
public List<SysSubDict> selectSubDictByType(String type,String lang) {
|
||||
List<SysSubDict> sysSubDicts = dictMapper.selectSubDictByType(type,lang);
|
||||
return sysSubDicts;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ public class DictServiceImpl implements DictService {
|
||||
SysDict sysDict = dictMapper.selectByType(vo.getType());
|
||||
DictRespVo dictRespVo = new DictRespVo();
|
||||
BeanUtils.copyProperties(sysDict,dictRespVo);
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(vo.getType());
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(vo.getType(),vo.getLang());
|
||||
dictRespVo.setList(sysSubDicts);
|
||||
return dictRespVo;
|
||||
}
|
||||
@ -190,13 +190,13 @@ public class DictServiceImpl implements DictService {
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public List<DictRespVo> selectDictType() {
|
||||
public List<DictRespVo> selectDictType(String lang) {
|
||||
List<SysDict> sysDicts = dictMapper.selectTypeAll();
|
||||
List<DictRespVo> respVos = new ArrayList<>();
|
||||
for (SysDict sysDict : sysDicts) {
|
||||
DictRespVo vo = new DictRespVo();
|
||||
BeanUtils.copyProperties(sysDict,vo);
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(sysDict.getType());
|
||||
List<SysSubDict> sysSubDicts = selectSubDictByType(sysDict.getType(),lang);
|
||||
vo.setList(sysSubDicts);
|
||||
respVos.add(vo);
|
||||
}
|
||||
|
||||
@ -1115,7 +1115,7 @@ public class UserServiceImpl implements UserService {
|
||||
@Override
|
||||
public Map<String, String> checkSpecialUser() {
|
||||
Map<String,String> userMap = new HashMap<>();
|
||||
List<SysSubDict> sysSubDictList = dictService.selectSubDictByType(CommonConstant.SPECIAL_USER);
|
||||
List<SysSubDict> sysSubDictList = dictService.selectSubDictByType(CommonConstant.SPECIAL_USER,null);
|
||||
for (SysSubDict sysSub:sysSubDictList) {
|
||||
userMap.put(sysSub.getValue(),sysSub.getValue());
|
||||
}
|
||||
@ -1125,7 +1125,7 @@ public class UserServiceImpl implements UserService {
|
||||
@Override
|
||||
public Map<String, String> getSysSubDict(SysSubDictVO vo) {
|
||||
Map<String,String> userMap = new HashMap<>();
|
||||
List<SysSubDict> sysSubDictList = dictService.selectSubDictByType(vo.getType());
|
||||
List<SysSubDict> sysSubDictList = dictService.selectSubDictByType(vo.getType(),null);
|
||||
for (SysSubDict sysSub:sysSubDictList) {
|
||||
if(CommonConstant.ONE.equals(vo.getKeyVal())){
|
||||
userMap.put(sysSub.getLabel(),sysSub.getValue());
|
||||
|
||||
@ -20,4 +20,7 @@ public class DictTypeAndLabelReqVO {
|
||||
@ApiModelProperty(value = "字典value类型")
|
||||
@NotBlank(message = "字典value类型不能为空")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "中英切换")
|
||||
private String lang;
|
||||
}
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
<sql id="Base_Column_DictSubList">
|
||||
id,label, type,`value`, sort, `desc`,create_time, update_time, deleted
|
||||
</sql>
|
||||
<sql id="Base_Column_DictSubList1">
|
||||
id,label_en label, type,`value`, sort, `desc`,create_time, update_time, deleted
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultType="com.ho.user.entity.SysDict">
|
||||
select
|
||||
@ -81,7 +84,14 @@
|
||||
|
||||
<select id="selectSubDictByType" resultType="com.ho.user.api.entity.SysSubDict">
|
||||
select
|
||||
<include refid="Base_Column_DictSubList"/>
|
||||
<choose>
|
||||
<when test="lang != null and lang=='en_US' ">
|
||||
<include refid="Base_Column_DictSubList1"></include>
|
||||
</when>
|
||||
<otherwise>
|
||||
<include refid="Base_Column_DictSubList"></include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
from sys_sub_dict
|
||||
where
|
||||
type = #{type}
|
||||
|
||||
Reference in New Issue
Block a user