Browse Source

代码生成

feature/dangjian
wanggongfeng 6 years ago
parent
commit
e70cffcfcb
  1. 107
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/officer/EvaluateOfficerDTO.java
  2. 94
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/controller/EvaluateOfficerController.java
  3. 33
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/dao/EvaluateOfficerDao.java
  4. 73
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/entity/EvaluateOfficerEntity.java
  5. 77
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/excel/EvaluateOfficerExcel.java
  6. 47
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/redis/EvaluateOfficerRedis.java
  7. 95
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/service/EvaluateOfficerService.java
  8. 104
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/service/impl/EvaluateOfficerServiceImpl.java
  9. 24
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/evaluate/EvaluateOfficerDao.xml

107
esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/officer/EvaluateOfficerDTO.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.officer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Data
public class EvaluateOfficerDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 部门ID 部门表主键ID
*/
private String deptId;
/**
* 姓名
*/
private String fullName;
/**
* 性别(0-1-)
*/
private String sex;
/**
* 职位
*/
private String position;
/**
* 点赞次数
*/
private Integer likesCount;
/**
* 被踩次数
*/
private Integer opposeCount;
/**
* 排序
*/
private Integer sort;
/**
* 乐观锁
*/
private Integer revision;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

94
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/controller/EvaluateOfficerController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.modules.evaluate.excel.EvaluateOfficerExcel;
import com.elink.esua.epdc.modules.evaluate.service.EvaluateOfficerService;
import com.elink.esua.epdc.officer.EvaluateOfficerDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@RestController
@RequestMapping("evaluateofficer")
public class EvaluateOfficerController {
@Autowired
private EvaluateOfficerService evaluateOfficerService;
@GetMapping("page")
public Result<PageData<EvaluateOfficerDTO>> page(@RequestParam Map<String, Object> params){
PageData<EvaluateOfficerDTO> page = evaluateOfficerService.page(params);
return new Result<PageData<EvaluateOfficerDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<EvaluateOfficerDTO> get(@PathVariable("id") String id){
EvaluateOfficerDTO data = evaluateOfficerService.get(id);
return new Result<EvaluateOfficerDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody EvaluateOfficerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
evaluateOfficerService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody EvaluateOfficerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
evaluateOfficerService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
evaluateOfficerService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<EvaluateOfficerDTO> list = evaluateOfficerService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, EvaluateOfficerExcel.class);
}
}

33
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/dao/EvaluateOfficerDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.evaluate.entity.EvaluateOfficerEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Mapper
public interface EvaluateOfficerDao extends BaseDao<EvaluateOfficerEntity> {
}

73
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/entity/EvaluateOfficerEntity.java

@ -0,0 +1,73 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_evaluate_officer")
public class EvaluateOfficerEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 部门ID 部门表主键ID
*/
private String deptId;
/**
* 姓名
*/
private String fullName;
/**
* 性别(0-1-)
*/
private String sex;
/**
* 职位
*/
private String position;
/**
* 点赞次数
*/
private Integer likesCount;
/**
* 被踩次数
*/
private Integer opposeCount;
/**
* 排序
*/
private Integer sort;
}

77
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/excel/EvaluateOfficerExcel.java

@ -0,0 +1,77 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Data
public class EvaluateOfficerExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "部门ID 部门表主键ID")
private String deptId;
@Excel(name = "姓名")
private String fullName;
@Excel(name = "性别(0-女,1-男)")
private String sex;
@Excel(name = "职位")
private String position;
@Excel(name = "点赞次数")
private Integer likesCount;
@Excel(name = "被踩次数")
private Integer opposeCount;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "删除标识 0:否,1:是")
private String delFlag;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/redis/EvaluateOfficerRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Component
public class EvaluateOfficerRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/service/EvaluateOfficerService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.modules.evaluate.entity.EvaluateOfficerEntity;
import com.elink.esua.epdc.officer.EvaluateOfficerDTO;
import java.util.List;
import java.util.Map;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
public interface EvaluateOfficerService extends BaseService<EvaluateOfficerEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<EvaluateOfficerDTO>
* @author generator
* @date 2020-02-05
*/
PageData<EvaluateOfficerDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<EvaluateOfficerDTO>
* @author generator
* @date 2020-02-05
*/
List<EvaluateOfficerDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return EvaluateOfficerDTO
* @author generator
* @date 2020-02-05
*/
EvaluateOfficerDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-02-05
*/
void save(EvaluateOfficerDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-02-05
*/
void update(EvaluateOfficerDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-02-05
*/
void delete(String[] ids);
}

104
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/evaluate/service/impl/EvaluateOfficerServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.evaluate.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.modules.evaluate.dao.EvaluateOfficerDao;
import com.elink.esua.epdc.modules.evaluate.entity.EvaluateOfficerEntity;
import com.elink.esua.epdc.modules.evaluate.redis.EvaluateOfficerRedis;
import com.elink.esua.epdc.modules.evaluate.service.EvaluateOfficerService;
import com.elink.esua.epdc.officer.EvaluateOfficerDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 干部信息表 干部信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-02-05
*/
@Service
public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerDao, EvaluateOfficerEntity> implements EvaluateOfficerService {
@Autowired
private EvaluateOfficerRedis evaluateOfficerRedis;
@Override
public PageData<EvaluateOfficerDTO> page(Map<String, Object> params) {
IPage<EvaluateOfficerEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, EvaluateOfficerDTO.class);
}
@Override
public List<EvaluateOfficerDTO> list(Map<String, Object> params) {
List<EvaluateOfficerEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, EvaluateOfficerDTO.class);
}
private QueryWrapper<EvaluateOfficerEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<EvaluateOfficerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public EvaluateOfficerDTO get(String id) {
EvaluateOfficerEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, EvaluateOfficerDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(EvaluateOfficerDTO dto) {
EvaluateOfficerEntity entity = ConvertUtils.sourceToTarget(dto, EvaluateOfficerEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EvaluateOfficerDTO dto) {
EvaluateOfficerEntity entity = ConvertUtils.sourceToTarget(dto, EvaluateOfficerEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

24
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/evaluate/EvaluateOfficerDao.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.evaluate.dao.EvaluateOfficerDao">
<resultMap type="com.elink.esua.epdc.modules.evaluate.entity.EvaluateOfficerEntity" id="evaluateOfficerMap">
<result property="id" column="ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="fullName" column="FULL_NAME"/>
<result property="sex" column="SEX"/>
<result property="position" column="POSITION"/>
<result property="likesCount" column="LIKES_COUNT"/>
<result property="opposeCount" column="OPPOSE_COUNT"/>
<result property="sort" column="SORT"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save