integrated_traffic/src/main/resources/mybatis/datasource/eightwork/HoistingSignMapper.xml

141 lines
2.8 KiB
XML

<?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.zcloud.mapper.datasource.eightwork.HoistingSignMapper">
<!--表名 -->
<sql id="tableName">
BUS_HOISTING_SIGN
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.HOISTING_SIGN_ID,
f.HOISTING_ID,
f.CORPINFO_ID,
f.SIGN_USER_ID,
f.SIGN_PATH,
f.SIGN_TIME,
f.DESCR,
f.STEP_ID,
f.IMG_PATH
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
HOISTING_SIGN_ID,
HOISTING_ID,
CORPINFO_ID,
SIGN_USER_ID,
SIGN_PATH,
SIGN_TIME,
DESCR,
STEP_ID,
IMG_PATH
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{HOISTING_SIGN_ID},
#{HOISTING_ID},
#{CORPINFO_ID},
#{SIGN_USER_ID},
#{SIGN_PATH},
#{SIGN_TIME},
#{DESCR},
#{STEP_ID},
#{IMG_PATH}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<insert id="saveBatch" parameterType="pd">
insert into
<include refid="tableName"></include>
(
HOISTING_SIGN_ID,
HOISTING_ID,
CORPINFO_ID,
SIGN_USER_ID,
STEP_ID
) values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.HOISTING_SIGN_ID},
#{item.HOISTING_ID},
#{item.CORPINFO_ID},
#{item.SIGN_USER_ID},
#{item.STEP_ID})
</foreach>
</insert>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
DESCR = #{DESCR},
SIGN_PATH = #{SIGN_PATH},
SIGN_TIME= #{SIGN_TIME},
IMG_PATH = #{IMG_PATH}
where
HOISTING_ID = #{HOISTING_ID} and SIGN_USER_ID = #{SIGN_USER_ID} and STEP_ID = #{STEP_ID}
</update>
<select id="listById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.HOISTING_ID = #{pd.HOISTING_ID}
order by f.SIGN_TIME desc
</select>
<select id="listAll" parameterType="pd" resultType="pd">
select
f.HOISTING_SIGN_ID,
f.HOISTING_ID,
f.CORPINFO_ID,
f.SIGN_USER_ID,
f.SIGN_PATH,
f.SIGN_TIME,
f.STEP_ID,
f.IMG_PATH,
IFNULL(f.DESCR,'无') as DESCR,
step.CODE
from
<include refid="tableName"></include> f
left join bus_eightwork_step step on step.STEP_ID = f.STEP_ID
where
f.HOISTING_ID = #{HOISTING_ID}
and
f.SIGN_TIME is not null
</select>
<select id="checkUnsigned" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.HOISTING_ID = #{HOISTING_ID}
and
f.SIGN_TIME is null
</select>
</mapper>