14 changed files with 560 additions and 5 deletions
@ -0,0 +1,64 @@ |
|||||
|
package com.epmet.opendata.dto.ca; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CaResidentUserDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* ic_resi_user表id |
||||
|
*/ |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 绑定的房屋id |
||||
|
*/ |
||||
|
private String homeId; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private Long createBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createDate; |
||||
|
|
||||
|
/** |
||||
|
* 最后修改人 |
||||
|
*/ |
||||
|
private Long updateBy; |
||||
|
|
||||
|
/** |
||||
|
* 最后修改时间 |
||||
|
*/ |
||||
|
private Date updateDate; |
||||
|
|
||||
|
/** |
||||
|
* 删除标记,normal |
||||
|
*/ |
||||
|
private String deleteFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer versions; |
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package com.epmet.opendata.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
public class SaveCaResidentUserFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -182571137927356144L; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* ic_resi_user表id |
||||
|
*/ |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 房屋id |
||||
|
*/ |
||||
|
private String homeId; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private Long createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdDate; |
||||
|
|
||||
|
/** |
||||
|
* 最后修改人 |
||||
|
*/ |
||||
|
private Long updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 最后修改时间 |
||||
|
*/ |
||||
|
private Date updatedDate; |
||||
|
|
||||
|
/** |
||||
|
* 删除标记 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer versions; |
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
package com.epmet.opendata.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
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.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
|
||||
|
import com.epmet.opendata.dto.ca.CaResidentUserDTO; |
||||
|
import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; |
||||
|
import com.epmet.opendata.excel.CaResidentUserExcel; |
||||
|
import com.epmet.opendata.service.CaResidentUserService; |
||||
|
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 generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("caResidentUser") |
||||
|
public class CaResidentUserController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CaResidentUserService caResidentUserService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<CaResidentUserDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CaResidentUserDTO> page = caResidentUserService.page(params); |
||||
|
return new Result<PageData<CaResidentUserDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<CaResidentUserDTO> get(@PathVariable("id") String id){ |
||||
|
CaResidentUserDTO data = caResidentUserService.get(id); |
||||
|
return new Result<CaResidentUserDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody CaResidentUserDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
caResidentUserService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody CaResidentUserDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
caResidentUserService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
caResidentUserService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CaResidentUserDTO> list = caResidentUserService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CaResidentUserExcel.class); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("saveCaResidentUser") |
||||
|
public Result saveCaResidentUser(@RequestBody SaveCaResidentUserFormDTO dto){ |
||||
|
caResidentUserService.saveCaResidentUser(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.epmet.opendata.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
|
||||
|
import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; |
||||
|
import com.epmet.opendata.entity.CaResidentUserEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CaResidentUserDao extends BaseDao<CaResidentUserEntity> { |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.opendata.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.entity.BaseEntity; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ca_resident_user") |
||||
|
public class CaResidentUserEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* ic_resi_user表id |
||||
|
*/ |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 绑定的房屋id |
||||
|
*/ |
||||
|
private String homeId; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.epmet.opendata.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 2022-06-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CaResidentUserExcel { |
||||
|
|
||||
|
@Excel(name = "身份证号") |
||||
|
private String idCard; |
||||
|
|
||||
|
@Excel(name = "ic_resi_user表id") |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
@Excel(name = "绑定的房屋id") |
||||
|
private String homeId; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private Long createBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createDate; |
||||
|
|
||||
|
@Excel(name = "最后修改人") |
||||
|
private Long updateBy; |
||||
|
|
||||
|
@Excel(name = "最后修改时间") |
||||
|
private Date updateDate; |
||||
|
|
||||
|
@Excel(name = "删除标记,normal") |
||||
|
private String deleteFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer versions; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.opendata.redis; |
||||
|
|
||||
|
import com.epmet.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class CaResidentUserRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.epmet.opendata.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.opendata.dto.ca.CaResidentUserDTO; |
||||
|
import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; |
||||
|
import com.epmet.opendata.entity.CaResidentUserEntity; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
public interface CaResidentUserService extends BaseService<CaResidentUserEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<CaResidentUserDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
PageData<CaResidentUserDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<CaResidentUserDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
List<CaResidentUserDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CaResidentUserDTO |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
CaResidentUserDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
void save(CaResidentUserDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
void update(CaResidentUserDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-06-22 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
void saveCaResidentUser(SaveCaResidentUserFormDTO dto); |
||||
|
} |
@ -0,0 +1,99 @@ |
|||||
|
package com.epmet.opendata.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.opendata.dao.CaResidentUserDao; |
||||
|
import com.epmet.opendata.dto.ca.CaResidentUserDTO; |
||||
|
import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; |
||||
|
import com.epmet.opendata.entity.CaResidentEntity; |
||||
|
import com.epmet.opendata.entity.CaResidentUserEntity; |
||||
|
import com.epmet.opendata.redis.CaResidentUserRedis; |
||||
|
import com.epmet.opendata.service.CaResidentUserService; |
||||
|
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.text.SimpleDateFormat; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-06-22 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CaResidentUserServiceImpl extends BaseServiceImpl<CaResidentUserDao, CaResidentUserEntity> implements CaResidentUserService { |
||||
|
|
||||
|
@Autowired |
||||
|
private CaResidentUserRedis caResidentUserRedis; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<CaResidentUserDTO> page(Map<String, Object> params) { |
||||
|
IPage<CaResidentUserEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, CaResidentUserDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<CaResidentUserDTO> list(Map<String, Object> params) { |
||||
|
List<CaResidentUserEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, CaResidentUserDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<CaResidentUserEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<CaResidentUserEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CaResidentUserDTO get(String id) { |
||||
|
CaResidentUserEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, CaResidentUserDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CaResidentUserDTO dto) { |
||||
|
CaResidentUserEntity entity = ConvertUtils.sourceToTarget(dto, CaResidentUserEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CaResidentUserDTO dto) { |
||||
|
CaResidentUserEntity entity = ConvertUtils.sourceToTarget(dto, CaResidentUserEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void saveCaResidentUser(SaveCaResidentUserFormDTO dto) { |
||||
|
CaResidentUserEntity entity = ConvertUtils.sourceToTarget(dto,CaResidentUserEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
<?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.opendata.dao.CaResidentUserDao"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue