@@ -1,10 +1,13 @@ | |||
package com.tuoheng.controller; | |||
import com.tuoheng.model.entity.Area; | |||
import com.tuoheng.model.query.AreaQuery; | |||
import com.tuoheng.service.AreaService; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* (Area)表控制层 | |||
* | |||
@@ -30,6 +33,16 @@ public class AreaController { | |||
return areaService.index(query); | |||
} | |||
/** | |||
* 新增区域信息 | |||
* @param entity | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult add(@Valid @RequestBody Area entity){ | |||
return areaService.add(entity); | |||
} | |||
} |
@@ -41,6 +41,16 @@ public class TenantController { | |||
return tenantService.findTenants(query); | |||
} | |||
/** | |||
* 查询租户下所有的用户数据 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/findUserLis") | |||
public JsonResult findUserLis(TenantQuery query) { | |||
return tenantService.findTenants(query); | |||
} | |||
/** | |||
* 更新业务租户信息及密码接口 | |||
* |
@@ -0,0 +1,29 @@ | |||
package com.tuoheng.enums; | |||
import lombok.Getter; | |||
/** | |||
* 逻辑删除标记类型 | |||
* @author chenyukun | |||
*/ | |||
public enum MarkTypeEnum { | |||
/** | |||
* 有效 | |||
*/ | |||
VALID(1,"有效"), | |||
/** | |||
* 无效 | |||
*/ | |||
NOTVALID(0,"失效"); | |||
MarkTypeEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -8,6 +8,8 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
/** | |||
* | |||
* @TableName t_area | |||
@@ -44,6 +46,7 @@ public class Area implements Serializable { | |||
/** | |||
* 区域名称 | |||
*/ | |||
@NotBlank(message = "分区名称不能为空") | |||
private String name; | |||
/** |
@@ -18,4 +18,10 @@ public interface AreaService extends IService<Area> { | |||
* @return | |||
*/ | |||
JsonResult index(AreaQuery query); | |||
/** | |||
* 新增区域信息 | |||
* @param entity | |||
* @return | |||
*/ | |||
JsonResult add(Area entity); | |||
} |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.enums.MarkTypeEnum; | |||
import com.tuoheng.mapper.AreaMapper; | |||
import com.tuoheng.model.entity.Area; | |||
import com.tuoheng.model.query.AreaQuery; | |||
@@ -40,7 +41,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> | |||
IPage<Area> page = new Page<>(query.getPage(), query.getLimit()); | |||
IPage<Area> areaPage = areaMapper.selectPage(page, Wrappers.<Area>lambdaQuery() | |||
.eq(Area::getMark, 1) | |||
.eq(Area::getMark, MarkTypeEnum.VALID.getCode()) | |||
.like(ObjectUtil.isNotEmpty(query.getName()), Area::getName, query.getName())); | |||
//todo 更新人员 users表是加字段还是新表 | |||
@@ -48,6 +49,19 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> | |||
return JsonResult.success(areaPage); | |||
} | |||
/** | |||
* 新增区域信息 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult add(Area entity) { | |||
return null; | |||
} | |||
} | |||