Mr.Shi
2023-08-17 a99b32aee78f130d44f5353b30b001f96c84977a
server/src/main/resources/mappers/PlansExtMapper.xml
@@ -123,7 +123,7 @@
  <select id="selectByModel" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultMap="PlansExtListVO">
  SELECT
  `a`.*
    ,(  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status !=6) AS workorderDistributNum
    ,ifnull((  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status = 4 ),0) AS workorderDistributNum
    from plans a
    <where>
    <if test="id != null">
@@ -363,11 +363,13 @@
      `usermodel`.`SYSTEMID` AS USERMODEL_SYSTEMID,
      `usermodel`.`INVALID_TIME` AS USERMODEL_INVALID_TIME,
      `usermodel`.`TYPE` AS USERMODEL_TYPE
    ,(  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id  and b.status !=6) AS workorderDistributNum ,
    , ifnull((  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0  AND b.PLAN_ID = a.id  and b.status !=6),0) AS workorderDistributNum ,
    `mmodel`.name as materialName , `mmodel`.code as materialCode ,`fmodel`.name as factoryName , `pmodel`.name as produceName ,
      concat(`usermodel`.realname,' ',`usermodel`.mobile) as planUserName , `umodel`.name as unitName ,
      w.PLAN_CODE as workPlanCode
      w.PLAN_CODE as workPlanCode , w.SALESORDER as salesOrder ,
      w.START_DATE as workPlanStartDate  , w.PLAN_DATE as workPlanEndDate,
      w.`PLAN_DATE` as workPlanPlanDate,
      ifnull((select  sum(worder.PLAN_NUM) from workorder worder where worder.PLAN_ID = a.id and worder.STATUS not in (7,8)  ),0) as produceNum
    FROM `plans` `a`
    LEFT JOIN `department` `dmodel` ON a.DEPART_ID=dmodel.ID
    LEFT JOIN `material_distribute` `mdmodel` ON a.MATERIAL_ID=mdmodel.ID
@@ -420,6 +422,12 @@
      </if>
      <if test="planDate != null">
        AND `a`.`PLAN_DATE` = #{planDate}
      </if>
      <if test="planDateStartDate != null and planDateStartDate != ''">
        AND `a`.`PLAN_DATE` >= concat(#{planDateStartDate},' 00:00:00')
      </if>
      <if test="planDateEndDate != null and planDateEndDate != ''">
        AND concat(#{planDateEndDate},' 23:59:59') >= `a`.`PLAN_DATE`
      </if>
      <if test="materialId != null">
        AND `a`.`MATERIAL_ID` = #{materialId}
@@ -763,12 +771,12 @@
      <if test="usermodelInvalidTime != null">
        AND `usermodel`.`INVALID_TIME` = #{usermodelInvalidTime}
      </if>
      <if test="startDate != null">
        AND `a`.`PLAN_DATE` >= #{startDate}
      </if>
      <if test="endDate != null">
        AND   #{endDate} >= `a`.`PLAN_DATE`
      </if>
<!--      <if test="startDate != null">-->
<!--        AND `a`.`PLAN_DATE` >= #{startDate}-->
<!--      </if>-->
<!--      <if test="endDate != null">-->
<!--        AND   #{endDate} >= `a`.`PLAN_DATE`-->
<!--      </if>-->
      <if test="mixParam != null and mixParam!=''">
        AND  (mmodel.name like concat('%',#{mixParam},'%') or mmodel.code like concat('%',#{mixParam},'%') or pmodel.name like concat('%',#{mixParam},'%'))
      </if>