7 changed files with 393 additions and 0 deletions
@ -0,0 +1,84 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 疫情风险地区 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-10-31 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcDangerAreaDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 风险等级 |
||||
|
*/ |
||||
|
private String dangerLevel; |
||||
|
|
||||
|
/** |
||||
|
* 省 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 区 |
||||
|
*/ |
||||
|
private String district; |
||||
|
|
||||
|
/** |
||||
|
* 省-市-区 |
||||
|
*/ |
||||
|
private String allName; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
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.IcDangerAreaDTO; |
||||
|
import com.epmet.service.IcDangerAreaService; |
||||
|
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-10-31 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("icDangerArea") |
||||
|
public class IcDangerAreaController { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcDangerAreaService icDangerAreaService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<IcDangerAreaDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<IcDangerAreaDTO> page = icDangerAreaService.page(params); |
||||
|
return new Result<PageData<IcDangerAreaDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<IcDangerAreaDTO> get(@PathVariable("id") String id){ |
||||
|
IcDangerAreaDTO data = icDangerAreaService.get(id); |
||||
|
return new Result<IcDangerAreaDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody IcDangerAreaDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
icDangerAreaService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody IcDangerAreaDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
icDangerAreaService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
icDangerAreaService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.IcDangerAreaEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 疫情风险地区 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-10-31 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcDangerAreaDao extends BaseDao<IcDangerAreaEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
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-10-31 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ic_danger_area") |
||||
|
public class IcDangerAreaEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 风险等级 |
||||
|
*/ |
||||
|
private String dangerLevel; |
||||
|
|
||||
|
/** |
||||
|
* 省 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 区 |
||||
|
*/ |
||||
|
private String district; |
||||
|
|
||||
|
/** |
||||
|
* 省-市-区 |
||||
|
*/ |
||||
|
private String allName; |
||||
|
|
||||
|
} |
@ -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.IcDangerAreaDTO; |
||||
|
import com.epmet.entity.IcDangerAreaEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 疫情风险地区 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-10-31 |
||||
|
*/ |
||||
|
public interface IcDangerAreaService extends BaseService<IcDangerAreaEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<IcDangerAreaDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
PageData<IcDangerAreaDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<IcDangerAreaDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
List<IcDangerAreaDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return IcDangerAreaDTO |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
IcDangerAreaDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
void save(IcDangerAreaDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
void update(IcDangerAreaDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-10-31 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
@ -0,0 +1,83 @@ |
|||||
|
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.IcDangerAreaDao; |
||||
|
import com.epmet.dto.IcDangerAreaDTO; |
||||
|
import com.epmet.entity.IcDangerAreaEntity; |
||||
|
import com.epmet.service.IcDangerAreaService; |
||||
|
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-10-31 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IcDangerAreaServiceImpl extends BaseServiceImpl<IcDangerAreaDao, IcDangerAreaEntity> implements IcDangerAreaService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<IcDangerAreaDTO> page(Map<String, Object> params) { |
||||
|
IPage<IcDangerAreaEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, IcDangerAreaDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<IcDangerAreaDTO> list(Map<String, Object> params) { |
||||
|
List<IcDangerAreaEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, IcDangerAreaDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<IcDangerAreaEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<IcDangerAreaEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public IcDangerAreaDTO get(String id) { |
||||
|
IcDangerAreaEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, IcDangerAreaDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(IcDangerAreaDTO dto) { |
||||
|
IcDangerAreaEntity entity = ConvertUtils.sourceToTarget(dto, IcDangerAreaEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(IcDangerAreaDTO dto) { |
||||
|
IcDangerAreaEntity entity = ConvertUtils.sourceToTarget(dto, IcDangerAreaEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
<?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.IcDangerAreaDao"> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue