Browse Source

党员排行 代码生成

feature/dangjian
曲树通 5 years ago
parent
commit
2e3e2b2716
  1. 127
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java
  2. 94
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java
  3. 32
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java
  4. 97
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java
  5. 90
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java
  6. 95
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java
  7. 101
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java
  8. 28
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml

127
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java

@ -0,0 +1,127 @@
/**
* 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.dto.user;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserPartyRankDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 已注册党员数量已认证
*/
private Integer partyMemberCount;
/**
* 年龄超过50岁党员数量
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 年龄50岁以下的党员数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
/**
* 党员认证失败数
*/
private Integer partyAuthFailureCount;
/**
* 删除标记
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 注册时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

94
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.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.user.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.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.modules.user.excel.MetaUserPartyRankExcel;
import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService;
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 elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@RestController
@RequestMapping("metauserpartyrank")
public class MetaUserPartyRankController {
@Autowired
private MetaUserPartyRankService metaUserPartyRankService;
@GetMapping("page")
public Result<PageData<MetaUserPartyRankDTO>> page(@RequestParam Map<String, Object> params){
PageData<MetaUserPartyRankDTO> page = metaUserPartyRankService.page(params);
return new Result<PageData<MetaUserPartyRankDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<MetaUserPartyRankDTO> get(@PathVariable("id") String id){
MetaUserPartyRankDTO data = metaUserPartyRankService.get(id);
return new Result<MetaUserPartyRankDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody MetaUserPartyRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
metaUserPartyRankService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody MetaUserPartyRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
metaUserPartyRankService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
metaUserPartyRankService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<MetaUserPartyRankDTO> list = metaUserPartyRankService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, MetaUserPartyRankExcel.class);
}
}

32
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java

@ -0,0 +1,32 @@
/**
* 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.user.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Mapper
public interface MetaUserPartyRankDao extends BaseDao<MetaUserPartyRankEntity> {
}

97
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java

@ -0,0 +1,97 @@
/**
* 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.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("meta_epdc_user_party_rank")
public class MetaUserPartyRankEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 已注册党员数量已认证
*/
private Integer partyMemberCount;
/**
* 年龄超过50岁党员数量
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 年龄50岁以下的党员数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
/**
* 党员认证失败数
*/
private Integer partyAuthFailureCount;
}

90
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java

@ -0,0 +1,90 @@
/**
* 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.user.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserPartyRankExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "街道id")
private String streetId;
@Excel(name = "街道名称")
private String streetName;
@Excel(name = "已注册党员数量(已认证)")
private Integer partyMemberCount;
@Excel(name = "年龄超过50岁党员数量")
private Integer oldCount;
@Excel(name = "老龄化比例")
private BigDecimal oldPercent;
@Excel(name = "年龄50岁以下的党员数量")
private Integer youngCount;
@Excel(name = "年轻化比例")
private BigDecimal youngPercent;
@Excel(name = "男")
private Integer maleCount;
@Excel(name = "女")
private Integer femaleCount;
@Excel(name = "未知性别")
private Integer unknownSexCount;
@Excel(name = "党员认证失败数")
private Integer partyAuthFailureCount;
@Excel(name = "删除标记")
private String delFlag;
@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;
}

95
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.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.user.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.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import java.util.List;
import java.util.Map;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
public interface MetaUserPartyRankService extends BaseService<MetaUserPartyRankEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<MetaUserPartyRankDTO>
* @author generator
* @date 2020-03-26
*/
PageData<MetaUserPartyRankDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<MetaUserPartyRankDTO>
* @author generator
* @date 2020-03-26
*/
List<MetaUserPartyRankDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return MetaUserPartyRankDTO
* @author generator
* @date 2020-03-26
*/
MetaUserPartyRankDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void save(MetaUserPartyRankDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void update(MetaUserPartyRankDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-26
*/
void delete(String[] ids);
}

101
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java

@ -0,0 +1,101 @@
/**
* 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.user.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.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dto.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.modules.user.dao.MetaUserPartyRankDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService;
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 elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Service
public class MetaUserPartyRankServiceImpl extends BaseServiceImpl<MetaUserPartyRankDao, MetaUserPartyRankEntity> implements MetaUserPartyRankService {
@Override
public PageData<MetaUserPartyRankDTO> page(Map<String, Object> params) {
IPage<MetaUserPartyRankEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, MetaUserPartyRankDTO.class);
}
@Override
public List<MetaUserPartyRankDTO> list(Map<String, Object> params) {
List<MetaUserPartyRankEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, MetaUserPartyRankDTO.class);
}
private QueryWrapper<MetaUserPartyRankEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<MetaUserPartyRankEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public MetaUserPartyRankDTO get(String id) {
MetaUserPartyRankEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, MetaUserPartyRankDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(MetaUserPartyRankDTO dto) {
MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MetaUserPartyRankDTO dto) {
MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

28
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml

@ -0,0 +1,28 @@
<?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.user.dao.MetaUserPartyRankDao">
<resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity" id="metaUserPartyRankMap">
<result property="id" column="ID"/>
<result property="streetId" column="STREET_ID"/>
<result property="streetName" column="STREET_NAME"/>
<result property="partyMemberCount" column="PARTY_MEMBER_COUNT"/>
<result property="oldCount" column="OLD_COUNT"/>
<result property="oldPercent" column="OLD_PERCENT"/>
<result property="youngCount" column="YOUNG_COUNT"/>
<result property="youngPercent" column="YOUNG_PERCENT"/>
<result property="maleCount" column="MALE_COUNT"/>
<result property="femaleCount" column="FEMALE_COUNT"/>
<result property="unknownSexCount" column="UNKNOWN_SEX_COUNT"/>
<result property="partyAuthFailureCount" column="PARTY_AUTH_FAILURE_COUNT"/>
<result property="delFlag" column="DEL_FLAG"/>
<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"/>
</resultMap>
</mapper>
Loading…
Cancel
Save