feat: xml优化

dev_2.5_ocean
chenhc 4 months ago
parent 7ca8141624
commit d5af216f75

@ -29,12 +29,19 @@
createUser,createTime
</sql>
<select id="listByVo" resultType="com.glxp.api.vo.dev.DeviceChangeOrderVo">
select IFNULL(saf.status,1) as flowStatus,saf.updateTime as flowAuditTime,saf.updateUserName as flowAuditByName,
o.*,
(select name from auth_dept where code = o.deptCode) deptName,
(select name from auth_dept where code = o.toDeptCode) toDeptName
from device_change_order o
Left Join sys_approval_flow as saf ON o.approvalFlowId = saf.id
SELECT IFNULL(saf.status, 1) AS flowStatus,
saf.updateTime AS flowAuditTime,
saf.updateUserName AS flowAuditByName,
o.*,
ad_dept.name AS deptName,
ad_toDept.name AS toDeptName
FROM device_change_order AS o
LEFT JOIN
sys_approval_flow AS saf ON o.approvalFlowId = saf.id
LEFT JOIN
auth_dept AS ad_dept ON ad_dept.code = o.deptCode
LEFT JOIN
auth_dept AS ad_toDept ON ad_toDept.code = o.toDeptCode
<where>
and o.status != 'temp'
and (o.deptCode = #{user.locDeptCode} or o.toDeptCode = #{user.locDeptCode})
@ -58,10 +65,14 @@
</select>
<select id="getVoById" resultType="com.glxp.api.vo.dev.DeviceChangeOrderVo">
select o.*,
(select name from auth_dept where code = o.deptCode) deptName,
(select name from auth_dept where code = o.toDeptCode) toDeptName
from device_change_order o
SELECT o.*,
ad_dept.name AS deptName,
ad_toDept.name AS toDeptName
FROM device_change_order AS o
LEFT JOIN
auth_dept AS ad_dept ON ad_dept.code = o.deptCode
LEFT JOIN
auth_dept AS ad_toDept ON ad_toDept.code = o.toDeptCode
where o.orderId = #{orderId}
</select>

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.dev.DeviceInspectOrderDao">
<select id="filterList" resultType="com.glxp.api.res.dev.DeviceInspectOrderResponse">
select t.id,
SELECT t.id,
t.orderId,
t.deptCode,
t.invCode,
@ -12,20 +12,28 @@
t.deviceStatus,
t.lastOrderId,
t.createUser,
au_create.employeeName AS createUserName,
t.auditUser,
au_audit.employeeName AS auditUserName,
t.createTime,
t.auditUser,
t.auditTime,
t.remark,
(select employeeName from auth_user where id = t.createUser) createUserName,
(select employeeName from auth_user where id = t.auditUser) auditUserName,
(select `name` from auth_dept where code = t.deptCode) deptName,
(select `name` from auth_warehouse where code = t.invCode) invName,
ad_dept.name AS deptName,
aw_inv.name AS invName,
t1.deviceName,
t1.ggxh,
t1.batchNo
from device_inspect_order t
left join dept_device_detail t1 on t.code = t1.code
FROM device_inspect_order AS t
LEFT JOIN
dept_device_detail AS t1 ON t.code = t1.code
LEFT JOIN
auth_user AS au_create ON t.createUser = au_create.id
LEFT JOIN
auth_user AS au_audit ON t.auditUser = au_audit.id
LEFT JOIN
auth_dept AS ad_dept ON t.deptCode = ad_dept.code
LEFT JOIN
auth_warehouse AS aw_inv ON t.invCode = aw_inv.code
<where>
<if test="orderId != null and orderId != ''">
AND t.orderId like concat('%', #{orderId}, '%')

@ -8,7 +8,7 @@
</select>
<select id="filterList" resultType="com.glxp.api.res.dev.DeviceInspectPlanResponse">
select t.id,
SELECT t.id,
t.orderId,
t.deptCode,
t.invCode,
@ -16,9 +16,10 @@
t.level,
t.status,
t.createUser,
au_create.employeeName AS createUserName,
t.auditUser,
au_audit.employeeName AS auditUserName,
t.createTime,
t.auditUser,
t.auditTime,
t.remark,
t.startTime,
@ -29,15 +30,22 @@
t.inspectUser,
t.lastTime,
t.nextTime,
(select employeeName from auth_user where id = t.createUser) createUserName,
(select employeeName from auth_user where id = t.auditUser) auditUserName,
(select `name` from auth_dept where code = t.deptCode) deptName,
(select `name` from auth_warehouse where code = t.invCode) invName,
ad_dept.name AS deptName,
aw_inv.name AS invName,
t1.deviceName,
t1.ggxh,
t1.batchNo
from device_inspect_plan t
left join dept_device_detail t1 on t.code = t1.code
FROM device_inspect_plan AS t
LEFT JOIN
dept_device_detail AS t1 ON t.code = t1.code
LEFT JOIN
auth_user AS au_create ON t.createUser = au_create.id
LEFT JOIN
auth_user AS au_audit ON t.auditUser = au_audit.id
LEFT JOIN
auth_dept AS ad_dept ON t.deptCode = ad_dept.code
LEFT JOIN
auth_warehouse AS aw_inv ON t.invCode = aw_inv.code
<where>
<if test="orderId != null and orderId != ''">
AND t.orderId like concat('%', #{orderId}, '%')

@ -2,17 +2,21 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.dev.DeviceInspectSetDao">
<select id="selectInspectSet" resultType="com.glxp.api.res.dev.DeviceInspectSetResponse">
select t.id,
SELECT t.id,
t.code,
t.frequency,
t.frequency,
t.frequencyUnit,
t.remark,
d.deviceName,
(select name from auth_dept where code = d.deptCode) deptName,
(select name from auth_warehouse where code = d.invCode) invName
from device_inspect_set t
left join dept_device_detail d on t.code = d.code
ad_dept.name AS deptName,
aw_inv.name AS invName
FROM device_inspect_set AS t
LEFT JOIN
dept_device_detail AS d ON t.code = d.code
LEFT JOIN
auth_dept AS ad_dept ON d.deptCode = ad_dept.code
LEFT JOIN
auth_warehouse AS aw_inv ON d.invCode = aw_inv.code
<where>
<if test="code != null and code != ''">
t.code = #{code}

@ -28,33 +28,39 @@
<select id="filterList" resultType="com.glxp.api.res.dev.DeviceInspectTakeResponse">
select
t.id,
t.orderId,
t.planOrderIdFk,
t.deptCode,
t.invCode,
t.code,
t.status,
t.inspectUser,
t.updateTime,
t.createTime,
t.endTime,
t.strartTime,
t.remark,
t.remindTime,
t.expectedTime,
t.repairType,
t.level,
(select `name` from auth_dept where code = t.deptCode) deptName,
(select `name` from auth_warehouse where code = t.invCode) invName,
( SELECT `employeeName` FROM auth_user WHERE id = t.inspectUser ) inspectName,
t1.deviceName,
t1.ggxh,
t1.batchNo,
t.type
from device_inspect_task t
left join dept_device_detail t1 on t.code = t1.code
SELECT t.id,
t.orderId,
t.planOrderIdFk,
t.deptCode,
t.invCode,
t.code,
t.status,
t.inspectUser,
t.updateTime,
t.createTime,
t.endTime,
t.strartTime,
t.remark,
t.remindTime,
t.expectedTime,
t.repairType,
t.level,
ad_dept.name AS deptName,
aw_inv.name AS invName,
au_inspect.employeeName AS inspectName,
t1.deviceName,
t1.ggxh,
t1.batchNo,
t.type
FROM device_inspect_task AS t
LEFT JOIN
dept_device_detail AS t1 ON t.code = t1.code
LEFT JOIN
auth_dept AS ad_dept ON t.deptCode = ad_dept.code
LEFT JOIN
auth_warehouse AS aw_inv ON t.invCode = aw_inv.code
LEFT JOIN
auth_user AS au_inspect ON t.inspectUser = au_inspect.id
<where>
<if test="orderId != null and orderId != ''">
AND t.orderId like concat('%', #{orderId}, '%')

@ -20,10 +20,14 @@
</sql>
<select id="filterList" resultType="com.glxp.api.res.dev.DeviceProjectSetResponse">
select device_project_set.*,
(select employeeName from auth_user where device_project_set.updateUser=auth_user.id) as updateUserName,
(select employeeName from auth_user where device_project_set.createUser=auth_user.id) as createUserName
from device_project_set
SELECT dps.*,
au_update.employeeName AS updateUserName,
au_create.employeeName AS createUserName
FROM device_project_set AS dps
LEFT JOIN
auth_user AS au_update ON dps.updateUser = au_update.id
LEFT JOIN
auth_user AS au_create ON dps.createUser = au_create.id
<where>
<if test="type != null">
AND type = #{type}

Loading…
Cancel
Save