gz_gqj/src/main/resources/mappers/bases/PartBackMapper.xml

89 lines
4.2 KiB
XML
Raw Normal View History

2024-11-13 16:26:51 +08:00
<?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.bonus.gzgqj.business.bases.mapper.PartBackMapper" >
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PartBackVo">
select tpb.id, tpb.code, tpb.creator,pu.TELPHONE phone ,tpb.back_num backNum,tpb.user_name userName
tpb.back_day backDay, tpb.create_time createTime, tpb.type, tpb.remark,
tpb.status, tpb.updater, tpb.update_time updateTime, tpb.create_id createId
from t_part_back tpb
left join pm_user pu on pu.id=tpb.creator
<where>
<if test="keyWord!=null and keyWord!=''">
and (
tpb.code like('%',#{keyWord},'%') or
tpb.user_name like('%',#{keyWord},'%') or
tpb.remark like('%',#{keyWord},'%')
)
</if>
<if test="times!=null and times!='' and startDay!=null and endDay!=null ">
and STR_TO_DATE(tpb.create_time, '%Y-%m-%d') between STR_TO_DATE(#{startDay} ,'%Y-%m-%d') AND STR_TO_DATE(#{endDay},'%Y-%m-%d')
</if>
</where>
</select>
<!--插入数据-->
<insert id="insertBack" useGeneratedKeys="true" keyProperty="id">
insert into t_part_back(
code,creator,back_day,
create_time, type, remark,
status,updater, update_time, create_id,back_num,user_name
)values (#{code},#{creator},#{backDay},now(),#{type},#{remark},#{status},#{updater},now(),#{createId},#{backNum},#{userName})
</insert>
<insert id="insertBackDetails">
insert into t_part_back_details(
back_id, back_num, part_id,
part_type, part_name, part_model,
part_unit, remark ) values
<foreach collection="list" item="item" separator=",">
(#{param.id},#{item.backNum},#{item.partId},#{item.partType},#{item.partName},
#{item.partModel},#{item.partUnit},#{item.remark})
</foreach>
</insert>
<select id="getUserList" resultType="com.bonus.gzgqj.business.bases.entity.UserPatypeInfo">
select distinct user_id userId, user_name userName
from tb_user_pa_type_info
</select>
<!--查询配置类型数据-->
<select id="getPaTypeList" resultType="com.bonus.gzgqj.business.bases.entity.UserPatypeInfo">
select
user_id userId, part_id partId,part_type partType,
part_name partName, part_model partModel,
ly_num lyNum, gh_num ghNum, user_name userName,part_unit partUnit
from tb_user_pa_type_info ppd where user_id=#{userId}
<if test="partType!=null and partType!=''">
and ppd.part_type like concat('%',#{partType},'%')
</if>
<if test="partName!=null and partName!=''">
and ppd.part_name like concat('%',#{partName},'%')
</if>
<if test="partModel!=null and partModel!=''">
and ppd.part_model like concat('%',#{partModel},'%')
</if>
</select>
<select id="getBackNum" resultType="java.lang.Integer">
select count(1)
from t_part_back
where DATE_FORMAT(create_time,'%Y-%m-%d')=CURRENT_DATE
</select>
<select id="getInfoDetailList" resultType="com.bonus.gzgqj.business.bases.entity.PartBackDetailsVo">
SELECT id, back_id backId, back_num backNum,
part_id partId, part_type partType,
part_name partName, part_model partModel, part_unit partUnit, remark
FROM t_part_back_details
WHERE back_id=#{id}
</select>
<select id="getInfoDetails" resultType="com.bonus.gzgqj.business.bases.entity.PartBackVo">
select tpb.id, tpb.code, tpb.creator,pu.TELPHONE phone ,tpb.back_num backNum,tpb.user_name userName
tpb.back_day backDay, tpb.create_time createTime, tpb.type, tpb.remark,
tpb.status, tpb.updater, tpb.update_time updateTime, tpb.create_id createId
from t_part_back tpb
left join pm_user pu on pu.id=tpb.creator
WHERE tpb.id=#{id}
</select>
</mapper>