java110
2023-05-30 f14c50cb0036d3ddd655ce4e34732ba396a836c4
java110-db/src/main/resources/mapper/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml
@@ -5,102 +5,144 @@
<mapper namespace="scheduleClassesStaffV1ServiceDaoImpl">
    <!-- 保存排班员工信息 add by wuxw 2018-07-03 -->
    <insert id="saveScheduleClassesStaffInfo" parameterType="Map">
        insert into schedule_classes_staff(
staff_name,store_id,scs_id,schedule_id,staff_id
) values (
#{staffName},#{storeId},#{scsId},#{scheduleId},#{staffId}
)
        staff_name,store_id,scs_id,schedule_id,staff_id
        ) values (
        #{staffName},#{storeId},#{scsId},#{scheduleId},#{staffId}
        )
    </insert>
    <!-- 查询排班员工信息 add by wuxw 2018-07-03 -->
    <select id="getScheduleClassesStaffInfo" parameterType="Map" resultType="Map">
        select  t.staff_name,t.staff_name staffName,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId,t.scs_id,t.scs_id scsId,t.schedule_id,t.schedule_id scheduleId,t.staff_id,t.staff_id staffId
from schedule_classes_staff t
where 1 =1
<if test="staffName !=null and staffName != ''">
   and t.staff_name= #{staffName}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
<if test="scsId !=null and scsId != ''">
   and t.scs_id= #{scsId}
</if>
<if test="scheduleId !=null and scheduleId != ''">
   and t.schedule_id= #{scheduleId}
</if>
<if test="staffId !=null and staffId != ''">
   and t.staff_id= #{staffId}
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
   limit #{page}, #{row}
</if>
        select t.staff_name,t.staff_name staffName,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id
        storeId,t.scs_id,t.scs_id scsId,t.schedule_id,t.schedule_id scheduleId,t.staff_id,t.staff_id staffId,
        t.create_time createTime
        from schedule_classes_staff t
        INNER JOIN schedule_classes sc on t.schedule_id = sc.schedule_id and sc.state = '1001'
        <if test="orgId !=null and orgId != ''">
            left join u_org_staff_rel osr on t.staff_id = osr.staff_id and osr.status_cd = '0'
        </if>
        where 1 =1
        <if test="orgId !=null and orgId != ''">
            and osr.org_id = #{orgId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and t.staff_name= #{staffName}
        </if>
        <if test="staffNameLike !=null and staffNameLike != ''">
            and t.staff_name like concat('%', #{staffNameLike},'%')
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="scsId !=null and scsId != ''">
            and t.scs_id= #{scsId}
        </if>
        <if test="scheduleId !=null and scheduleId != ''">
            and t.schedule_id= #{scheduleId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 修改排班员工信息 add by wuxw 2018-07-03 -->
    <update id="updateScheduleClassesStaffInfo" parameterType="Map">
        update  schedule_classes_staff t set t.status_cd = #{statusCd}
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
<if test="staffName !=null and staffName != ''">
, t.staff_name= #{staffName}
</if>
<if test="storeId !=null and storeId != ''">
, t.store_id= #{storeId}
</if>
<if test="scheduleId !=null and scheduleId != ''">
, t.schedule_id= #{scheduleId}
</if>
<if test="staffId !=null and staffId != ''">
, t.staff_id= #{staffId}
</if>
 where 1=1 <if test="scsId !=null and scsId != ''">
and t.scs_id= #{scsId}
</if>
        update schedule_classes_staff t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="staffName !=null and staffName != ''">
            , t.staff_name= #{staffName}
        </if>
        <if test="storeId !=null and storeId != ''">
            , t.store_id= #{storeId}
        </if>
        <if test="scheduleId !=null and scheduleId != ''">
            , t.schedule_id= #{scheduleId}
        </if>
        <if test="staffId !=null and staffId != ''">
            , t.staff_id= #{staffId}
        </if>
        where 1=1
        <if test="scsId !=null and scsId != ''">
            and t.scs_id= #{scsId}
        </if>
    </update>
    <!-- 查询排班员工数量 add by wuxw 2018-07-03 -->
     <select id="queryScheduleClassesStaffsCount" parameterType="Map" resultType="Map">
        select  count(1) count
from schedule_classes_staff t
where 1 =1
<if test="staffName !=null and staffName != ''">
   and t.staff_name= #{staffName}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
<if test="scsId !=null and scsId != ''">
   and t.scs_id= #{scsId}
</if>
<if test="scheduleId !=null and scheduleId != ''">
   and t.schedule_id= #{scheduleId}
</if>
<if test="staffId !=null and staffId != ''">
   and t.staff_id= #{staffId}
</if>
    <select id="queryScheduleClassesStaffsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from schedule_classes_staff t
        INNER JOIN schedule_classes sc on t.schedule_id = sc.schedule_id and sc.state = '1001'
        <if test="orgId !=null and orgId != ''">
            left join u_org_staff_rel osr on t.staff_id = osr.staff_id and osr.status_cd = '0'
        </if>
        where 1 =1
        <if test="orgId !=null and orgId != ''">
            and osr.org_id = #{orgId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and t.staff_name= #{staffName}
        </if>
        <if test="staffNameLike !=null and staffNameLike != ''">
            and t.staff_name like concat('%', #{staffNameLike},'%')
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="scsId !=null and scsId != ''">
            and t.scs_id= #{scsId}
        </if>
        <if test="scheduleId !=null and scheduleId != ''">
            and t.schedule_id= #{scheduleId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
     </select>
    </select>
    <!-- 查询排班员工信息 add by wuxw 2018-07-03 -->
    <select id="getGroupScheduleClassesStaffInfo" parameterType="Map" resultType="Map">
        select t.schedule_id scheduleId,count(1) staffCount
        from schedule_classes_staff t
        where 1 =1
        and t.status_cd= '0'
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="scsId !=null and scsId != ''">
            and t.scs_id= #{scsId}
        </if>
        <if test="scheduleId !=null and scheduleId != ''">
            and t.schedule_id= #{scheduleId}
        </if>
        <if test="scheduleIds !=null ">
            and t.schedule_id in
            <foreach collection="scheduleIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        group by t.schedule_id
    </select>
</mapper>