将查询单据信息的两个接口合并为一个

This commit is contained in:
季圣华
2019-06-03 21:33:26 +08:00
parent d2d7af27ac
commit 1c3ab2cb17
12 changed files with 54 additions and 146 deletions

View File

@@ -49,6 +49,8 @@
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
inner join jsh_depotitem di on dh.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
inner join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
where 1=1
<if test="type != null">
and dh.Type='${type}'
@@ -59,15 +61,18 @@
<if test="number != null">
and dh.Number like '%${number}%'
</if>
<if test="dhIds != null">
and dh.Id in (${dhIds})
</if>
<if test="beginTime != null">
and dh.OperTime >= '${beginTime}'
</if>
<if test="endTime != null">
and dh.OperTime &lt;= '${endTime}'
</if>
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
</if>
<if test="depotIds != null">
and di.DepotId in (${depotIds})
</if>
and ifnull(dh.delete_Flag,'0') !='1'
order by dh.Id desc
<if test="offset != null and rows != null">
@@ -76,8 +81,10 @@
</select>
<select id="countsByDepotHead" resultType="java.lang.Long">
SELECT
COUNT(id)
COUNT(jsh_depothead.id)
FROM jsh_depothead
inner join jsh_depotitem di on jsh_depothead.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
inner join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
WHERE 1=1
<if test="type != null">
and Type='${type}'
@@ -88,16 +95,19 @@
<if test="number != null">
and Number like '%${number}%'
</if>
<if test="dhIds != null">
and Id in (${dhIds})
</if>
<if test="beginTime != null">
and OperTime >= '${beginTime}'
</if>
<if test="endTime != null">
and OperTime &lt;= '${endTime}'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
</if>
<if test="depotIds != null">
and di.DepotId in (${depotIds})
</if>
and ifnull(jsh_depothead.delete_Flag,'0') !='1'
</select>
<select id="getMaxId" resultType="java.lang.Long">

View File

@@ -2,10 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsh.erp.datasource.mappers.DepotItemMapperEx">
<resultMap id="HeaderIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4HeaderId">
<result column="HeaderId" jdbcType="BIGINT" property="headerid" />
</resultMap>
<resultMap id="DetailByTypeAndMIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId">
<result column="Number" jdbcType="VARCHAR" property="number" />
<result column="newType" jdbcType="VARCHAR" property="newtype" />
@@ -88,15 +84,6 @@
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getHeaderIdByMaterial" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="HeaderIdResultMap">
select dt.HeaderId from jsh_depotitem dt
INNER JOIN jsh_material m on dt.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
where (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
<if test="depotIds != null">
and dt.DepotId in (${depotIds})
</if>
and ifnull(dt.delete_Flag,'0') !='1'
</select>
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
select dh.Number,concat(dh.SubType,dh.Type) as newType,