You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.3 KiB

<?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="org.springblade.modules.material.mapper.MaterialEngineerMapper">
<!-- 通用查询映射结果 -->
<resultMap id="materialEngineerResultMap" type="org.springblade.modules.material.pojo.entity.MaterialEngineerEntity">
<result column="id" property="id"/>
<result column="material_id" property="materialId"/>
<result column="company_id" property="companyId"/>
<result column="operation_id" property="operationId"/>
<result column="operation_name" property="operationName"/>
<result column="enginner_id" property="enginnerId"/>
<result column="enginner_name" property="enginnerName"/>
<result column="code" property="code"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="model" property="model"/>
<result column="power" property="power"/>
<result column="description" property="description"/>
<result column="brand" property="brand"/>
<result column="stock" property="stock"/>
<result column="unit" property="unit"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectMaterialEngineerPage" resultMap="materialEngineerResultMap">
select * from sf_material_engineer where is_deleted = 0
</select>
<select id="exportMaterialEngineer" resultType="org.springblade.modules.material.excel.MaterialEngineerExcel">
SELECT * FROM sf_material_engineer ${ew.customSqlSegment}
</select>
<select id="engineerStockList" resultMap="materialEngineerResultMap">
select e.material_id,e.company_id,e.operation_id,e.engineer_id,e.code,e.name,d.dict_value AS type,e.model
,e.power,e.description,ifnull(e.stock,0) as stock
from sf_material_engineer e
LEFT JOIN blade_dict d ON d.code ='wl_type' AND d.parent_id > 0 AND d.is_sealed = 0 AND d.is_deleted = 0 AND d.dict_key=e.type
where e.is_deleted = 0 and e.stock>0
<include refid="commonCondition"/>
</select>
<select id="countEngineerStockList" resultType="long">
select count(e.id)
from sf_material_engineer e
where e.is_deleted = 0 and e.stock>0
<include refid="commonCondition"/>
</select>
<sql id="commonCondition">
<if test="vo.engineerId !=null and vo.engineerId !='' ">
AND e.engineer_id=#{vo.engineerId}
</if>
<if test="vo.empId !=null and vo.empId !='' ">
AND e.engineer_id=(SELECT user_id FROM `sf_operation_site_employee` WHERE id=#{vo.empId})
</if>
<if test="vo.smallConditon !=null and vo.smallConditon !='' ">
AND (e.name LIKE concat('%',#{vo.smallConditon},'%')
or e.code LIKE concat('%',#{vo.smallConditon},'%') )
</if>
</sql>
</mapper>