backend expert

📁 chrysaliscat/designgraduation 📅 Jan 1, 1970
1
总安装量
0
周安装量
#49474
全站排名
安装命令
npx skills add https://github.com/chrysaliscat/designgraduation --skill Backend Expert

Skill 文档

Backend Expert Skill (Spring Boot + MyBatis)

This skill provides specialized knowledge for developing and debugging backend services in the RuoYi-Vue ecosystem.

🏗️ Core Principles

  1. Layered Architecture: Controller -> Service -> Mapper -> XML -> DB.
  2. RuoYi Conventions:
    • Use @PreAuthorize for permission control.
    • Use SecurityUtils.getUserId() to get current user securely.
    • Use AjaxResult for all Controller returns.
    • Use TableDataInfo for pagination returns.
  3. MyBatis Strictness: XML SQL columns usually use snake_case, Java entities use camelCase. ResultMaps are mandatory for complex queries.

🛠️ Common Workflows

1. Debugging Data Loss (The “Silent Fail”)

Context: Frontend sends data, but backend receives null. Checklist:

  1. JSON Body: Is the Controller method using @RequestBody?
  2. Getter/Setters: Does the Domain class have getters/setters for new fields?
  3. Compilation: CRITICAL. Did the code actually compile? Check for “symbol not found” errors that might be hidden in log files.
  4. Mapper XML: explicitly map column="user_name" to property="userName".

2. Controller Pattern

@PreAuthorize("@ss.hasPermi('module:business:add')")
@PostMapping
public AjaxResult add(@RequestBody MyObject obj) {
    obj.setCreateBy(SecurityUtils.getUsername());
    return toAjax(myService.insert(obj));
}

3. Service Pattern

  • Business logic goes here, NOT in Controller.
  • Handle transactional logic with @Transactional.
  • Verify data uniqueness or integrity before calling Mapper.

How to use

Invoke this skill when adding new API endpoints or Entity fields. It forces you to:

  • Verify resultMap in XML.
  • Check SecurityUtils usage.
  • Confirm strict Data Binding.