|
|
|
@ -6,9 +6,9 @@ |
|
|
|
<!-- This code was generated by TableGo tools, mark 1 begin. --> |
|
|
|
<!-- 字段映射 --> |
|
|
|
<resultMap id="materialTypeMap" type="com.dreamchaser.depository_manage.entity.MaterialType"> |
|
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
|
<result column="tname" property="tname" jdbcType="VARCHAR" /> |
|
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR" /> |
|
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
|
<result column="tname" property="tname" jdbcType="VARCHAR"/> |
|
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR"/> |
|
|
|
<result column="state" property="state" jdbcType="INTEGER"/> |
|
|
|
<result column="parentId" property="parentId" jdbcType="INTEGER"/> |
|
|
|
<result column="oldId" property="oldId" jdbcType="INTEGER"/> |
|
|
|
@ -22,14 +22,14 @@ |
|
|
|
<!-- 查询所有数据 --> |
|
|
|
<select id="findMaterialTypeAll" resultMap="materialTypeMap"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt |
|
|
|
where mt.state != 3 and mt.state != 4 |
|
|
|
</select> |
|
|
|
<!-- 查询所有顶级父类 --> |
|
|
|
<select id="findMaterialTypeNoParent" resultMap="materialTypeMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt |
|
|
|
where mt.state = 1 and mt.parentId = 0 |
|
|
|
</select> |
|
|
|
@ -43,7 +43,7 @@ |
|
|
|
<if test="introduce != null and introduce != ''"> |
|
|
|
AND mt.introduce LIKE CONCAT('%', #{introduce}, '%') |
|
|
|
</if> |
|
|
|
<if test="state != null and state != ''" > |
|
|
|
<if test="state != null and state != ''"> |
|
|
|
and mt.state = #{state} |
|
|
|
</if> |
|
|
|
<if test="parentId != null"> |
|
|
|
@ -57,7 +57,7 @@ |
|
|
|
<!-- 根据条件参数查询数据列表 --> |
|
|
|
<select id="findMaterialTypeByCondition" resultMap="materialTypeMap" parameterType="map"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt WHERE 1 = 1 |
|
|
|
<if test="tname != null and tname != ''"> |
|
|
|
AND mt.tname LIKE CONCAT('%', #{tname}, '%') |
|
|
|
@ -65,7 +65,7 @@ |
|
|
|
<if test="introduce != null and introduce != ''"> |
|
|
|
AND mt.introduce LIKE CONCAT('%', #{introduce}, '%') |
|
|
|
</if> |
|
|
|
<if test="state != null and state != ''" > |
|
|
|
<if test="state != null and state != ''"> |
|
|
|
and mt.state = #{state} |
|
|
|
</if> |
|
|
|
<if test="parentId != null"> |
|
|
|
@ -98,7 +98,7 @@ |
|
|
|
<!-- 根据父类查询数据 --> |
|
|
|
<select id="findMaterialTypeByParent" resultMap="materialTypeMap" parameterType="long"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt |
|
|
|
WHERE mt.parentId = #{parentId} |
|
|
|
</select> |
|
|
|
@ -106,7 +106,7 @@ |
|
|
|
<!-- 根据主键批量获取数据 --> |
|
|
|
<select id="findMaterialTypeByOldIds" resultMap="materialTypeMap" parameterType="list"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt |
|
|
|
WHERE mt.oldId in |
|
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
|
@ -119,14 +119,19 @@ |
|
|
|
<!-- 根据主键查询数据 --> |
|
|
|
<select id="findMaterialTypeById" resultMap="materialTypeMap" parameterType="integer"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt WHERE mt.oldId = #{id} and mt.state != 3 and mt.state != 4 |
|
|
|
</select> |
|
|
|
<select id="findMaterialTypeByName" resultMap="materialTypeMap" parameterType="string"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt WHERE mt.tname = #{name} and mt.state != 3 and mt.state != 4 group by tname |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 根据主键查询数据 --> |
|
|
|
<select id="findMaterialTypeByOldId" resultMap="materialTypeMap" parameterType="long"> |
|
|
|
SELECT |
|
|
|
<include refid="allColumns" /> |
|
|
|
<include refid="allColumns"/> |
|
|
|
FROM material_type mt WHERE mt.oldId = #{oldId} and mt.state != 3 and mt.state != 4 |
|
|
|
</select> |
|
|
|
<!-- 根据主键查询数据 |
|
|
|
@ -216,7 +221,7 @@ |
|
|
|
DELETE FROM material_type WHERE oldId = #{id} |
|
|
|
</delete> |
|
|
|
|
|
|
|
<!-- 根据主键批量删除数据--> |
|
|
|
<!-- 根据主键批量删除数据--> |
|
|
|
<delete id="deleteMaterialTypeByIds" parameterType="list"> |
|
|
|
DELETE FROM material_type WHERE oldId IN |
|
|
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
|
|
|
@ -224,7 +229,7 @@ |
|
|
|
</foreach> |
|
|
|
</delete> |
|
|
|
|
|
|
|
<!-- 根据主键将状态改为删除--> |
|
|
|
<!-- 根据主键将状态改为删除--> |
|
|
|
<update id="changeStateToDeletedById" parameterType="int"> |
|
|
|
update material_type |
|
|
|
<set> |
|
|
|
@ -234,7 +239,7 @@ |
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据主键批量将状态改为删除--> |
|
|
|
<!-- 根据主键批量将状态改为删除--> |
|
|
|
<update id="changeStateToDeletedByIds" parameterType="list"> |
|
|
|
update material_type |
|
|
|
<set> |
|
|
|
|