瀏覽代碼

枚举支持多语言

xie.kaifeng 7 月之前
父節點
當前提交
efaa27eb57

+ 1 - 1
mtp3-century/src/main/java/com/muchinfo/mtp3century/service/impl/CommonServiceImpl.java

@@ -187,7 +187,7 @@ public class CommonServiceImpl implements ICommonService {
 
     @Override
     public AjaxResult getEnumType(String typeCode, HttpServletRequest request) {
-        List<Enumdicitem> enumdicitems = iEnumdicitemMapper.selectList(new QueryWrapper<Enumdicitem>().eq("ENUMDICCODE", typeCode));
+        List<Enumdicitem> enumdicitems = iEnumdicitemMapper.selectInternational(typeCode);
         return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), enumdicitems);
     }
 

+ 8 - 0
mtp3-century/src/main/resources/mapper/EnumdicitemMapper.xml

@@ -31,5 +31,13 @@
             and e.enumitemname = #{emvalue}
         </where>
     </select>
+    <select id="selectInternational" resultType="com.muchinfo.mtp3pojos.entity.Enumdicitem"
+            parameterType="java.lang.String">
+        select e.*,ex.ENUMDICNAMEEN enumdicnameen,
+               ex.ENUMDICNAMEZH_TW enumdicnamezhtw,ex.ENUMDICNAMETH enumdicnameth,
+               ex.ENUMDICNAMEVI enumdicnamevi
+        from ENUMDICITEM e left join enumdicitemex ex on e.ENUMDICCODE = ex.ENUMDICCODE
+        where e.ENUMDICCODE = #{typeCode}
+    </select>
 
 </mapper>

+ 4 - 0
mtp3-interface/src/main/java/com/muchinfo/mtp3interface/mapper/IEnumdicitemMapper.java

@@ -5,6 +5,8 @@ import com.muchinfo.mtp3pojos.entity.Enumdicitem;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  * 枚举项字典表 Mapper 接口
@@ -17,4 +19,6 @@ import org.apache.ibatis.annotations.Param;
 public interface IEnumdicitemMapper extends BaseMapper<Enumdicitem> {
 
     String selectCurrencyName(@Param("emvalue") Integer currencyid);
+
+    List<Enumdicitem> selectInternational(@Param("typeCode") String typeCode);
 }

+ 8 - 0
mtp3-pojos/src/main/java/com/muchinfo/mtp3pojos/entity/Enumdicitem.java

@@ -77,6 +77,14 @@ public class Enumdicitem extends Model<Enumdicitem> {
     @TableField("PARAM2")
     private String param2;
 
+    @TableField(select = false)
+    private String enumdicnameen;
+    @TableField(select = false)
+    private String enumdicnamezhtw;
+    @TableField(select = false)
+    private String enumdicnameth;
+    @TableField(select = false)
+    private String enumdicnamevi;
 
     @Override
     public Serializable pkVal() {