Commit 6f26d08c authored by 赵啸非's avatar 赵啸非

修改构建api文档

parent 0047f7e9
...@@ -22,7 +22,11 @@ import com.mortals.framework.model.BaseEntityLong; ...@@ -22,7 +22,11 @@ import com.mortals.framework.model.BaseEntityLong;
*/ */
public class RoleEntity extends BaseEntityLong{ public class RoleEntity extends BaseEntityLong{
private static final long serialVersionUID = 1547777703344L; private static final long serialVersionUID = 1547777703344L;
/** 用户ID */
private Long userId;
/** 角色名称 */ /** 角色名称 */
private String name; private String name;
......
...@@ -13,10 +13,10 @@ import com.mortals.framework.common.IBaseEnum; ...@@ -13,10 +13,10 @@ import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.role.model.RoleQuery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController; import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.role.model.RoleEntity; import com.mortals.xhx.base.system.role.model.RoleEntity;
import com.mortals.xhx.base.system.role.model.RoleUserEntity; import com.mortals.xhx.base.system.role.model.RoleUserEntity;
...@@ -41,7 +41,7 @@ import java.util.Map; ...@@ -41,7 +41,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("role") @RequestMapping("role")
public class RoleController extends BaseCRUDJsonMappingController<RoleService,RoleForm,RoleEntity,Long> { public class RoleController extends BasePhpCRUDJsonMappingController<RoleService,RoleForm,RoleEntity,Long> {
@Autowired @Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
...@@ -52,21 +52,20 @@ public class RoleController extends BaseCRUDJsonMappingController<RoleService,Ro ...@@ -52,21 +52,20 @@ public class RoleController extends BaseCRUDJsonMappingController<RoleService,Ro
} }
@Override @Override
protected void init(HttpServletRequest request, HttpServletResponse response, RoleForm form, protected void init(Map<String, Object> model, Context context) {
Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<>(); Map<String, Object> status = new HashMap<>();
status.put("userType", IBaseEnum.getEnumMap(UserType.class)); status.put("userType", IBaseEnum.getEnumMap(UserType.class));
status.put("roleType", RoleType.getEnumMap()); status.put("roleType", RoleType.getEnumMap());
model.put(KEY_RESULT_DICT, status); model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
} }
@PostMapping("roleNameByUserId") @PostMapping("roleNameByUserId")
public String getRoleNameByUserId(HttpServletRequest request, HttpServletResponse response, RoleForm form) { public String getRoleNameByUserId(@RequestParam(value = "userId") Long userId) {
try{ try{
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
RoleUserEntity roleUserEntity = new RoleUserEntity(); RoleUserEntity roleUserEntity = new RoleUserEntity();
roleUserEntity.setUserId(form.getUserId()); roleUserEntity.setUserId(userId);
List<RoleUserEntity> find = roleUserService.find(roleUserEntity, new Context()); List<RoleUserEntity> find = roleUserService.find(roleUserEntity, new Context());
List<RoleEntity> model = new ArrayList<>(); List<RoleEntity> model = new ArrayList<>();
if(find.size() > 0){ if(find.size() > 0){
......
...@@ -32,7 +32,7 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines ...@@ -32,7 +32,7 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
@Override @Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException { protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
list.stream().peek(item -> { list.stream().peek(item -> {
List<SiteBusinessEntity> childs = this.find(new SiteBusinessQuery().parentId(item.getBusinessId())); List<SiteBusinessEntity> childs = this.find(new SiteBusinessQuery().siteId(item.getSiteId()).parentId(item.getBusinessId()));
item.setChildren(childs); item.setChildren(childs);
}).count(); }).count();
super.findAfter(params, pageInfo, context, list); super.findAfter(params, pageInfo, context, list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment