一、service/NoteApi新增getNodeDetail接口定义
public interface NoteApi {
...
List<NoteManage> getNoteTypeList();
}
二、service/impl/NoteServiceImpl接口实现逻辑
public class NoteServiceImpl implements NoteApi {
@Autowired
NoteMapper noteMapper;
...
public List<NoteManage> getNoteTypeList() {
return noteMapper.getNoteTypeList();
}
}
三、mapper/NoteMapper新增接口
...
public interface NoteMapper {
...
List<NoteManage> getNoteTypeList();
}
四、新增sql语句
<select id="getNoteTypeList" resultType="java.util.Map">
SELECT type typeName, COUNT(1) noteNum FROM note GROUP BY type
</select>
五、控制类NoteController新增更新逻辑
@RequestMapping(value = "/getNoteTypeList",method = RequestMethod.GET)
public Response getNoteTypeList(){
Response response = new Response();
List<NoteManage> typeList = service.getNoteTypeList();
response.setResponse(true,"查询成功",200, typeList);
return response;
}