0805任务

【功能任务】
1.用户管理
增【done】
删【done】
改 【done】
查【done】

设置密码【】


2.船舶录入
图片录入【】图片上传到本地失败 可能是路径问题。

路径等信息存入数据库【done】
3.船舶列表
查看详细信息
编辑 包括图片的编辑
船舶列表的显示

【技术任务】
1.在oracle数据库中存入自增主键【done】
存入图片表
存入用户表 两个地方用到
2.oracle数据库中 字段类型与java entity字段类型的关系处理

【笔记】
1.这里的MMSI唯一性验证 是为了防止插入数据中报错 因为这个mmsi是主键,要能洞察到所有可能报错的地方,给予提示,不要让用户看到各种404 500 503等错误页面。

2.建立序列

-- Create sequence
create sequence SEQ_SHIP_IMAGE
minvalue 20
maxvalue 999999999999999999
start with 40
increment by 1
cache 20;

使用序列:

SELECT SEQ_SHIP_IMAGE.Nextval from dual;
insert into ship_image (id,img_path,remark,ship_id) values (SEQ_SHIP_IMAGE.Nextval,'ship3.jpg','8','8');

或者

<!-- 对应userDao中的insertUser方法,  -->
   <insert id="insertUser" parameterType="com.dy.entity.User">
           <!-- oracle等不支持id自增长的,可根据其id生成策略,先获取id 
           
        <selectKey resultType="int" order="BEFORE" keyProperty="id">
              select seq_user_id.nextval as id from dual
        </selectKey>
        
        -->   
           insert into user(id, name, password, age, deleteFlag) 
               values(#{id}, #{name}, #{password}, #{age}, #{deleteFlag})
   </insert>

【问题】
idea 如何把执行的sql语句打印出来??
【待解决问题】

1.Could not set property 'id' of 'class net.huadong.entity.ShipImage' with value '25' Cause: java.lang.IllegalArgumentException: argument type mismatch

type Exception report

message Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException :

description The server encountered an internal error that prevented it from fulfilling this request.

 

原文地址:https://www.cnblogs.com/CESC4/p/7289247.html