Files
mosty-dyga-cloud/mosty-qwzx/src/main/resources/mapper/TbQwXfpbMapper.xml
esacpe b80c560e87 1
2024-07-17 21:00:42 +08:00

108 lines
4.4 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.mosty.qwzx.mapper.TbQwXfpbMapper">
<!--根据条件按查询总数-->
<select id="getCount" resultType="Integer" parameterType="Map">
select count(1) from tb_qw_xfpb a where a.xt_scbz = '0' and a.xt_scbz = '0'
and a.id in (
select pb_id from tb_qw_xfpb_zq b where b.xt_scbz = '0' and b.xt_scbz = '0'
and (
b.fzr_id = #{ryid} or b.id in (
select ywid from tb_qw_jl c where c.xt_scbz = '0' and c.xt_scbz = '0' and jl_id = #{ryid}
)
)
)
<if test="dto.jsrqlx != null and dto.jsrqlx != ''">
and a.jsrqlx = #{dto.jsrqlx}
</if>
<if test="dto.xhlx != null and dto.xhlx != ''">
and a.xhlx = #{dto.xhlx}
</if>
<if test="dto.xhzq != null">
and a.xhzq = #{dto.xhzq}
</if>
<if test="dto.mrbc != null">
and a.mrbc = #{dto.mrbc}
</if>
<if test="dto.pbksrq != null and dto.pbjsrq != null">
and (
a.pbksrq between #{dto.pbksrq} and #{dto.pbjsrq} or
a.pbjsrq between #{dto.pbksrq} and #{dto.pbjsrq}
)
</if>
</select>
<!--根据条件按查询总数-->
<select id="getList" resultType="com.mosty.base.model.entity.qwzx.TbQwXfpb" parameterType="Map">
select a.* from tb_qw_xfpb a where a.xt_scbz = '0' and a.xt_scbz = '0'
and a.id in (
select pb_id from tb_qw_xfpb_zq b where b.xt_scbz = '0' and b.xt_scbz = '0'
and (
b.fzr_id = #{ryid} or b.id in (
select ywid from tb_qw_jl c where c.xt_scbz = '0' and c.xt_scbz = '0' and jl_id = #{ryid}
)
)
)
<if test="dto.jsrqlx != null and dto.jsrqlx != ''">
and a.jsrqlx = #{dto.jsrqlx}
</if>
<if test="dto.xhlx != null and dto.xhlx != ''">
and a.xhlx = #{dto.xhlx}
</if>
<if test="dto.xhzq != null">
and a.xhzq = #{dto.xhzq}
</if>
<if test="dto.mrbc != null">
and a.mrbc = #{dto.mrbc}
</if>
<if test="dto.pbksrq != null and dto.pbjsrq != null">
and (
a.pbksrq between #{dto.pbksrq} and #{dto.pbjsrq} or
a.pbjsrq between #{dto.pbksrq} and #{dto.pbjsrq}
)
</if>
order by a.pbksrq desc
limit #{pageIndex},#{pageSize}
</select>
<select id="checkThisTimeXfpb" resultType="com.mosty.base.model.entity.qwzx.TbQwXfpbMrjl">
<![CDATA[
select * from tb_qw_xfpb_mrjl a where
xfkssj BETWEEN DATE_FORMAT(date_add(now(),interval - 2 hour), '%Y-%m-%d %H:%i:%s')
and DATE_FORMAT(date_add(now(),interval + 2 hour), '%Y-%m-%d %H:%i:%s')
]]>
</select>
<select id="getPbBySjAndJl" resultType="com.mosty.base.model.entity.qwzx.TbQwXfpb">
select * from tb_qw_xfpb a where a.xt_sjzt = '1' and a.xt_scbz = '0'
<if test="id != null and id !=''">
and a.id != #{id}
</if>
<![CDATA[
and a.id in (
select b.pb_id from tb_qw_xfpb_zq b where b.xt_sjzt = '1' and b.xt_scbz = '0'
and (
b.fzr_id = #{jlId} or
b.id in (
select c.ywid from tb_qw_jl c where c.jl_id = #{jlId}
)
)
and (
case when b.kssj >= b.jssj then
#{kssj} between concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) and concat('1970-01-02 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) or
#{jssj} between concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) and concat('1970-01-02 ',DATE_FORMAT(b.kssj,'%H:%i:%s'))
when b.kssj < b.jssj then
#{kssj} between concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) and concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) or
#{jssj} between concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s')) and concat('1970-01-01 ',DATE_FORMAT(b.kssj,'%H:%i:%s'))
end
)
)
and (
#{pbksrq} between DATE_FORMAT(a.pbksrq,'%Y-%m-%d') and DATE_FORMAT(a.pbjsrq,'%Y-%m-%d') or
#{pbjsrq} between DATE_FORMAT(a.pbksrq,'%Y-%m-%d') and DATE_FORMAT(a.pbjsrq,'%Y-%m-%d')
)
]]>
</select>
</mapper>