| | |
| | | <?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.yuanchu.mom.mapper.InspectionItemMapper"> |
| | | <!--把原有的检验项目的数据清空--> |
| | | <update id="updateBatch"> |
| | | UPDATE mom_ocean.inspection_item o |
| | | <trim prefix="set" suffixOverrides=","> |
| | | <trim prefix="inspection_value=case" suffix="end,"> |
| | | <foreach collection="inspectionItems" item="item" index="index"> |
| | | WHEN o.id = #{item.id} THEN null |
| | | </foreach> |
| | | </trim> |
| | | <trim prefix="device_id=case" suffix="end,"> |
| | | <foreach collection="inspectionItems" item="item" index="index"> |
| | | WHEN o.id = #{item.id} THEN null |
| | | </foreach> |
| | | </trim> |
| | | <trim prefix="result=case" suffix="end,"> |
| | | <foreach collection="inspectionItems" item="item" index="index"> |
| | | WHEN o.id = #{item.id} THEN null |
| | | </foreach> |
| | | </trim> |
| | | <trim prefix="username=case" suffix="end,"> |
| | | <foreach collection="inspectionItems" item="item" index="index"> |
| | | WHEN o.id = #{item.id} THEN null |
| | | </foreach> |
| | | </trim> |
| | | </trim> |
| | | WHERE o.id in |
| | | <foreach collection="inspectionItems" index="index" item="item" separator="," open="(" close=")"> |
| | | #{item.id, jdbcType=BIGINT} |
| | | </foreach> |
| | | </update> |
| | | <resultMap id="selectInspectionItemMap" type="inspectionItemDto"> |
| | | <id property="father" column="ifather"/> |
| | | <association property="children" resultMap="selectInspectionItemDto2Map"/> |
| | |
| | | <result property="internal" column="internal"/> |
| | | <result property="required" column="required"/> |
| | | <result property="inspectionValue" column="inspection_value"/> |
| | | <result property="did" column="did"/> |
| | | <result property="dname" column="dname"/> |
| | | <result property="result" column="result"/> |
| | | <result property="username" column="username"/> |
| | | </resultMap> |
| | | <select id="selectInspectionItem" resultMap="selectInspectionItemMap"> |
| | | SELECT i.`id`, |
| | | i.`father` ifather, |
| | | i.`father` ifather, |
| | | i.`name`, |
| | | i.`unit`, |
| | | i.`internal`, |
| | | i.`required`, |
| | | i.`inspection_value`, |
| | | device.name dname, |
| | | device.id did, |
| | | device.name dname, |
| | | i.`result`, |
| | | username |
| | | FROM mom_ocean.inspection_item i |