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

174 lines
9.7 KiB
XML

3 weeks ago
<?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.ruoyi.system.mapper.BaseTyreMapper">
<resultMap type="BaseTyre" id="BaseTyreResult">
<result property="tyreId" column="tyre_id" />
<result property="tyreNo" column="tyre_no" />
<result property="selfNo" column="self_no" />
<result property="tyreEpc" column="tyre_epc" />
<result property="tyreBrand" column="tyre_brand" />
<result property="tyreModel" column="tyre_model" />
<result property="tyreLevel" column="tyre_level" />
<result property="tyrePattern" column="tyre_pattern" />
<result property="tyreType" column="tyre_type" />
<result property="team" column="team" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="carNo" column="car_no" />
<result property="wheelPostion" column="wheel_postion" />
<result property="patternDepth" column="pattern_depth" />
</resultMap>
<sql id="selectBaseTyreVo">
select tyre_id, tyre_no,self_no, tyre_epc, tyre_brand, tyre_model, tyre_level, tyre_pattern, tyre_type, team, create_by, create_time, update_by, update_time, remark,car_no,wheel_postion from base_tyre
</sql>
<select id="selectBaseTyreList" parameterType="BaseTyre" resultMap="BaseTyreResult">
select tyre_id, tyre_no,self_no, tyre_epc, tyre_brand, tyre_model, tyre_level, tyre_pattern, pattern_depth,tyre_type, team, su.user_name as create_by, d.create_time, d.update_by, d.update_time, d.remark,car_no,wheel_postion
from base_tyre d
left join sys_user su ON su.login_name = d.create_by
where tyre_id is not null
<if test="tyreNo != null and tyreNo != ''"> and tyre_no like concat('%', #{tyreNo}, '%')</if>
<if test="selfNo != null and selfNo != ''"> and self_no like concat('%', #{selfNo}, '%')</if>
<if test="tyreEpc != null and tyreEpc != ''"> and tyre_epc like concat('%', #{tyreEpc}, '%')</if>
<if test="tyreBrand != null and tyreBrand != ''"> and tyre_brand like concat('%', #{tyreBrand}, '%')</if>
<if test="tyreModel != null and tyreModel != ''"> and tyre_model = #{tyreModel}</if>
<if test="tyreLevel != null and tyreLevel != ''"> and tyre_level = #{tyreLevel}</if>
<if test="tyrePattern != null and tyrePattern != ''"> and tyre_pattern = #{tyrePattern}</if>
<if test="tyreType != null and tyreType != ''"> and tyre_type = #{tyreType}</if>
<if test="team != null and team != ''"> and team like concat('%', #{team}, '%')</if>
<if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(d.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(d.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
${params.dataScope}
</select>
<select id="selectBaseTyreById" parameterType="Long" resultMap="BaseTyreResult">
<include refid="selectBaseTyreVo"/>
where tyre_id = #{tyreId}
</select>
<select id="checkTyreNoUnique" parameterType="String" resultType="int">
select count(1) from base_tyre where tyre_no=#{tyreNo}
</select>
<select id="selectBaseTyreByEpc" parameterType="BaseTyre" resultMap="BaseTyreResult">
<include refid="selectBaseTyreVo"/>
<where>
<if test="tyreEpc != null and tyreEpc != ''"> and tyre_epc like concat('%', #{tyreEpc}, '%')</if>
</where>
</select>
<select id="getTeamByUser" resultType="java.lang.String">
SELECT
dept_name
FROM
sys_dept sd
LEFT JOIN sys_user su ON su.dept_id = sd.dept_id
WHERE
su.login_name = #{createBy}
</select>
<select id="vTyreStockSummary" resultType="java.util.Map" parameterType="SysDept">
SELECT
IFNULL(dept_name, '合计') AS dept_name,
new_count AS '新胎',
circulating_count AS '周转胎',
renovate_count AS '翻新胎',
experimental_count AS '实验胎'
FROM
v_tyre_stock_summary
<where>
<if test="deptName != null and deptName != ''"> and dept_name = #{deptName}</if>
</where>
</select>
3 weeks ago
<insert id="insertBaseTyre" parameterType="BaseTyre">
insert into base_tyre
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tyreId != null ">tyre_id,</if>
<if test="tyreNo != null and tyreNo != ''">tyre_no,</if>
<if test="selfNo != null and selfNo != ''">self_no,</if>
<if test="tyreEpc != null and tyreEpc != ''">tyre_epc,</if>
<if test="tyreBrand != null and tyreBrand != ''">tyre_brand,</if>
<if test="tyreModel != null and tyreModel != ''">tyre_model,</if>
<if test="tyreLevel != null and tyreLevel != ''">tyre_level,</if>
<if test="tyrePattern != null and tyrePattern != ''">tyre_pattern,</if>
<if test="grooves != null and grooves != ''">grooves,</if>
<if test="tyreType != null and tyreType != ''">tyre_type,</if>
<if test="team != null and team != ''">team,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="patternDepth != null and patternDepth != ''">pattern_depth,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tyreId != null ">#{tyreId},</if>
<if test="tyreNo != null and tyreNo != ''">#{tyreNo},</if>
<if test="selfNo != null and selfNo != ''">#{selfNo},</if>
<if test="tyreEpc != null and tyreEpc != ''">#{tyreEpc},</if>
<if test="tyreBrand != null and tyreBrand != ''">#{tyreBrand},</if>
<if test="tyreModel != null and tyreModel != ''">#{tyreModel},</if>
<if test="tyreLevel != null and tyreLevel != ''">#{tyreLevel},</if>
<if test="tyrePattern != null and tyrePattern != ''">#{tyrePattern},</if>
<if test="grooves != null and grooves != ''">#{grooves},</if>
<if test="tyreType != null and tyreType != ''">#{tyreType},</if>
<if test="team != null and team != ''">#{team},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="patternDepth != null and patternDepth != ''">#{patternDepth},</if>
</trim>
</insert>
<update id="updateBaseTyre" parameterType="BaseTyre">
update base_tyre
<trim prefix="SET" suffixOverrides=",">
<if test="tyreNo != null and tyreNo != ''">tyre_no = #{tyreNo},</if>
<if test="selfNo != null and selfNo != ''">self_no = #{selfNo},</if>
<if test="tyreEpc != null and tyreEpc != ''">tyre_epc = #{tyreEpc},</if>
<if test="tyreBrand != null and tyreBrand != ''">tyre_brand = #{tyreBrand},</if>
<if test="tyreModel != null and tyreModel != ''">tyre_model = #{tyreModel},</if>
<if test="tyreLevel != null and tyreLevel != ''">tyre_level = #{tyreLevel},</if>
<if test="tyrePattern != null and tyrePattern != ''">tyre_pattern = #{tyrePattern},</if>
<if test="tyreType != null and tyreType != ''">tyre_type = #{tyreType},</if>
<if test="team != null and team != ''">team = #{team},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="carNo != null ">car_no = #{carNo},</if>
<if test="wheelPostion != null ">wheel_postion = #{wheelPostion},</if>
</trim>
where tyre_id = #{tyreId}
</update>
<delete id="deleteBaseTyreById" parameterType="Long">
delete from base_tyre where tyre_id = #{tyreId}
</delete>
<delete id="deleteBaseTyreByIds" parameterType="String">
delete from base_tyre where tyre_id in
<foreach item="tyreId" collection="array" open="(" separator="," close=")">
#{tyreId}
</foreach>
</delete>
</mapper>