为什么自增字段id在增添数据时不填会报错填了数据库里又不一致
/*ds_technician 的id是ds_technician_wallet的外键
*ds_technician_wallet里面增加数据时,不填id提示参数缺失如下
在浏览器网址处输入:http://localhost:8080/***/方法.do?tid=20&amount=100.2 这样会提示参数缺失,必须加上id,id随便赋值,但是在数据库里显示的id却是正常自增的数字,和输入的不一致
*/
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sayesmed.doorservice.dao.DsTechnicianWalletDao">
<sql id="dsTechnicianWalletColumns">
a.id AS "id",
a.tid AS "tid",
a.amount AS "amount"
</sql>
<sql id="dsTechnicianWalletJoins">
</sql>
<sql id="dsTechnicianColumns">
b.id AS "id"
</sql>
<sql id="dsTechnicianJoin">
from ds_technician_wallet a, ds_technician b
where a.tid = b.id
</sql>
<select id="get" resultType="DsTechnicianWallet">
SELECT
<include refid="dsTechnicianWalletColumns"/>
FROM ds_technician_wallet a
<include refid="dsTechnicianWalletJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="DsTechnicianWallet">
SELECT
<include refid="dsTechnicianWalletColumns"/>
FROM ds_technician_wallet a
<include refid="dsTechnicianWalletJoins"/>
<where>
<if test="tid != null and tid != ''">
AND a.tid = #{tid}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="DsTechnicianWallet">
SELECT
<include refid="dsTechnicianWalletColumns"/>
FROM ds_technician_wallet a
<include refid="dsTechnicianWalletJoins"/>
<where>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
</otherwise>
</choose>
</select>
<insert id="insert">
INSERT INTO ds_technician_wallet(
id,
tid,
amount
) VALUES (
#{id},
#{tid},
#{amount}
)
</insert>
<update id="update">
UPDATE ds_technician_wallet SET
tid = #{tid},
amount = #{amount}
WHERE id = #{id}
</update>
<update id="delete">
DELETE FROM ds_technician_wallet
WHERE id = #{id}
</update>
</mapper>