Browse Source

代码生成

origin/epidemic_user
Jackwang 4 years ago
parent
commit
68b9d723f4
  1. 94
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/TripReportController.java
  2. 33
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/TripReportDao.java
  3. 146
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/TripReportEntity.java
  4. 119
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/TripReportExcel.java
  5. 47
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/TripReportRedis.java
  6. 95
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/TripReportService.java
  7. 104
      epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/TripReportServiceImpl.java
  8. 38
      epdc-cloud-custom/src/main/resources/mapper/epidemic/TripReportDao.xml

94
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/TripReportController.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.epidemic.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.dto.TripReportDTO;
import com.elink.esua.epdc.modules.epidemic.excel.TripReportExcel;
import com.elink.esua.epdc.modules.epidemic.service.TripReportService;
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 2021-10-13
*/
@RestController
@RequestMapping("tripreport")
public class TripReportController {
@Autowired
private TripReportService tripReportService;
@GetMapping("page")
public Result<PageData<TripReportDTO>> page(@RequestParam Map<String, Object> params){
PageData<TripReportDTO> page = tripReportService.page(params);
return new Result<PageData<TripReportDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<TripReportDTO> get(@PathVariable("id") String id){
TripReportDTO data = tripReportService.get(id);
return new Result<TripReportDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody TripReportDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tripReportService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody TripReportDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tripReportService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tripReportService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TripReportDTO> list = tripReportService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, TripReportExcel.class);
}
}

33
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/TripReportDao.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.epidemic.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 行程上报信息
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-10-13
*/
@Mapper
public interface TripReportDao extends BaseDao<TripReportEntity> {
}

146
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/TripReportEntity.java

@ -0,0 +1,146 @@
/**
* 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.epidemic.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 行程上报信息
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-10-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_trip_report")
public class TripReportEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 身份证
*/
private String idCard;
/**
* 现居住地编码
*/
private String nowAddressCode;
/**
* 现居住地名称
*/
private String nowAddressName;
/**
* 现居住详细地址
*/
private String nowAddressDaetail;
/**
* 来自地区编码
*/
private String comeAddressCode;
/**
* 来自地区名称
*/
private String comeAddressName;
/**
* 来到(本地)时间
*/
private Date comeDate;
/**
* 返回时间
*/
private Date backDate;
/**
* 备注
*/
private String note;
/**
* 用户id
*/
private String userId;
/**
* 手机号
*/
private String userMobile;
/**
* 真实姓名
*/
private String realName;
/**
* 头像
*/
private String faceImg;
/**
* 部门ID
*/
private String deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
/**
* 父所有部门
*/
private String parentDeptIds;
/**
* 父所有部门
*/
private String parentDeptNames;
}

119
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/TripReportExcel.java

@ -0,0 +1,119 @@
/**
* 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.epidemic.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 2021-10-13
*/
@Data
public class TripReportExcel {
@Excel(name = "ID")
private String id;
@Excel(name = "姓名")
private String name;
@Excel(name = "手机号")
private String mobile;
@Excel(name = "身份证")
private String idCard;
@Excel(name = "现居住地编码")
private String nowAddressCode;
@Excel(name = "现居住地名称")
private String nowAddressName;
@Excel(name = "现居住详细地址")
private String nowAddressDaetail;
@Excel(name = "来自地区编码")
private String comeAddressCode;
@Excel(name = "来自地区名称")
private String comeAddressName;
@Excel(name = "来到(本地)时间")
private Date comeDate;
@Excel(name = "返回时间")
private Date backDate;
@Excel(name = "备注")
private String note;
@Excel(name = "用户id")
private String userId;
@Excel(name = "手机号")
private String userMobile;
@Excel(name = "真实姓名")
private String realName;
@Excel(name = "头像")
private String faceImg;
@Excel(name = "部门ID")
private String deptId;
@Excel(name = "部门名称")
private String deptName;
@Excel(name = "所有部门ID")
private String allDeptIds;
@Excel(name = "所有部门名称")
private String allDeptNames;
@Excel(name = "父所有部门")
private String parentDeptIds;
@Excel(name = "父所有部门")
private String parentDeptNames;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "逻辑删除标识")
private String delFlag;
}

47
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/TripReportRedis.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.epidemic.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 2021-10-13
*/
@Component
public class TripReportRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/TripReportService.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.epidemic.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.TripReportDTO;
import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity;
import java.util.List;
import java.util.Map;
/**
* 行程上报信息
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-10-13
*/
public interface TripReportService extends BaseService<TripReportEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<TripReportDTO>
* @author generator
* @date 2021-10-13
*/
PageData<TripReportDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<TripReportDTO>
* @author generator
* @date 2021-10-13
*/
List<TripReportDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return TripReportDTO
* @author generator
* @date 2021-10-13
*/
TripReportDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-10-13
*/
void save(TripReportDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-10-13
*/
void update(TripReportDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-10-13
*/
void delete(String[] ids);
}

104
epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/TripReportServiceImpl.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.epidemic.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.dto.TripReportDTO;
import com.elink.esua.epdc.modules.epidemic.dao.TripReportDao;
import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity;
import com.elink.esua.epdc.modules.epidemic.redis.TripReportRedis;
import com.elink.esua.epdc.modules.epidemic.service.TripReportService;
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 2021-10-13
*/
@Service
public class TripReportServiceImpl extends BaseServiceImpl<TripReportDao, TripReportEntity> implements TripReportService {
@Autowired
private TripReportRedis tripReportRedis;
@Override
public PageData<TripReportDTO> page(Map<String, Object> params) {
IPage<TripReportEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, TripReportDTO.class);
}
@Override
public List<TripReportDTO> list(Map<String, Object> params) {
List<TripReportEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, TripReportDTO.class);
}
private QueryWrapper<TripReportEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<TripReportEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public TripReportDTO get(String id) {
TripReportEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, TripReportDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(TripReportDTO dto) {
TripReportEntity entity = ConvertUtils.sourceToTarget(dto, TripReportEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TripReportDTO dto) {
TripReportEntity entity = ConvertUtils.sourceToTarget(dto, TripReportEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

38
epdc-cloud-custom/src/main/resources/mapper/epidemic/TripReportDao.xml

@ -0,0 +1,38 @@
<?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.epidemic.dao.TripReportDao">
<resultMap type="com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity" id="tripReportMap">
<result property="id" column="ID"/>
<result property="name" column="NAME"/>
<result property="mobile" column="MOBILE"/>
<result property="idCard" column="ID_CARD"/>
<result property="nowAddressCode" column="NOW_ADDRESS_CODE"/>
<result property="nowAddressName" column="NOW_ADDRESS_NAME"/>
<result property="nowAddressDaetail" column="NOW_ADDRESS_DAETAIL"/>
<result property="comeAddressCode" column="COME_ADDRESS_CODE"/>
<result property="comeAddressName" column="COME_ADDRESS_NAME"/>
<result property="comeDate" column="COME_DATE"/>
<result property="backDate" column="BACK_DATE"/>
<result property="note" column="NOTE"/>
<result property="userId" column="USER_ID"/>
<result property="userMobile" column="USER_MOBILE"/>
<result property="realName" column="REAL_NAME"/>
<result property="faceImg" column="FACE_IMG"/>
<result property="deptId" column="DEPT_ID"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="allDeptIds" column="ALL_DEPT_IDS"/>
<result property="allDeptNames" column="ALL_DEPT_NAMES"/>
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/>
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
</mapper>
Loading…
Cancel
Save