第一次正式進入公司實習
第一次正式進入公司 實習 。接觸到的並未在學校中學到的許多東西(軟件、框架等)在下面列出。
工作軟件:IDEA(之前使用的是eclipse)、Navicat(之前使用的是SQL Server Management)
框架:Spring Boot、Mybatis
軟件項目管理工具:Maven
第一個任務:
實現數據庫的update功能
帶我的師傅並不打算帶着我做一次,也許他認爲項目太簡單,而且摸索的過程有利於我的發展吧!
但是對一個計算機專業但是從未接觸過Spring框架的準大四生來說,很難完成,而且限定了2天時間完成(其實第一天下午15:00才佈置任務)。
目標如下:
陣地介紹-編輯資料 @陳0敏 2019-7-9
服務隊介紹-編輯資料 @陳0敏 2019-7-9
熟悉項目結構及開發規範 @陳0敏 2019-7-9
熟悉項目具體實施,且必須在規定時間內完成 @陳0敏 2019-7-9
參考文檔如下:
mybatis-plus文檔
Spring-Boot文檔
Spring MVC文檔
swagger(文檔)
IDEA常用快捷鍵
java開發手冊
相關
使用的庫:culture-center
使用的表:dept_detail
項目入口controller: DeptController
———————————————————分——界——線——————————————————
我的解決方案
明確自己應該創建的java文件有哪些
main -->
- java -->
- Controller -->>
- ①DeptDetailController
- Service -->>
- ②IDeptDetailService
- impl -->>>
- ③DeptDetailServiceImpl
- DAO -->
- ④DeptDAO
api -->
- model -->
- entity -->>>
- ⑤DeptDetail
- param -->>>
- ⑥NoahDeptUpdateParam
①DeptDetailController(項目入口)
/**
* @program: noah-task-unit
* @author: chenmin
* @create: 2019-07-09 15:10
* @desc: 服務隊編輯詳情
**/
@Api(tags = "服務隊管理")
@RestController
@RequestMapping("/dept")
public class DeptDetailController {
@Autowired
private IDeptDetailService iDept_detailService;
@ApiOperation(value = "編輯部門資料")
@RequestMapping(value = "/data/edit", method = RequestMethod.POST)
@Transactional(rollbackFor = Exception.class)
public Boolean edit(@Valid @RequestBody NoahDeptDataUpdateParam param) {
Boolean result = deptDetailService.edit(param);
return result;
}
}
②IDeptDetailService
/**
* @program: noah-task-unit
* @author: chenmin
* @create: 2019-07-09 15:10
* @desc:
**/
@Service
public interface IDeptDetailService extends IService<DeptDetail> {
Long create(NoahDeptCreateParam param);
Boolean updateById(NoahDeptUpdateParam param);
}
③DeptDetailServiceImpl
@Service("IDeptDetailService")
public class DeptDetailServiceImpl extends AbstractNoahServiceImpl<IDeptDAO, DeptDetail> implements IDeptDetailService {
@Autowired
private IDeptDetailService iDept_detailService;
@Override
public Boolean updateById(NoahDeptUpdateParam param) {
DeptDetail deptDetailById = getById(param.getDeptId());
Assert.notNull(deptDetailById, "服務隊不存在");
DeptDetail mapper = DozerUtil.mapper(param, DeptDetail.class);
boolean result = saveOrUpdate(mapper);
return result;
}
}
④DeptDetail
@TableName("dept_detail")
@Data
public class DeptDetail extends LogicDelEntity {
/**
*
*/
private Long deptId;
/**
*
*/
private Long memberCount;
/**
*
*/
private String abstracts;
/**
*
*/
private String pictureUrls;
}
⑤IDeptDAO
/**
* @program: noah-culture-center
* @description: 更新
* @author: chenmin
* @create: 2019-07-09 15:10
**/
@Repository
public interface IDeptDAO extends BaseMapper<DeptDetail> {
}
⑥NoahDeptUpdateParam
public class NoahDeptUpdateParam {
/**
* 部門id
*/
@NotNull
@ApiModelProperty(value = "部門id")
private Long deptId;
/**
* appId
*/
@ApiModelProperty(value = "appId")
private Long appId;
/**
* 簡介
*/
@ApiModelProperty(value = "簡介")
private String abstracts;
/**
* 圖片地址
*/
@ApiModelProperty(value = "圖片地址")
private List<String> pictureUrls;
/**
* 人數
*/
@ApiModelProperty(value = "人數")
private Long memberCount;
@NotNull(message = "部門id不能爲空")
@ApiModelProperty(value = "deptId")
private Long deptId;
}
測試成功啦
總結
第一個項目就逾期了,233。
其中碰到了很多不會的地方,也不能總是去麻煩別人,只能靠自己查看api文檔(百度幾乎不到答案),希望以後越來越好!