9 changed files with 523 additions and 0 deletions
@ -0,0 +1,95 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PovertyManageDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 居民ID |
||||
|
*/ |
||||
|
private String resiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号码 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 贫困属性 |
||||
|
*/ |
||||
|
private Integer povertyType; |
||||
|
|
||||
|
/** |
||||
|
* 脱贫状态 |
||||
|
*/ |
||||
|
private Integer povertyStatus; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.epmet.dto.form.povertyManage; |
||||
|
|
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 贫困户信息 |
||||
|
* @create 2023/6/17 14:16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PovertyManageFormDto extends PageFormDTO implements Serializable { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = 7615276155933857672L; |
||||
|
|
||||
|
private String id; |
||||
|
|
||||
|
private String resiUserId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String mobile; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private String agencyId; |
||||
|
|
||||
|
private String gridId; |
||||
|
|
||||
|
private String povertyStatus; |
||||
|
|
||||
|
private String povertyType; |
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.PovertyManageDTO; |
||||
|
import com.epmet.dto.form.povertyManage.PovertyManageFormDto; |
||||
|
import com.epmet.service.PovertyManageService; |
||||
|
import com.github.pagehelper.Page; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("povertyManage") |
||||
|
public class PovertyManageController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PovertyManageService povertyManageService; |
||||
|
|
||||
|
@PostMapping("page") |
||||
|
public Result<PageData<PovertyManageDTO>> selectList(@RequestBody PovertyManageFormDto formDTO) { |
||||
|
Page<PovertyManageDTO> page = povertyManageService.selectPage(formDTO); |
||||
|
return new Result().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
||||
|
public Result<PovertyManageDTO> get(@PathVariable("id") String id) { |
||||
|
PovertyManageDTO data = povertyManageService.get(id); |
||||
|
return new Result<PovertyManageDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody PovertyManageFormDto dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
povertyManageService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody PovertyManageFormDto dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
povertyManageService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
povertyManageService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.PovertyManageDTO; |
||||
|
import com.epmet.dto.form.povertyManage.PovertyManageFormDto; |
||||
|
import com.epmet.entity.PovertyManageEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface PovertyManageDao extends BaseDao<PovertyManageEntity> { |
||||
|
|
||||
|
List<PovertyManageDTO> selectPage(PovertyManageFormDto formDTO); |
||||
|
|
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("poverty_manage") |
||||
|
public class PovertyManageEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 居民ID |
||||
|
*/ |
||||
|
private String resiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号码 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 贫困属性 |
||||
|
*/ |
||||
|
private Integer povertyType; |
||||
|
|
||||
|
/** |
||||
|
* 脱贫状态 |
||||
|
*/ |
||||
|
private Integer povertyStatus; |
||||
|
|
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PovertyManageExcel { |
||||
|
|
||||
|
@Excel(name = "主键ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "居民ID") |
||||
|
private String resiUserId; |
||||
|
|
||||
|
@Excel(name = "组织ID") |
||||
|
private String agencyId; |
||||
|
|
||||
|
@Excel(name = "网格ID") |
||||
|
private String gridId; |
||||
|
|
||||
|
@Excel(name = "姓名") |
||||
|
private String userName; |
||||
|
|
||||
|
@Excel(name = "电话") |
||||
|
private String mobile; |
||||
|
|
||||
|
@Excel(name = "身份证号码") |
||||
|
private String idCard; |
||||
|
|
||||
|
@Excel(name = "贫困属性") |
||||
|
private Integer povertyType; |
||||
|
|
||||
|
@Excel(name = "脱贫状态") |
||||
|
private Integer povertyStatus; |
||||
|
|
||||
|
@Excel(name = "删除标识:0.未删除 1.已删除") |
||||
|
private Integer 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; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.dto.PovertyManageDTO; |
||||
|
import com.epmet.dto.form.povertyManage.PovertyManageFormDto; |
||||
|
import com.epmet.entity.PovertyManageEntity; |
||||
|
import com.github.pagehelper.Page; |
||||
|
|
||||
|
/** |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
public interface PovertyManageService extends BaseService<PovertyManageEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return PovertyManageDTO |
||||
|
* @author generator |
||||
|
* @date 2023-06-16 |
||||
|
*/ |
||||
|
PovertyManageDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-06-16 |
||||
|
*/ |
||||
|
void save(PovertyManageFormDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-06-16 |
||||
|
*/ |
||||
|
void update(PovertyManageFormDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-06-16 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
Page<PovertyManageDTO> selectPage(PovertyManageFormDto formDTO); |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.dao.PovertyManageDao; |
||||
|
import com.epmet.dto.PovertyManageDTO; |
||||
|
import com.epmet.dto.form.povertyManage.PovertyManageFormDto; |
||||
|
import com.epmet.entity.PovertyManageEntity; |
||||
|
import com.epmet.service.PovertyManageService; |
||||
|
import com.github.pagehelper.Page; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-06-16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PovertyManageServiceImpl extends BaseServiceImpl<PovertyManageDao, PovertyManageEntity> implements PovertyManageService { |
||||
|
|
||||
|
@Override |
||||
|
public PovertyManageDTO get(String id) { |
||||
|
PovertyManageEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, PovertyManageDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(PovertyManageFormDto dto) { |
||||
|
PovertyManageEntity entity = ConvertUtils.sourceToTarget(dto, PovertyManageEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(PovertyManageFormDto dto) { |
||||
|
PovertyManageEntity entity = ConvertUtils.sourceToTarget(dto, PovertyManageEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Page<PovertyManageDTO> selectPage(PovertyManageFormDto formDTO) { |
||||
|
return PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) |
||||
|
.doSelectPage(() -> baseDao.selectPage(formDTO)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
<?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.epmet.dao.PovertyManageDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.PovertyManageEntity" id="povertyManageMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="resiUserId" column="RESI_USER_ID"/> |
||||
|
<result property="agencyId" column="AGENCY_ID"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="userName" column="USER_NAME"/> |
||||
|
<result property="mobile" column="MOBILE"/> |
||||
|
<result property="idCard" column="ID_CARD"/> |
||||
|
<result property="povertyType" column="POVERTY_TYPE"/> |
||||
|
<result property="povertyStatus" column="POVERTY_STATUS"/> |
||||
|
<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> |
||||
|
|
||||
|
<sql id="resultMap"> |
||||
|
pm.ID, |
||||
|
pm.RESI_USER_ID, |
||||
|
pm.AGENCY_ID, |
||||
|
pm.GRID_ID, |
||||
|
pm.USER_NAME, |
||||
|
pm.MOBILE, |
||||
|
pm.ID_CARD, |
||||
|
pm.POVERTY_TYPE, |
||||
|
pm.POVERTY_STATUS |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectPage" resultType="com.epmet.dto.PovertyManageDTO"> |
||||
|
select |
||||
|
<include refid="resultMap"/> |
||||
|
from poverty_manage pm |
||||
|
<where> |
||||
|
pm.DEL_FLAG = 0 |
||||
|
<if test="null != name and name != ''"> |
||||
|
AND pm.USER_NAME LIKE CONCAT('%', #{name}, '%') |
||||
|
</if> |
||||
|
<if test="null != mobile and mobile != ''"> |
||||
|
AND pm.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
||||
|
</if> |
||||
|
<if test="null != idCard and idCard != ''"> |
||||
|
AND pm.ID_CARD LIKE CONCAT('%', #{idCard}, '%') |
||||
|
</if> |
||||
|
<if test="null != povertyType and povertyType != ''"> |
||||
|
AND pm.POVERTY_TYPE = #{povertyType} |
||||
|
</if> |
||||
|
<if test="null != povertyStatus and povertyStatus != ''"> |
||||
|
AND pm.POVERTY_STATUS = #{povertyStatus} |
||||
|
</if> |
||||
|
<if test="null != agencyId and agencyId != ''"> |
||||
|
AND pm.AGENCY_ID = #{agencyId} |
||||
|
</if> |
||||
|
<if test="null != gridId and gridId != ''"> |
||||
|
AND pm.GRID_ID = #{gridId} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue