关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、3102411850 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 14633|回复: 11

@Dict翻译使用问题,谢谢

[复制链接]
发表于 2019-6-10 16:01:42 | 显示全部楼层 |阅读模式
微信图片_20190610155847.png
字典翻译问题,红圈在代码的那里添加,我现在没有添加红圈部分的代码
但是前端没翻译过来,谢谢
发表于 2019-6-10 16:30:19 | 显示全部楼层
实体的字段上加注解

TIM图片20190610163139.png
 楼主| 发表于 2019-6-10 19:28:38 | 显示全部楼层
无标题.png
我按说明都写了,但是前端不显示,是不是缺什么配置?谢谢

发表于 2019-6-10 22:00:07 | 显示全部楼层
详细贴代码
 楼主| 发表于 2019-6-10 22:42:27 | 显示全部楼层
@Data
@TableName("edu_user")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="edu_user对象", description="学员管理")
public class EduUser {
   
   /**职员id*/
   @TableId(type = IdType.UUID)
    @ApiModelProperty(value = "职员id")
   private java.lang.String id;
   /**工资号*/
   @Excel(name = "工资号", width = 15)
    @ApiModelProperty(value = "工资号")
   private java.lang.String userName;
   /**密码*/
   @Excel(name = "密码", width = 15)
    @ApiModelProperty(value = "密码")
   private java.lang.String password;
   /**姓名*/
   @Excel(name = "姓名", width = 15)
    @ApiModelProperty(value = "姓名")
   private java.lang.String showName;
   /**拼音码*/
   @Excel(name = "拼音码", width = 15)
    @ApiModelProperty(value = "拼音码")
   private java.lang.String realname;
   /**民族*/
   @Excel(name = "民族", width = 15)
    @ApiModelProperty(value = "民族")
   private java.lang.String nation;
   /**出生年月*/
   @Excel(name = "出生年月", width = 20, format = "yyyy-MM-dd HH:mm:ss")
   @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "出生年月")
   private java.util.Date birthday;
   /**籍贯*/
   @Excel(name = "籍贯", width = 15)
    @ApiModelProperty(value = "籍贯")
   private java.lang.String nativePlace;
   /**手机号*/
   @Excel(name = "手机号", width = 15)
    @ApiModelProperty(value = "手机号")
   private java.lang.String mobile;
   /**参加工作时间*/
   @Excel(name = "参加工作时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
   @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "参加工作时间")
   private java.util.Date workDate;
   /**任职时间*/
   @Excel(name = "任职时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
   @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "任职时间")
   private java.util.Date positionTime;
   /**政治面貌*/
   @Excel(name = "政治面貌", width = 15)
    @ApiModelProperty(value = "政治面貌")
   private java.lang.String political;
   /**文化程度*/
   @Excel(name = "文化程度", width = 15)
    @ApiModelProperty(value = "文化程度")
   private java.lang.String education;
   /**年龄*/
   @Excel(name = "年龄", width = 15)
    @ApiModelProperty(value = "年龄")
   private java.lang.Integer age;
   /**性别  1男  2*/
   @Excel(name = "性别", width = 15,dicCode="sex")
   @Dict(dicCode = "sex")
    @ApiModelProperty(value = "性别  1  2")
   private java.lang.Integer sex;  
   /**身份证号*/
   @Excel(name = "身份证号", width = 15)
    @ApiModelProperty(value = "身份证号")
   private java.lang.String idcardno;
   /***/
   @Excel(name = "", width = 15)
    @ApiModelProperty(value = "")
   private java.lang.Integer province;
   /***/
   @Excel(name = "", width = 15)
    @ApiModelProperty(value = "")
   private java.lang.Integer city;
   /***/
   @Excel(name = "", width = 15)
    @ApiModelProperty(value = "")
   private java.lang.Integer area;
   /**学校*/
   @Excel(name = "学校", width = 15)
    @ApiModelProperty(value = "学校")
   private java.lang.String school;
   /**专业*/
   @Excel(name = "专业", width = 15)
    @ApiModelProperty(value = "专业")
   private java.lang.String subject;
   /**工作证号*/
   @Excel(name = "工作证号", width = 15)
    @ApiModelProperty(value = "工作证号")
   private java.lang.String idWork;
   /**婚姻状况*/
   @Excel(name = "婚姻状况", width = 15)
    @ApiModelProperty(value = "婚姻状况")
   private java.lang.String marital;
   /**毕业学校*/
   @Excel(name = "毕业学校", width = 15)
    @ApiModelProperty(value = "毕业学校")
   private java.lang.String graduate;
   /**所学专业*/
   @Excel(name = "所学专业", width = 15)
    @ApiModelProperty(value = "所学专业")
   private java.lang.String major;
   /**工作地点*/
   @Excel(name = "工作地点", width = 15)
    @ApiModelProperty(value = "工作地点")
   private java.lang.String workAddress;
   /**职务级别*/
   @Excel(name = "职务级别", width = 15)
    @ApiModelProperty(value = "职务级别")
   private java.lang.String jobLevel;
  
   /**创建人id*/
   @Excel(name = "创建人id", width = 15)
    @ApiModelProperty(value = "创建人id")
   private java.lang.String createBy;
   /**创建时间*/
   @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
   @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
   private java.util.Date createTime;
   /**修改时间*/
   @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
   @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "修改时间")
   private java.util.Date updateTime;
   /**修改人id*/
   @Excel(name = "修改人id", width = 15)
    @ApiModelProperty(value = "修改人id")
   private java.lang.String updateBy;
}

 楼主| 发表于 2019-6-10 22:44:42 | 显示全部楼层
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">

          <a-col :md="6" :sm="8">
            <a-form-item label="工资号">
              <a-input placeholder="请输入工资号" v-model="queryParam.userName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="密码">
              <a-input placeholder="请输入密码" v-model="queryParam.password"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :md="6" :sm="8">
              <a-form-item label="姓名">
                <a-input placeholder="请输入姓名" v-model="queryParam.showName"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="拼音码">
                <a-input placeholder="请输入拼音码" v-model="queryParam.realname"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="民族">
                <a-input placeholder="请输入民族" v-model="queryParam.nation"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
               
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('学员管理')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
                @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}
</a>
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <eduUser-modal ref="modalForm" @ok="modalFormOk"></eduUser-modal>
  </a-card>
</template>

<script>
  import EduUserModal from './modules/EduUserModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'


  export default {
    name:
'EduUserList',
    mixins: [JeecgListMixin],
    components: {
      EduUserModal
    }
,
    created (){
    }
,
    data() {
      
return {
        description:
'学员管理管理页面',
        railSectionOptions:[],
        // 表头
        columns: [
          {
            title:
'#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              
return parseInt(index) + 1
            }
          }
,
          {
            title:
'工资号',
            align: 'center',
            dataIndex: 'userName'
          },
          {
            title: '姓名',
            align: 'center',
            dataIndex: 'showName'
          },
          {
            title: '性别',
            align: 'center',
            dataIndex: 'sex'
          },
          {
            title:
'操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' ,
        url: {
          list:
'/admin/user/list',
          delete: '/admin/user/delete',
          deleteBatch: '/admin/user/deleteBatch',
          exportXlsUrl: 'admin/user/exportXls',
          importExcelUrl: 'admin/user/importExcel'
        }
      }
    }
,
    computed: {
      importExcelUrl:
function() {
        
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    }
,
    methods: {

    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
发表于 2019-6-11 09:48:00 | 显示全部楼层
control
 楼主| 发表于 2019-6-11 19:21:16 | 显示全部楼层
/**
* @Description: 学员管理
* @Author: jeecg-boot
* @Date:   2019-06-07
* @Version: V1.0
*/
@Slf4j
@Api(tags="学员管理")
@RestController
@RequestMapping("/admin/user")
public class EduUserController {
@Autowired
   private IEduUserService eduUserService;
   
   /**
     * 分页列表查询
* @param eduUser
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "学员管理-分页列表查询")
@ApiOperation(value="学员管理-分页列表查询", notes="学员管理-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<EduUser>> queryPageList(EduUser eduUser,
                             @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                             @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                             HttpServletRequest req) {
Result<IPage<EduUser>> result = new Result<IPage<EduUser>>();
      QueryWrapper<EduUser> queryWrapper = QueryGenerator.initQueryWrapper(eduUser, req.getParameterMap());
      Page<EduUser> page = new Page<EduUser>(pageNo, pageSize);
      IPage<EduUser> pageList = eduUserService.page(page, queryWrapper);
      result.setSuccess(true);
      result.setResult(pageList);
      return result;
   }
/**
     *   添加
* @param eduUser
* @return
*/
@AutoLog(value = "学员管理-添加")
@ApiOperation(value="学员管理-添加", notes="学员管理-添加")
@PostMapping(value = "/add")
public Result<EduUser> add(@RequestBody EduUser eduUser) {
Result<EduUser> result = new Result<EduUser>();
      try {
eduUserService.save(eduUser);
         result.success("添加成功!");
      } catch (Exception e) {
         log.error(e.getMessage(),e);
         result.error500("操作失败");
      }
return result;
   }
/**
     *  编辑
* @param eduUser
* @return
*/
@AutoLog(value = "学员管理-编辑")
@ApiOperation(value="学员管理-编辑", notes="学员管理-编辑")
@PutMapping(value = "/edit")
public Result<EduUser> edit(@RequestBody EduUser eduUser) {
Result<EduUser> result = new Result<EduUser>();
      EduUser eduUserEntity = eduUserService.getById(eduUser.getId());
      if(eduUserEntity==null) {
result.error500("未找到对应实体");
      }else {
boolean ok = eduUserService.updateById(eduUser);
         //TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
         }
      }
return result;
   }
/**
     *   通过id删除
* @param id
* @return
*/
@AutoLog(value = "学员管理-通过id删除")
@ApiOperation(value="学员管理-通过id删除", notes="学员管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<EduUser> delete(@RequestParam(name="id",required=true) String id) {
Result<EduUser> result = new Result<EduUser>();
      EduUser eduUser = eduUserService.getById(id);
      if(eduUser==null) {
result.error500("未找到对应实体");
      }else {
boolean ok = eduUserService.removeById(id);
         if(ok) {
result.success("删除成功!");
         }
      }
return result;
   }
/**
     *  批量删除
* @param ids
* @return
*/
@AutoLog(value = "学员管理-批量删除")
@ApiOperation(value="学员管理-批量删除", notes="学员管理-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<EduUser> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<EduUser> result = new Result<EduUser>();
      if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
      }else {
this.eduUserService.removeByIds(Arrays.asList(ids.split(",")));
         result.success("删除成功!");
      }
return result;
   }
/**
     * 通过id查询
* @param id
* @return
*/
@AutoLog(value = "学员管理-通过id查询")
@ApiOperation(value="学员管理-通过id查询", notes="学员管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<EduUser> queryById(@RequestParam(name="id",required=true) String id) {
Result<EduUser> result = new Result<EduUser>();
      EduUser eduUser = eduUserService.getById(id);
      if(eduUser==null) {
result.error500("未找到对应实体");
      }else {
result.setResult(eduUser);
         result.setSuccess(true);
      }
return result;
   }
/**
      * 导出excel
   *
   * @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
      QueryWrapper<EduUser> queryWrapper = null;
      try {
String paramsStr = request.getParameter("paramsStr");
          if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
              EduUser eduUser = JSON.parseObject(deString, EduUser.class);
              queryWrapper = QueryGenerator.initQueryWrapper(eduUser, request.getParameterMap());
          }
      } catch (UnsupportedEncodingException e) {
e.printStackTrace();
      }
//Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      List<EduUser> pageList = eduUserService.list(queryWrapper);
      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "学员管理列表");
      mv.addObject(NormalExcelConstants.CLASS, EduUser.class);
      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("学员管理列表数据", "导出人:Jeecg", "导出信息"));
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
/**
      * 通过excel导入数据
*
   * @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
          ImportParams params = new ImportParams();
          params.setTitleRows(2);
          params.setHeadRows(1);
          params.setNeedSave(true);
          try {
List<EduUser> listEduUsers = ExcelImportUtil.importExcel(file.getInputStream(), EduUser.class, params);
              for (EduUser eduUserExcel : listEduUsers) {
eduUserService.save(eduUserExcel);
              }
return Result.ok("文件导入成功!数据行数:" + listEduUsers.size());
          } catch (Exception e) {
              log.error(e.getMessage(),e);
              return Result.error("文件导入失败:"+e.getMessage());
          } finally {
try {
file.getInputStream().close();
              } catch (IOException e) {
e.printStackTrace();
              }
          }
      }
return Result.ok("文件导入失败!");
  }
}

发表于 2019-6-12 14:06:25 | 显示全部楼层
src/main/java/org/jeecg/modules/system/aspect/DictAspect.java
 楼主| 发表于 2019-6-12 16:04:07 | 显示全部楼层
谢谢,我找到问题了,我的模块包名不是org.jeecg的,需要在@Pointcut增加包名,再次感谢,继续学习中
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表