774 lines
20 KiB
XML
774 lines
20 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.bonus.sgzb.app.mapper.BackReceiveMapper">
|
|
<resultMap id="BaseResultMap" type="com.bonus.sgzb.app.domain.BmAgreementInfo">
|
|
<!--@mbg.generated-->
|
|
<!--@Table bm_agreement_info-->
|
|
<id column="agreement_id" jdbcType="INTEGER" property="agreementId" />
|
|
<result column="agreement_code" jdbcType="VARCHAR" property="agreementCode" />
|
|
<result column="sign_time" jdbcType="VARCHAR" property="signTime" />
|
|
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
|
<result column="project_id" jdbcType="INTEGER" property="projectId" />
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
|
<result column="lease_day" jdbcType="INTEGER" property="leaseDay" />
|
|
<result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" />
|
|
<result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
|
|
<result column="auth_person" jdbcType="VARCHAR" property="authPerson" />
|
|
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
<result column="company_id" jdbcType="INTEGER" property="companyId" />
|
|
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
|
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
|
<result column="lot_id" jdbcType="INTEGER" property="lotId" />
|
|
<result column="lot_name" jdbcType="VARCHAR" property="lotName" />
|
|
|
|
</resultMap>
|
|
<insert id="addWxTask" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.app.domain.TmTask" useGeneratedKeys="true">
|
|
insert into tm_task
|
|
(
|
|
<if test="taskType != null">
|
|
task_type,
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
task_status,
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
code,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
update_by,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
) values (
|
|
<if test="taskType != null">
|
|
#{taskType},
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
#{taskStatus},
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
#{code},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertTt" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.app.domain.TmTask" useGeneratedKeys="true">
|
|
insert into tm_task
|
|
(
|
|
<if test="taskType != null">
|
|
task_type,
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
task_status,
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
code,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
update_by,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
) values (
|
|
<if test="taskType != null">
|
|
#{taskType},
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
#{taskStatus},
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
#{code},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="addWxTaskAgreement">
|
|
insert into tm_task_agreement
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="agreementId != null">
|
|
agreement_id,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
update_by,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
) values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="agreementId != null">
|
|
#{agreementId},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertTta">
|
|
insert into tm_task_agreement
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="agreementId != null">
|
|
agreement_id,
|
|
</if>
|
|
create_time
|
|
) values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="agreementId != null">
|
|
#{agreementId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertRad">
|
|
insert into repair_apply_details
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="maId != null">
|
|
ma_id,
|
|
</if>
|
|
<if test="typeId != null">
|
|
type_id,
|
|
</if>
|
|
<if test="backNum != null">
|
|
repair_num,
|
|
</if>
|
|
<if test="status != null">
|
|
status,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
update_by,
|
|
</if>
|
|
update_time,
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
<if test="id != null">
|
|
back_id,
|
|
</if>
|
|
create_time
|
|
)
|
|
values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="maId != null">
|
|
#{maId},
|
|
</if>
|
|
<if test="typeId != null">
|
|
#{typeId},
|
|
</if>
|
|
<if test="backNum != null">
|
|
#{backNum},
|
|
</if>
|
|
<if test="status != null">
|
|
#{status},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
NOW(),
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
<if test="id != null">
|
|
#{id},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertCheckDetails">
|
|
insert into back_check_details
|
|
(
|
|
<if test="parentId != null">
|
|
parent_id,
|
|
</if>
|
|
<if test="typeId != null">
|
|
type_id,
|
|
</if>
|
|
<if test="maId != null">
|
|
ma_id,
|
|
</if>
|
|
<if test="backNum != null">
|
|
back_num,
|
|
</if>
|
|
<if test="backStatus != null">
|
|
back_status,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
update_by,
|
|
</if>
|
|
update_time,
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
)
|
|
values (
|
|
<if test="parentId != null">
|
|
#{parentId},
|
|
</if>
|
|
<if test="typeId != null">
|
|
#{typeId},
|
|
</if>
|
|
<if test="maId != null">
|
|
#{maId},
|
|
</if>
|
|
<if test="backNum != null">
|
|
#{backNum},
|
|
</if>
|
|
<if test="backStatus != null">
|
|
#{backStatus},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
NOW(),
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="setInputApplyDetails">
|
|
insert into input_apply_details
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="maId != null">
|
|
ma_id,
|
|
</if>
|
|
<if test="typeId != null">
|
|
type_id,
|
|
</if>
|
|
<if test="parentId != null">
|
|
parent_id,
|
|
</if>
|
|
<if test="inputNum != null">
|
|
input_num,
|
|
</if>
|
|
input_type,
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
update_by,
|
|
</if>
|
|
update_time,
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
)
|
|
values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="maId != null">
|
|
#{maId},
|
|
</if>
|
|
<if test="typeId != null">
|
|
#{typeId},
|
|
</if>
|
|
<if test="parentId != null">
|
|
#{parentId},
|
|
</if>
|
|
<if test="inputNum != null">
|
|
#{inputNum},
|
|
</if>
|
|
'2',
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
NOW(),
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertIad">
|
|
insert into input_apply_details
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="maId != null">
|
|
ma_id,
|
|
</if>
|
|
<if test="typeId != null">
|
|
type_id,
|
|
</if>
|
|
<if test="parentId != null">
|
|
parent_id,
|
|
</if>
|
|
<if test="backNum != null">
|
|
input_num,
|
|
</if>
|
|
input_type,
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
update_by,
|
|
</if>
|
|
update_time,
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
)
|
|
values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="maId != null">
|
|
#{maId},
|
|
</if>
|
|
<if test="typeId != null">
|
|
#{typeId},
|
|
</if>
|
|
<if test="parentId != null">
|
|
#{parentId},
|
|
</if>
|
|
<if test="backNum != null">
|
|
#{backNum},
|
|
</if>
|
|
'2',
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
NOW(),
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertSad">
|
|
insert into scrap_apply_details
|
|
(
|
|
<if test="taskId != null">
|
|
task_id,
|
|
</if>
|
|
<if test="parentId != null">
|
|
parent_id,
|
|
</if>
|
|
<if test="maId != null">
|
|
ma_id,
|
|
</if>
|
|
<if test="typeId != null">
|
|
type_id,
|
|
</if>
|
|
<if test="backNum != null">
|
|
scrap_num,
|
|
</if>
|
|
scrap_source,
|
|
status,
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by,
|
|
</if>
|
|
<if test="companyId != null">
|
|
company_id,
|
|
</if>
|
|
create_time
|
|
)
|
|
values (
|
|
<if test="taskId != null">
|
|
#{taskId},
|
|
</if>
|
|
<if test="parentId != null">
|
|
#{parentId},
|
|
</if>
|
|
<if test="maId != null">
|
|
#{maId},
|
|
</if>
|
|
<if test="typeId != null">
|
|
#{typeId},
|
|
</if>
|
|
<if test="backNum != null">
|
|
#{backNum},
|
|
</if>
|
|
'1',
|
|
'0',
|
|
<if test="createBy != null and createBy != ''">
|
|
#{createBy},
|
|
</if>
|
|
<if test="companyId != null">
|
|
#{companyId},
|
|
</if>
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
|
|
<update id="updateTaskStatus">
|
|
update tm_task
|
|
set task_status=#{status}
|
|
where task_id = #{taskId}
|
|
</update>
|
|
<update id="updateMaStatus">
|
|
update ma_machine
|
|
set ma_status=#{maStatus}
|
|
where ma_id = #{maId}
|
|
</update>
|
|
|
|
<update id="updateMt">
|
|
UPDATE ma_type
|
|
SET num = (IFNULL(num, 0)) + #{backNum}
|
|
WHERE type_id = #{typeId}
|
|
</update>
|
|
|
|
<select id="getbackReceiveList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
bai.id,
|
|
bai.`code`,
|
|
bai.task_id as taskId,
|
|
bai.back_person as backPerson,
|
|
bai.phone,
|
|
bpl.lot_id,
|
|
bpl.lot_name as lotName,
|
|
bui.unit_id as unitId,
|
|
bui.unit_name as unitName,
|
|
bai.back_time as backTime,
|
|
tt.task_status as taskStatus,
|
|
tta.agreement_id as agreementId,
|
|
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
|
|
GROUP_CONCAT(mt2.type_name, '') AS typeName
|
|
FROM
|
|
back_apply_info bai
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
|
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
|
|
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
|
|
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id=mt2.parent_id
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id=mt3.parent_id
|
|
WHERE
|
|
tt.task_status in (38,39,40)
|
|
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
|
ORDER BY tt.task_status asc ,bai.create_time desc
|
|
</select>
|
|
|
|
<select id="receiveView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
bai.id,
|
|
bai.task_id as taskId,
|
|
tta.agreement_id as agreementId,
|
|
mt.type_id as typeId,
|
|
mt.type_name typeCode,
|
|
mt2.type_name AS typeName,
|
|
IFNULL(bad.audit_num,0)-(IFNULL(aa.back_num,0)) as num,
|
|
mt.manage_type as manageType,
|
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
|
FROM
|
|
back_apply_details bad
|
|
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
|
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
|
LEFT JOIN (
|
|
SELECT
|
|
type_id as typeId,
|
|
SUM(IFNULL(back_num,0)) as back_num
|
|
FROM
|
|
back_check_details
|
|
WHERE
|
|
parent_id=#{id}
|
|
GROUP BY type_id
|
|
) aa on aa.typeId=bad.type_id
|
|
WHERE
|
|
bai.id=#{id}
|
|
</select>
|
|
|
|
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
|
|
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
|
|
</select>
|
|
<select id="getHgList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
tta.agreement_id as agreementId,
|
|
bai.id,
|
|
bai.task_id as taskId,
|
|
bcd.type_id as typeId,
|
|
bcd.back_num as backNum,
|
|
bcd.parent_id as parentId,
|
|
bcd.create_by as createBy,
|
|
bcd.ma_id as maId,
|
|
bai.company_id as companyId
|
|
FROM
|
|
back_check_details bcd
|
|
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
|
WHERE
|
|
parent_id=#{parentId}
|
|
and bcd.back_status='1'
|
|
|
|
</select>
|
|
|
|
<select id="getWxList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
tta.agreement_id as agreementId,
|
|
bai.id,
|
|
bai.task_id as taskId,
|
|
bcd.type_id as typeId,
|
|
bcd.back_num as backNum,
|
|
bcd.parent_id as parentId,
|
|
bcd.create_by as createBy,
|
|
bcd.ma_id as maId,
|
|
bai.company_id as companyId
|
|
FROM
|
|
back_check_details bcd
|
|
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
|
WHERE
|
|
parent_id=#{parentId}
|
|
and bcd.back_status='2'
|
|
</select>
|
|
|
|
<select id="getBfList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
tta.agreement_id as agreementId,
|
|
bai.id,
|
|
bai.task_id as taskId,
|
|
bcd.type_id as typeId,
|
|
bcd.back_num as backNum,
|
|
bcd.parent_id as parentId,
|
|
bcd.create_by as createBy,
|
|
bcd.ma_id as maId,
|
|
bai.company_id as companyId
|
|
FROM
|
|
back_check_details bcd
|
|
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
|
WHERE
|
|
parent_id=#{parentId}
|
|
and bcd.back_status='3'
|
|
</select>
|
|
|
|
<select id="codeQuery" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
mt.type_id as typeId,
|
|
mm.ma_id as maId,
|
|
mm.ma_code as maCode,
|
|
mt.type_name as typeCode,
|
|
mt2.type_name as typeName,
|
|
sd.`name` as sdStatus
|
|
FROM
|
|
ma_machine mm
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
|
|
WHERE
|
|
ma_code LIKE concat('%', #{maCode}, '%')
|
|
and sd.id='16'
|
|
</select>
|
|
|
|
<select id="qrcodeQuery" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
mt.type_id as typeId,
|
|
mm.ma_id as maId,
|
|
mm.ma_code as maCode,
|
|
mt.type_name as typeCode,
|
|
mt2.type_name as typeName,
|
|
sd.`name` as sdStatus
|
|
FROM
|
|
ma_machine mm
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
|
|
WHERE
|
|
qr_code =#{qrCode}
|
|
</select>
|
|
<select id="backReceiveRecord" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
mt2. type_name as typeName,
|
|
mt1.type_name as typeCode,
|
|
bcd.back_num as backNum,
|
|
mm.ma_code as maCode,
|
|
bcd.create_time as backTime,
|
|
bcd.back_status as backStatus
|
|
FROM
|
|
back_check_details bcd
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
LEFT JOIN ma_machine mm on mm.ma_id=bcd.ma_id
|
|
WHERE bcd.parent_id=#{parentId}
|
|
ORDER BY
|
|
bcd.create_time DESC
|
|
</select>
|
|
<select id="selectCodeByMaIdAndTaskId" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
back_check_details cbd
|
|
LEFT JOIN back_apply_info bai ON bai.id = cbd.parent_id
|
|
WHERE
|
|
cbd.ma_id = #{maId}
|
|
AND bai.task_id = #{taskId}
|
|
</select>
|
|
|
|
<select id="rfidCodeQuery" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
|
SELECT
|
|
mt.type_id as typeId,
|
|
mm.ma_id as maId,
|
|
mm.ma_code as maCode,
|
|
mt.type_name as typeCode,
|
|
mt2.type_name as typeName,
|
|
sd.`name` as sdStatus
|
|
FROM
|
|
ma_machine mm
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
|
|
WHERE
|
|
rfid_code =#{rfidCode}
|
|
</select>
|
|
|
|
|
|
</mapper> |