| | |
| | | <resultMap type="com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo" id="materialResult"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="serial_num" property="serialNum" jdbcType="VARCHAR"/> |
| | | <result column="material_classify_id" property="materialClassifyId" jdbcType="BIGINT"/> |
| | | <result column="big_classify_id" property="bigClassifyId" jdbcType="BIGINT"/> |
| | | <result column="small_classify_id" property="smallClassifyId" jdbcType="BIGINT"/> |
| | | <result column="dep_id" property="depId" jdbcType="BIGINT"/> |
| | | <result column="dep_name" property="depName" jdbcType="VARCHAR"/> |
| | | <result column="material_name" property="materilaName" jdbcType="VARCHAR"/> |
| | |
| | | </resultMap> |
| | | <!--查询单条数据--> |
| | | <select id="queryById" resultMap="materialResult"> |
| | | select id,serial_num,material_classify_id,dep_id,dep_name,material_name,consumable,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material where id = #{id} and del_flag = 0; |
| | | select id,serial_num,small_classify_id,big_classify_id,dep_id,dep_name,material_name,consumable,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material where id = #{id} and del_flag = 0; |
| | | </select> |
| | | <!--查询所有数量--> |
| | | <select id="getTotalCount" resultType="java.lang.Integer"> |
| | | select count(1) from safe_material; |
| | | </select> |
| | | <!--根据类型统计数量--> |
| | | <select id="getCountByClassify" resultType="java.lang.Integer"> |
| | | select count(1) from safe_material where del_flag = 0 and material_classify_id = #{classifyId} |
| | | <!--根据小类型统计数量--> |
| | | <select id="getCountBySmallClassifyId" resultType="java.lang.Integer"> |
| | | select count(1) from safe_material where del_flag = 0 and small_classify_id = #{smallClassifyId} |
| | | </select> |
| | | <update id="deleteBatch"> |
| | | update safe_material set del_flag = 1 where id in |
| | |
| | | <select id="listByConditions" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDO"> |
| | | select m.id, |
| | | m.serial_num, |
| | | m.material_classify_id, |
| | | m.big_classify_id as bigClassifyId, |
| | | m.small_classify_id as smallClassifyId, |
| | | m.dep_id, |
| | | m.dep_name, |
| | | m.material_name, |
| | | m.consumable, |
| | | c.material_classify_name |
| | | c.material_classify_name as bigClassifyName |
| | | from safe_material m |
| | | inner join safe_material_classify c |
| | | on m.material_classify_id = c.id |
| | | on m.big_classify_id = c.id |
| | | where m.del_flag = 0 |
| | | <if test="query.materialName != null and query.materialName != '' "> |
| | | and instr(m.material_name,#{query.materialName})>0 |
| | | </if> |
| | | <if test="query.materialClassifyId != null"> |
| | | and m.material_classify_id = #{query.materialClassifyId} |
| | | <if test="query.bigClassifyId != null"> |
| | | and m.big_classify_id = #{query.bigClassifyId} |
| | | </if> |
| | | order by m.create_time desc |
| | | </select> |
| | | |
| | | <select id="checkMatrial" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from safe_material |
| | | where del_flag = 0 |
| | | and small_classify_id = #{smallClassifyId} |
| | | and dep_id = #{depId} |
| | | <if test="id != null"> |
| | | and id != #{id} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |