15 changed files with 501 additions and 2 deletions
@ -0,0 +1,44 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 小区/楼栋/房屋编码辅助表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-27 |
|||
*/ |
|||
@Data |
|||
public class IcOrganizationCodeInfoDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 社区id |
|||
*/ |
|||
private String communityId; |
|||
|
|||
/** |
|||
* 该社区下最大的小区编码序列号 |
|||
*/ |
|||
private String neighborMaxNum; |
|||
|
|||
/** |
|||
* 该社区下最大的楼栋编码序列号 |
|||
*/ |
|||
private String buildingMaxNum; |
|||
|
|||
/** |
|||
* 该社区下最大的房屋编码序列号 |
|||
*/ |
|||
private String houseMaxNum; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.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.dto.IcOrganizationCodeInfoDTO; |
|||
import com.epmet.excel.IcOrganizationCodeInfoExcel; |
|||
import com.epmet.service.IcOrganizationCodeInfoService; |
|||
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-27 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("icOrganizationCodeInfo") |
|||
public class IcOrganizationCodeInfoController { |
|||
|
|||
@Autowired |
|||
private IcOrganizationCodeInfoService icOrganizationCodeInfoService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<IcOrganizationCodeInfoDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<IcOrganizationCodeInfoDTO> page = icOrganizationCodeInfoService.page(params); |
|||
return new Result<PageData<IcOrganizationCodeInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<IcOrganizationCodeInfoDTO> get(@PathVariable("id") String id){ |
|||
IcOrganizationCodeInfoDTO data = icOrganizationCodeInfoService.get(id); |
|||
return new Result<IcOrganizationCodeInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody IcOrganizationCodeInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icOrganizationCodeInfoService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody IcOrganizationCodeInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icOrganizationCodeInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icOrganizationCodeInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<IcOrganizationCodeInfoDTO> list = icOrganizationCodeInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, IcOrganizationCodeInfoExcel.class); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcOrganizationCodeInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 小区/楼栋/房屋编码辅助表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-27 |
|||
*/ |
|||
@Mapper |
|||
public interface IcOrganizationCodeInfoDao extends BaseDao<IcOrganizationCodeInfoEntity> { |
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 小区/楼栋/房屋编码辅助表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_organization_code_info") |
|||
public class IcOrganizationCodeInfoEntity{ |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 社区id |
|||
*/ |
|||
private String communityId; |
|||
|
|||
/** |
|||
* 该社区下最大的小区编码序列号 |
|||
*/ |
|||
private String neighborMaxNum; |
|||
|
|||
/** |
|||
* 该社区下最大的楼栋编码序列号 |
|||
*/ |
|||
private String buildingMaxNum; |
|||
|
|||
/** |
|||
* 该社区下最大的房屋编码序列号 |
|||
*/ |
|||
private String houseMaxNum; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
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 2022-06-27 |
|||
*/ |
|||
@Data |
|||
public class IcOrganizationCodeInfoExcel { |
|||
|
|||
@Excel(name = "客户id") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "社区id") |
|||
private String communityId; |
|||
|
|||
@Excel(name = "该社区下最大的小区编码序列号") |
|||
private String neighborMaxNum; |
|||
|
|||
@Excel(name = "该社区下最大的楼栋编码序列号") |
|||
private String buildingMaxNum; |
|||
|
|||
@Excel(name = "该社区下最大的房屋编码序列号") |
|||
private String houseMaxNum; |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.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-27 |
|||
*/ |
|||
@Component |
|||
public class IcOrganizationCodeInfoRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcOrganizationCodeInfoDTO; |
|||
import com.epmet.entity.IcOrganizationCodeInfoEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 小区/楼栋/房屋编码辅助表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-27 |
|||
*/ |
|||
public interface IcOrganizationCodeInfoService extends BaseService<IcOrganizationCodeInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcOrganizationCodeInfoDTO> |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
PageData<IcOrganizationCodeInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcOrganizationCodeInfoDTO> |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
List<IcOrganizationCodeInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcOrganizationCodeInfoDTO |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
IcOrganizationCodeInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
void save(IcOrganizationCodeInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
void update(IcOrganizationCodeInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-27 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,87 @@ |
|||
package com.epmet.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.dao.IcOrganizationCodeInfoDao; |
|||
import com.epmet.dto.IcOrganizationCodeInfoDTO; |
|||
import com.epmet.entity.IcOrganizationCodeInfoEntity; |
|||
import com.epmet.redis.IcOrganizationCodeInfoRedis; |
|||
import com.epmet.service.IcOrganizationCodeInfoService; |
|||
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 generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-27 |
|||
*/ |
|||
@Service |
|||
public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganizationCodeInfoDao, IcOrganizationCodeInfoEntity> implements IcOrganizationCodeInfoService { |
|||
|
|||
@Autowired |
|||
private IcOrganizationCodeInfoRedis icOrganizationCodeInfoRedis; |
|||
|
|||
@Override |
|||
public PageData<IcOrganizationCodeInfoDTO> page(Map<String, Object> params) { |
|||
IPage<IcOrganizationCodeInfoEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcOrganizationCodeInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcOrganizationCodeInfoDTO> list(Map<String, Object> params) { |
|||
List<IcOrganizationCodeInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcOrganizationCodeInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcOrganizationCodeInfoEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcOrganizationCodeInfoEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcOrganizationCodeInfoDTO get(String id) { |
|||
IcOrganizationCodeInfoEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcOrganizationCodeInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcOrganizationCodeInfoDTO dto) { |
|||
IcOrganizationCodeInfoEntity entity = ConvertUtils.sourceToTarget(dto, IcOrganizationCodeInfoEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcOrganizationCodeInfoDTO dto) { |
|||
IcOrganizationCodeInfoEntity entity = ConvertUtils.sourceToTarget(dto, IcOrganizationCodeInfoEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
<?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.IcOrganizationCodeInfoDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcOrganizationCodeInfoEntity" id="icOrganizationCodeInfoMap"> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="communityId" column="COMMUNITY_ID"/> |
|||
<result property="neighborMaxNum" column="NEIGHBOR_MAX_NUM"/> |
|||
<result property="buildingMaxNum" column="BUILDING_MAX_NUM"/> |
|||
<result property="houseMaxNum" column="HOUSE_MAX_NUM"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue