MyBatis中@Insert,@Select,@Update,@Delect的使用

實習中遇到了一個神奇的組件:MyBatis中的@Insert,@Select,@Update,@Delect

在實際開發生產中可以直接在dao層的實現類中添加註解,即可實現我們想要的增刪改查操作:

代碼格式如下:

@Update("<script>update cm_manager set " +
            "manager_id=#{managerId}," +
            "manager_name=#{managerName}," +
            "manager_tel=#{managerTel}," +
            "manager_email=#{managerEmail}," +
            "state=#{state}," +
            "op_id=#{opId}," +
            "org_Id=#{orgId}," +
            "create_date = #{createDate,jdbcType=TIMESTAMP}," +
            "done_date = #{doneDate,jdbcType=TIMESTAMP}," +
            "effective_date = #{effectiveDate,jdbcType=TIMESTAMP}," +
            "expire_date = #{expireDate,jdbcType=TIMESTAMP}," +
            "remarks=#{remarks}," +
            "cert_code=#{certCode}," +
            "cert_type=#{certType}," +
            "trade_id=#{tradeId}," +
            "manager_sex=#{managerSex}," +
            "manager_department=#{managerDepartment}," +
            "manager_position=#{managerPosition}," +
            "manager_auth=#{managerAuth}" +
            " where id =#{id}</script>")
    public void modifyManager(CmManagerDO cmManagerDO)throws Exception;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章