从零到完成安卓项目实战安卓端+后端

Posted 程序员springmeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从零到完成安卓项目实战安卓端+后端相关的知识,希望对你有一定的参考价值。

今天下雨了,出不去了,在家开发一个安卓系统。

因为平时自己喜欢打篮球,那就开发一个篮球相关的系统吧:NBA安卓系统。

一,功能介绍

APP主要具备网上篮球约球、篮球交流、线上NBA观赛,力求软件界面友好、功能齐全、可拓展性良好。

系统的功能有:交流评论区模块、场馆预约模块、网上约球模块、约球留言模块、线上观赛模块、NBA球员分析模块。

通过线上篮球约球、球友交流评论、NBA比赛观看等功能,打造一款“线上观赛+线下实战”的篮球交友APP,帮助一些喜欢篮球运动的青少年可以随时随地观赛、组队、交流、交友。

二,开发语言介绍

APP基于JAVA语言进行开发,后台数据的存储采用 mysql 结合 Reids 实现数据存储,移动端通过 androidStudio 开发。

三,系统的界面介绍











四,核心代码演示

/**
 * 小孟v:jishulearn
 * Created by xiaomeng
 */
@Controller
@RequestMapping("/sys/dict")
public class DictionaryController extends BaseController 
    @Autowired
    private DictionaryService dictionaryService;

    @RequiresPermissions("sys:dict:view")
    @RequestMapping()
    public String view() 
        return "system/dictionary.html";
    

    /**
     * 分页查询字典
     */
    @OperLog(value = "字典管理", desc = "分页查询")
    @RequiresPermissions("sys:dict:list")
    @ResponseBody
    @RequestMapping("/page")
    public PageResult<Dictionary> page(HttpServletRequest request) 
        PageParam<Dictionary> pageParam = new PageParam<>(request);
        return new PageResult<>(dictionaryService.page(pageParam, pageParam.getWrapper()).getRecords(), pageParam.getTotal());
    

    /**
     * 查询全部字典
     */
    @OperLog(value = "字典管理", desc = "查询全部")
    @RequiresPermissions("sys:dict:list")
    @ResponseBody
    @RequestMapping("/list")
    public JsonResult list(HttpServletRequest request) 
        PageParam<Dictionary> pageParam = new PageParam<>(request);
        return JsonResult.ok().setData(dictionaryService.list(pageParam.getOrderWrapper()));
    

    /**
     * 根据id查询字典
     */
    @OperLog(value = "字典管理", desc = "根据id查询")
    @RequiresPermissions("sys:dict:list")
    @ResponseBody
    @RequestMapping("/get")
    public JsonResult get(Integer id) 
        return JsonResult.ok().setData(dictionaryService.getById(id));
    

    /**
     * 添加字典
     */
    @OperLog(value = "字典管理", desc = "添加", param = false, result = true)
    @RequiresPermissions("sys:dict:save")
    @ResponseBody
    @RequestMapping("/save")
    public JsonResult save(Dictionary dictionary) 
        if (dictionaryService.count(new QueryWrapper<Dictionary>().eq("dict_code", dictionary.getDictCode())) > 0) 
            return JsonResult.error("字典标识已存在");
        
        if (dictionaryService.count(new QueryWrapper<Dictionary>().eq("dict_name", dictionary.getDictName())) > 0) 
            return JsonResult.error("字典名称已存在");
        
        if (dictionaryService.save(dictionary)) 
            return JsonResult.ok("添加成功");
        
        return JsonResult.error("添加失败");
    

    /**
     * 修改字典
     */
    @OperLog(value = "字典管理", desc = "修改", param = false, result = true)
    @RequiresPermissions("sys:dict:update")
    @ResponseBody
    @RequestMapping("/update")
    public JsonResult update(Dictionary dictionary) 
        if (dictionaryService.count(new QueryWrapper<Dictionary>().eq("dict_code", dictionary.getDictCode())
                .ne("dict_id", dictionary.getDictId())) > 0) 
            return JsonResult.error("字典代码已存在");
        
        if (dictionaryService.count(new QueryWrapper<Dictionary>().eq("dict_name", dictionary.getDictName())
                .ne("dict_id", dictionary.getDictId())) > 0) 
            return JsonResult.error("字典名称已存在");
        
        if (dictionaryService.updateById(dictionary)) 
            return JsonResult.ok("修改成功");
        
        return JsonResult.error("修改失败");
    

    /**
     * 删除字典
     */
    @OperLog(value = "字典管理", desc = "删除", result = true)
    @RequiresPermissions("sys:dict:remove")
    @ResponseBody
    @RequestMapping("/remove")
    public JsonResult remove(Integer id) 
        if (dictionaryService.removeById(id)) 
            return JsonResult.ok("删除成功");
        
        return JsonResult.error("删除失败");
    

    /**
     * 批量添加字典
     */
    @OperLog(value = "字典管理", desc = "批量添加", param = false, result = true)
    @RequiresPermissions("sys:dict:save")
    @ResponseBody
    @RequestMapping("/saveBatch")
    public JsonResult saveBatch(@RequestBody List<Dictionary> list) 
        // 对集合本身进行非空和重复校验
        StringBuilder sb = new StringBuilder();
        sb.append(CoreUtil.listCheckBlank(list, "dictCode", "字典标识"));
        sb.append(CoreUtil.listCheckBlank(list, "dictName", "字典名称"));
        sb.append(CoreUtil.listCheckRepeat(list, "dictCode", "字典标识"));
        sb.append(CoreUtil.listCheckRepeat(list, "dictName", "字典名称"));
        if (sb.length() != 0) return JsonResult.error(sb.toString());
        // 数据库层面校验
        if (dictionaryService.count(new QueryWrapper<Dictionary>().in("dict_code",
                list.stream().map(Dictionary::getDictCode).collect(Collectors.toList()))) > 0) 
            return JsonResult.error("字典标识已存在");
        
        if (dictionaryService.count(new QueryWrapper<Dictionary>().in("dict_name",
                list.stream().map(Dictionary::getDictName).collect(Collectors.toList()))) > 0) 
            return JsonResult.error("字典名称已存在");
        
        if (dictionaryService.saveBatch(list)) 
            return JsonResult.ok("添加成功");
        
        return JsonResult.error("添加失败");
    

    /**
     * 批量删除字典
     */
    @OperLog(value = "字典管理", desc = "批量删除", result = true)
    @RequiresPermissions("sys:dict:remove")
    @ResponseBody
    @RequestMapping("/removeBatch")
    public JsonResult removeBatch(@RequestBody List<Integer> ids) 
        if (dictionaryService.removeByIds(ids)) 
            return JsonResult.ok("删除成功");
        
        return JsonResult.error("删除失败");
    


/**
 * 小孟v:jishulearn
 * Created by xiaoemng
 */
@Controller
@RequestMapping("/sys/menu")
public class MenuController extends BaseController 
    @Autowired
    private MenuService menuService;

    @RequiresPermissions("sys:menu:view")
    @RequestMapping()
    public String view() 
        return "system/menu.html";
    

    /**
     * 分页查询菜单
     */
    @OperLog(value = "菜单管理", desc = "分页查询")
    @RequiresPermissions("sys:menu:list")
    @ResponseBody
    @RequestMapping("/page")
    public PageResult<Menu> page(HttpServletRequest request) 
        PageParam<Menu> pageParam = new PageParam<>(request);
        pageParam.setDefaultOrder(new String[]"sort_number", null);
        return menuService.listPage(pageParam);
    

    /**
     * 查询全部菜单
     */
    @OperLog(value = "菜单管理", desc = "查询全部")
    @RequiresPermissions("sys:menu:list")
    @ResponseBody
    @RequestMapping("/list")
    public JsonResult list(HttpServletRequest request) 
        PageParam<Menu> pageParam = new PageParam<>(request);
        pageParam.setDefaultOrder(new String[]"sort_number", null);
        return JsonResult.ok().setData(menuService.list(pageParam.getOrderWrapper()));
    

    /**
     * 根据id查询菜单
     */
    @OperLog(value = "菜单管理", desc = "根据id查询")
    @RequiresPermissions("sys:menu:list")
    @ResponseBody
    @RequestMapping("/get")
    public JsonResult get(Integer id) 
        return JsonResult.ok().setData(menuService.getById(id));
    

    /**
     * 添加菜单
     */
    @OperLog(value = "菜单管理", desc = "添加", param = false, result = true)
    @RequiresPermissions("sys:menu:save")
    @ResponseBody
    @RequestMapping("/save")
    public JsonResult save(Menu menu) 
        if (menuService.save(menu)) 
            return JsonResult.ok("添加成功");
        
        return JsonResult.error("添加失败");
    

    /**
     * 修改菜单
     */
    @OperLog(value = "菜单管理", desc = "修改", param = false, result = true)
    @RequiresPermissions("sys:menu:update")
    @ResponseBody
    @RequestMapping("/update")
    public JsonResult update(Menu menu) 
        if (menuService.updateById(menu)) 
            return JsonResult.ok("修改成功");
        
        return JsonResult.error("修改失败");
    

    /**
     * 删除菜单
     */
    @OperLog(value = "菜单管理", desc = "删除", result = true)
    @RequiresPermissions("sys:menu:remove")
    @ResponseBody
    @RequestMapping("/remove")
    public JsonResult remove(Integer id) 
        if (menuService.removeById(id)) 
            return JsonResult.ok("删除成功");
        
        return JsonResult.error("删除失败");
    

    /**
     * 批量添加菜单
     */
    @OperLog(value = "菜单管理", desc = "批量添加", param = false, result = true)
    @RequiresPermissions("sys:menu:save")
    @ResponseBody
    @RequestMapping("/saveBatch")
    public JsonResult saveBatch(@RequestBody List<Menu> menuList) 
        if (menuService.saveBatch(menuList)) 
            return JsonResult.ok("添加成功");
        
        return JsonResult.error("添加失败");
    

    /**
     * 批量修改菜单
     */
    @OperLog(value = "菜单管理", desc = "批量修改", result = true)
    @RequiresPermissions("sys:menu:update")
    @ResponseBody
    @RequestMapping("/updateBatch")
    public JsonResult updateBatch(@RequestBody BatchParam<Menu> batchParam) 
        if (batchParam.update(menuService, "menu_id")) 
            return JsonResult.ok("修改成功");
        Java从零到企业级电商项目实战

集五福+微信红包+大转盘 从零到一完成国民级项目测试实战

三个小时vue3.x从零到实战(后)(vue3.x配套工具及项目化构建)

从零到一: 代码调试

Java从零到企业级电商项目实战

从零开始的安卓开发环境搭建与入门