1.外键约束
1. MySQL数据库删除数据(有外键约束):
https://blog.csdn.net/qq_36653267/article/details/79868236
2.基本语句
1.MySQL批量插入、批量更新及批量删除语句
https://blog.csdn.net/u014252478/article/details/91386289
2.mybatis_批量插入参数List_Map_String,Object
https://blog.csdn.net/zs_life/article/details/90418182
3.复杂语句
1.左连接 ,右连接,内连接和全外连接的4者区别
https://blog.csdn.net/weixin_39220472/article/details/81193617
2.编写加减法运算的sql语句
https://zhidao.baidu.com/question/489962132.html
3.mysql查询指定日期
https://blog.csdn.net/xiao297328/article/details/103044365
mysql日期时间简单查询
https://blog.csdn.net/csdnliuxin123524/article/details/81203432
mybatis
1.情景:一个实体类作为另一个实体类的属性
<!--第一种方式 -->
<resultMap id="DetailMap" type="com.gzhh.hrp.gl.entity.teller.AccountsInOutDetail">
<result column="dept_Code" property="department.deptCode"/>
<result column="ccode" property="code.ccode"/>
<result column="Dept_Name" property="department.deptName"/>
<result column="Creator" property="department.creator"/>
<result column="Editor" property="department.organ.editor"/>
<result column="Org_Name" property="department.organ.orgName"/>
</resultMap>
<select id="getOneVouch" resultMap="DetailMap">
select gld.*,dbd.*,dbo.* from
GL_Accounts_InOut_Detail gld,DB_Department dbd,DB_Organ dbo
where dbo.Org_Code=dbd.Org_Code
and gld.dept_Code=dbd.dept_Code
and gld.id=#{id}
</select>
<!--第二种方式-->
<!--getOneVouchDetail-->
<resultMap id="DetailMap" type="com.gzhh.hrp.gl.entity.teller.AccountsInOutDetail">
<!--property是外键属性 这里要注意的是column对应的是student中的外键,而且需是表字段名 -->
<association property="department" select="getDepartment" column="dept_Code" javaType="com.gzhh.hrp.db.entity.Department">
</association>
<association property="code" select="getCode" column="ccode" javaType="com.gzhh.hrp.gl.entity.basic.Code">
</association>
</resultMap>
<select id="getOneVouchDetail" resultMap="DetailMap">
select * from GL_Accounts_InOut_Detail
where id=#{id}
</select>
<!--查询科目-->
<select id="getCode" resultType="com.gzhh.hrp.gl.entity.basic.Code">
select * from GL_code
where ccode=#{ccode}
</select>
<!--查询部门-->
<resultMap id="DepartmentMap" type="com.gzhh.hrp.db.entity.Department">
<!--property是外键属性 这里要注意的是column对应的是表中的外键,而且需是表字段名 -->
<association property="organ" select="getOrgan" column="Org_Code" javaType="com.gzhh.hrp.db.entity.Organ">
</association>
</resultMap>
<select id="getDepartment" resultMap="DepartmentMap">
select * from DB_Department
where Dept_Code=#{dept_Code}
</select>
<!--查询Organ-->
<select id="getOrgan" resultType="com.gzhh.hrp.db.entity.Organ">
select * from DB_Organ
where Org_Code=#{Org_Code}
</select>
2.Mybatis多表查询(一对一、一对多、多对多)
https://www.cnblogs.com/expiator/p/9328338.html
mybatis多表查询之多对多关系查询的实现-xml方式
https://www.cnblogs.com/hopeofthevillage/p/11410221.html