|
|
|
@ -23,109 +23,129 @@
|
|
|
|
|
<result property="updatedBy" column="updated_by"/>
|
|
|
|
|
<result property="updatedTime" column="updated_time"/>
|
|
|
|
|
<result property="factoryCode" column="factory_code"/>
|
|
|
|
|
<result property="teamCode" column="TEAM_CODE"/>
|
|
|
|
|
<result property="teamName" column="TEAM_NAME"/>
|
|
|
|
|
<result property="assetCode" column="ASSET_CODE"/>
|
|
|
|
|
<result property="productLineName" column="PRODUCT_LINE_NAME"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectBaseDeviceLedgerVo">
|
|
|
|
|
select obj_id,
|
|
|
|
|
device_code,
|
|
|
|
|
device_name,
|
|
|
|
|
device_model,
|
|
|
|
|
device_type,
|
|
|
|
|
device_address,
|
|
|
|
|
device_status,
|
|
|
|
|
used_department,
|
|
|
|
|
cost_center,
|
|
|
|
|
manufacturer,
|
|
|
|
|
enable_date,
|
|
|
|
|
product_line_code,
|
|
|
|
|
factory_code,
|
|
|
|
|
is_flag,
|
|
|
|
|
created_by,
|
|
|
|
|
created_time,
|
|
|
|
|
updated_by,
|
|
|
|
|
updated_time
|
|
|
|
|
from base_deviceledger
|
|
|
|
|
select dl.OBJ_ID,
|
|
|
|
|
dl.DEVICE_CODE,
|
|
|
|
|
dl.DEVICE_NAME,
|
|
|
|
|
dl.DEVICE_MODEL,
|
|
|
|
|
dl.DEVICE_TYPE,
|
|
|
|
|
dl.DEVICE_ADDRESS,
|
|
|
|
|
dl.DEVICE_STATUS,
|
|
|
|
|
dl.USED_DEPARTMENT,
|
|
|
|
|
dl.COST_CENTER,
|
|
|
|
|
dl.MANUFACTURER,
|
|
|
|
|
dl.ENABLE_DATE,
|
|
|
|
|
dl.PRODUCT_LINE_CODE,
|
|
|
|
|
dl.IS_FLAG,
|
|
|
|
|
dl.CREATED_BY,
|
|
|
|
|
dl.CREATED_TIME,
|
|
|
|
|
dl.UPDATED_BY,
|
|
|
|
|
dl.UPDATED_TIME,
|
|
|
|
|
dl.FACTORY_CODE,
|
|
|
|
|
dl.TEAM_CODE,
|
|
|
|
|
CASE
|
|
|
|
|
WHEN te.TEAM_NAME IS NOT NULL THEN SUBSTR(te.TEAM_NAME, 1, LENGTH(te.TEAM_NAME) - 3) || '班组'
|
|
|
|
|
END TEAM_NAME,
|
|
|
|
|
dl.ASSET_CODE,
|
|
|
|
|
pl.PRODUCT_LINE_NAME
|
|
|
|
|
from base_deviceledger dl
|
|
|
|
|
left join BASE_PRODUCTLINE pl on pl.PRODUCT_LINE_CODE = dl.PRODUCT_LINE_CODE
|
|
|
|
|
left join BASE_TEAMMEMBERS te on te.TEAM_CODE = dl.TEAM_CODE
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseDeviceLedgerList" parameterType="BaseDeviceLedger" resultMap="BaseDeviceLedgerResult">
|
|
|
|
|
<include refid="selectBaseDeviceLedgerVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''">and device_name like concat(concat('%', #{deviceName}),
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">and dl.device_code = #{deviceCode}</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''">and dl.device_name like concat(concat('%', #{deviceName}),
|
|
|
|
|
'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deviceModel != null and deviceModel != ''">and device_model = #{deviceModel}</if>
|
|
|
|
|
<if test="deviceType != null ">and device_type = #{deviceType}</if>
|
|
|
|
|
<if test="deviceAddress != null and deviceAddress != ''">and device_address = #{deviceAddress}</if>
|
|
|
|
|
<if test="deviceStatus != null ">and device_status = #{deviceStatus}</if>
|
|
|
|
|
<if test="usedDepartment != null and usedDepartment != ''">and used_department = #{usedDepartment}</if>
|
|
|
|
|
<if test="productLineCode != null and productLineCode != ''">and product_line_code = #{productLineCode}
|
|
|
|
|
<if test="deviceModel != null and deviceModel != ''">and dl.device_model = #{deviceModel}</if>
|
|
|
|
|
<if test="deviceType != null ">and dl.device_type = #{deviceType}</if>
|
|
|
|
|
<if test="deviceAddress != null and deviceAddress != ''">and dl.device_address = #{deviceAddress}</if>
|
|
|
|
|
<if test="deviceStatus != null ">and dl.device_status = #{deviceStatus}</if>
|
|
|
|
|
<if test="usedDepartment != null and usedDepartment != ''">and dl.used_department = #{usedDepartment}</if>
|
|
|
|
|
<if test="productLineCode != null and productLineCode != ''">and dl.product_line_code = #{productLineCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isFlag != null ">and is_flag = #{isFlag}</if>
|
|
|
|
|
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if>
|
|
|
|
|
<if test="createdTime != null ">and created_time = #{createdTime}</if>
|
|
|
|
|
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
|
|
|
|
|
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
|
|
|
|
|
<if test="isFlag != null ">and dl.is_flag = #{isFlag}</if>
|
|
|
|
|
<if test="teamCode != null and teamCode != ''">and dl.TEAM_CODE = #{teamCode}</if>
|
|
|
|
|
<if test="createdTime != null ">and dl.created_time = #{createdTime}</if>
|
|
|
|
|
<if test="updatedBy != null and updatedBy != ''">and dl.updated_by = #{updatedBy}</if>
|
|
|
|
|
<if test="updatedTime != null ">and dl.updated_time = #{updatedTime}</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by device_code
|
|
|
|
|
order by dl.PRODUCT_LINE_CODE,device_code
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseDeviceLedgerByObjId" parameterType="Long" resultMap="BaseDeviceLedgerResult">
|
|
|
|
|
<include refid="selectBaseDeviceLedgerVo"/>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
where dl.obj_id = #{objId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeviceCode" resultType="java.lang.String">
|
|
|
|
|
SELECT MAX(DEVICE_CODE) DEVICE_CODE
|
|
|
|
|
from base_deviceledger
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBaseDeviceLedger" parameterType="BaseDeviceLedger">
|
|
|
|
|
<insert id="insertBaseDeviceledger" parameterType="BaseDeviceledger">
|
|
|
|
|
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
|
|
|
|
SELECT seq_base_deviceledger.NEXTVAL as objId FROM DUAL
|
|
|
|
|
</selectKey>
|
|
|
|
|
insert into base_deviceledger
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">obj_id,</if>
|
|
|
|
|
<if test="deviceCode != null">device_code,</if>
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">device_code,</if>
|
|
|
|
|
<if test="deviceName != null">device_name,</if>
|
|
|
|
|
<if test="deviceModel != null">device_model,</if>
|
|
|
|
|
<if test="deviceType != null">device_type,</if>
|
|
|
|
|
<if test="deviceAddress != null">device_address,</if>
|
|
|
|
|
<if test="deviceStatus != null">device_status,</if>
|
|
|
|
|
<if test="usedDepartment != null">used_department,</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code,</if>
|
|
|
|
|
<if test="costCenter != null">cost_center,</if>
|
|
|
|
|
<if test="manufacturer != null">manufacturer,</if>
|
|
|
|
|
<if test="enableDate != null">enable_date,</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code,</if>
|
|
|
|
|
<if test="isFlag != null">is_flag,</if>
|
|
|
|
|
<if test="createdBy != null">created_by,</if>
|
|
|
|
|
<if test="createdTime != null">created_time,</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by,</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time,</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
|
<if test="teamCode != null">team_code,</if>
|
|
|
|
|
<if test="assetCode != null">asset_code,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">#{objId},</if>
|
|
|
|
|
<if test="deviceCode != null">#{deviceCode},</if>
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
|
|
|
|
<if test="deviceName != null">#{deviceName},</if>
|
|
|
|
|
<if test="deviceModel != null">#{deviceModel},</if>
|
|
|
|
|
<if test="deviceType != null">#{deviceType},</if>
|
|
|
|
|
<if test="deviceAddress != null">#{deviceAddress},</if>
|
|
|
|
|
<if test="deviceStatus != null">#{deviceStatus},</if>
|
|
|
|
|
<if test="usedDepartment != null">#{usedDepartment},</if>
|
|
|
|
|
<if test="productLineCode != null">#{productLineCode},</if>
|
|
|
|
|
<if test="costCenter != null">#{costCenter},</if>
|
|
|
|
|
<if test="manufacturer != null">#{manufacturer},</if>
|
|
|
|
|
<if test="enableDate != null">#{enableDate},</if>
|
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
|
<if test="productLineCode != null">#{productLineCode},</if>
|
|
|
|
|
<if test="isFlag != null">#{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">#{createdBy},</if>
|
|
|
|
|
<if test="createdTime != null">#{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
|
<if test="teamCode != null">#{teamCode},</if>
|
|
|
|
|
<if test="assetCode != null">#{assetCode},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateBaseDeviceLedger" parameterType="BaseDeviceLedger">
|
|
|
|
|
<update id="updateBaseDeviceledger" parameterType="BaseDeviceledger">
|
|
|
|
|
update base_deviceledger
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
|
|
|
|
<if test="deviceName != null">device_name = #{deviceName},</if>
|
|
|
|
|
<if test="deviceModel != null">device_model = #{deviceModel},</if>
|
|
|
|
|
<if test="deviceType != null">device_type = #{deviceType},</if>
|
|
|
|
@ -136,12 +156,14 @@
|
|
|
|
|
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
|
|
|
|
|
<if test="enableDate != null">enable_date = #{enableDate},</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
|
|
|
|
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">created_by = #{createdBy},</if>
|
|
|
|
|
<if test="createdTime != null">created_time = #{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
|
|
|
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
|
|
|
|
<if test="assetCode != null">asset_code = #{assetCode},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</update>
|
|
|
|
|