123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.ourwill.module.house.dao.dm.RecordMedicineInoutputDao">
- <resultMap type="cn.ourwill.module.house.entity.dm.RecordMedicineInoutput" id="baseMap">
- <result column="id" property="id"/>
- <result column="grain_id" property="grainId"/>
- <result column="medicine_id" property="medicineId"/>
- <result column="type" property="type"/>
- <result column="record_time" property="recordTime"/>
- <result column="number" property="number"/>
- <result column="unit" property="unit"/>
- <result column="odd_numbers" property="oddNumbers"/>
- <result column="stock_number" property="stockNumber"/>
- <result column="bookkeeper" property="bookkeeper"/>
- <result column="collator" property="collator"/>
- <result column="get_user" property="getUser"/>
- <result column="checker" property="checker"/>
- <result column="manufacturer" property="manufacturer"/>
- <result column="remark" property="remark"/>
- <result column="summary" property="summary"/>
- <result column="result" property="result"/>
- <result column="houseId" property="houseId"/>
- <result column="other_house" property="otherHouse"/>
- <result column="uuid" property="uuid"/>
- <result column="sign" property="sign"/>
- <result column="med_code" property="medCode"/>
- <result column="work_user" property="workUser"/>
- <result column="prod_date" property="prodDate"/>
- <result column="acceptance" property="acceptance"/>
- <result column="purpose" property="purpose"/>
- <result column="chief" property="chief"/>
- <result column="head_idea" property="headIdea"/>
- <result column="acceptor" property="acceptor"/>
- </resultMap>
- <sql id="columns">
- a.id ,
- a.grain_id ,
- a.medicine_id ,
- a.`type` ,
- a.record_time ,
- a.`number` ,
- a.unit ,
- a.odd_numbers ,
- a.stock_number ,
- a.bookkeeper ,
- a.collator ,
- a.get_user ,
- a.checker ,
- a.manufacturer ,
- a.remark ,
- a.summary ,
- a.result ,
- a.houseId,
- a.other_house,
- a.uuid,
- a.sign,
- a.med_code,
- a.work_user,
- a.prod_date,
- a.acceptance,
- a.purpose,
- a.chief,
- a.head_idea,
- a.acceptor
- </sql>
- <sql id="joinCols">
- </sql>
- <select id="get" resultMap="baseMap">
- SELECT
- hi.house_name houseName,
- <include refid="columns"/>
- FROM record_medicine_inoutput a
- left join house_info hi on a.houseId = hi.id
- <include refid="joinCols"/>
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM record_medicine_inoutput a
- LEFT JOIN sys_grain sg ON a.grain_id=sg.id
- <include refid="joinCols"/>
- <where>
- <if test="id !=null">
- and id = #{id}
- </if>
- <if test="grainId !=null">
- and grain_id = #{grainId}
- </if>
- <if test="medicineId !=null">
- and medicine_id = #{medicineId}
- </if>
- <if test="cityId !=null and cityId !=''">
- and sg.parentId = #{cityId}
- </if>
- <if test="type !=null">
- and `type` = #{type}
- </if>
- <if test="recordTime !=null">
- and record_time = #{recordTime}
- </if>
- <if test="number !=null">
- and `number` = #{number}
- </if>
- <if test="unit !=null">
- and unit = #{unit}
- </if>
- <if test="oddNumbers !=null">
- and odd_numbers = #{oddNumbers}
- </if>
- <if test="stockNumber !=null">
- and stock_number = #{stockNumber}
- </if>
- <if test="bookkeeper !=null">
- and bookkeeper = #{bookkeeper}
- </if>
- <if test="collator !=null">
- and collator = #{collator}
- </if>
- <if test="getUser !=null">
- and get_user = #{getUser}
- </if>
- <if test="checker !=null">
- and checker = #{checker}
- </if>
- <if test="manufacturer !=null">
- and manufacturer = #{manufacturer}
- </if>
- <if test="remark !=null">
- and remark = #{remark}
- </if>
- <if test="summary !=null">
- and summary = #{summary}
- </if>
- <if test="result !=null">
- and result = #{result}
- </if>
- <if test="houseId !=null">
- and houseId = #{houseId}
- </if>
- <if test="otherHouse !=null">
- and other_house = #{otherHouse}
- </if>
- <if test="uuid !=null">
- and uuid = #{uuid}
- </if>
- <if test="sign !=null">
- and sign = #{sign}
- </if>
- <if test="medCode !=null">
- and med_code = #{medCode}
- </if>
- <if test="workUser !=null">
- and work_user = #{workUser}
- </if>
- <if test="prodDate !=null">
- and prod_date = #{prodDate}
- </if>
- <if test="acceptance !=null">
- and acceptance = #{acceptance}
- </if>
- <if test="purpose !=null">
- and purpose = #{purpose}
- </if>
- <if test="chief !=null">
- and chief = #{chief}
- </if>
- <if test="headIdea !=null">
- and head_idea = #{headIdea}
- </if>
- <if test="acceptor !=null">
- and acceptor = #{acceptor}
- </if>
- <if test="medicineIds != null and medicineIds.size() > 0">
- and medicine_id in
- <foreach collection="medicineIds" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM record_medicine_inoutput a
- <include refid="joinCols"/>
- <where>
- <if test="id !=null">
- and id = #{id}
- </if>
- <if test="grainId !=null">
- and grain_id = #{grainId}
- </if>
- <if test="medicineId !=null">
- and medicine_id = #{medicineId}
- </if>
- <if test="type !=null">
- and `type` = #{type}
- </if>
- <if test="recordTime !=null">
- and record_time = #{recordTime}
- </if>
- <if test="number !=null">
- and `number` = #{number}
- </if>
- <if test="unit !=null">
- and unit = #{unit}
- </if>
- <if test="oddNumbers !=null">
- and odd_numbers = #{oddNumbers}
- </if>
- <if test="stockNumber !=null">
- and stock_number = #{stockNumber}
- </if>
- <if test="bookkeeper !=null">
- and bookkeeper = #{bookkeeper}
- </if>
- <if test="collator !=null">
- and collator = #{collator}
- </if>
- <if test="getUser !=null">
- and get_user = #{getUser}
- </if>
- <if test="checker !=null">
- and checker = #{checker}
- </if>
- <if test="manufacturer !=null">
- and manufacturer = #{manufacturer}
- </if>
- <if test="remark !=null">
- and remark = #{remark}
- </if>
- <if test="summary !=null">
- and summary = #{summary}
- </if>
- <if test="result !=null">
- and result = #{result}
- </if>
- <if test="houseId !=null">
- and houseId = #{houseId}
- </if>
- <if test="otherHouse !=null">
- and other_house = #{otherHouse}
- </if>
- <if test="uuid !=null">
- and uuid = #{uuid}
- </if>
- <if test="sign !=null">
- and sign = #{sign}
- </if>
- <if test="medCode !=null">
- and med_code = #{medCode}
- </if>
- <if test="workUser !=null">
- and work_user = #{workUser}
- </if>
- <if test="prodDate !=null">
- and prod_date = #{prodDate}
- </if>
- <if test="acceptance !=null">
- and acceptance = #{acceptance}
- </if>
- <if test="purpose !=null">
- and purpose = #{purpose}
- </if>
- <if test="chief !=null">
- and chief = #{chief}
- </if>
- <if test="headIdea !=null">
- and head_idea = #{headIdea}
- </if>
- <if test="acceptor !=null">
- and acceptor = #{acceptor}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
- parameterType="cn.ourwill.module.house.entity.dm.RecordMedicineInoutput">
- INSERT INTO record_medicine_inoutput
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test=" id != null">
- id,
- </if>
- <if test=" grainId != null">
- grain_id,
- </if>
- <if test=" medicineId != null">
- medicine_id,
- </if>
- <if test=" type != null">
- `type`,
- </if>
- <if test=" recordTime != null">
- record_time,
- </if>
- <if test=" number != null">
- `number`,
- </if>
- <if test=" unit != null">
- unit,
- </if>
- <if test=" oddNumbers != null">
- odd_numbers,
- </if>
- <if test=" stockNumber != null">
- stock_number,
- </if>
- <if test=" bookkeeper != null">
- bookkeeper,
- </if>
- <if test=" collator != null">
- collator,
- </if>
- <if test=" getUser != null">
- get_user,
- </if>
- <if test=" checker != null">
- checker,
- </if>
- <if test=" manufacturer != null">
- manufacturer,
- </if>
- <if test=" remark != null">
- remark,
- </if>
- <if test=" summary != null">
- summary,
- </if>
- <if test=" result != null">
- result,
- </if>
- <if test=" houseId != null">
- houseId,
- </if>
- <if test="otherHouse !=null">
- other_house,
- </if>
- <if test="uuid !=null">
- uuid,
- </if>
- <if test="sign !=null">
- sign,
- </if>
- <if test="medCode !=null">
- med_code,
- </if>
- <if test="workUser !=null">
- work_user,
- </if>
- <if test="prodDate !=null">
- prod_date,
- </if>
- <if test="acceptance !=null">
- acceptance,
- </if>
- <if test="purpose !=null">
- purpose,
- </if>
- <if test="chief !=null">
- chief,
- </if>
- <if test="headIdea !=null">
- head_idea,
- </if>
- <if test="acceptor !=null">
- acceptor
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test=" id != null">
- #{id}, </if>
- <if test=" grainId != null">
- #{grainId}, </if>
- <if test=" medicineId != null">
- #{medicineId}, </if>
- <if test=" type != null">
- #{type}, </if>
- <if test=" recordTime != null">
- #{recordTime}, </if>
- <if test=" number != null">
- #{number}, </if>
- <if test=" unit != null">
- #{unit}, </if>
- <if test=" oddNumbers != null">
- #{oddNumbers}, </if>
- <if test=" stockNumber != null">
- #{stockNumber}, </if>
- <if test=" bookkeeper != null">
- #{bookkeeper}, </if>
- <if test=" collator != null">
- #{collator}, </if>
- <if test=" getUser != null">
- #{getUser}, </if>
- <if test=" checker != null">
- #{checker}, </if>
- <if test=" manufacturer != null">
- #{manufacturer}, </if>
- <if test=" remark != null">
- #{remark}, </if>
- <if test=" summary != null">
- #{summary}, </if>
- <if test=" result != null">
- #{result}, </if>
- <if test=" houseId != null">
- #{houseId}, </if>
- <if test="otherHouse !=null">
- #{otherHouse},
- </if>
- <if test="uuid !=null">
- #{uuid},
- </if>
- <if test="sign !=null">
- #{sign},
- </if>
- <if test="medCode !=null">
- #{medCode},
- </if>
- <if test="workUser !=null">
- #{workUser},
- </if>
- <if test="prodDate !=null">
- #{prodDate},
- </if>
- <if test="acceptance !=null">
- #{acceptance},
- </if>
- <if test="purpose !=null">
- #{purpose},
- </if>
- <if test="chief !=null">
- #{chief},
- </if>
- <if test="headIdea !=null">
- #{headIdea},
- </if>
- <if test="acceptor !=null">
- #{acceptor}
- </if>
- </trim>
- </insert>
- <update id="update" parameterType="cn.ourwill.module.house.entity.dm.RecordMedicineInoutput">
- UPDATE record_medicine_inoutput <set>
- <if test="id != null">
- id= #{id} ,
- </if>
- <if test="grainId != null">
- grain_id= #{grainId} ,
- </if>
- <if test="medicineId != null">
- medicine_id= #{medicineId} ,
- </if>
- <if test="type != null">
- `type`= #{type} ,
- </if>
- <if test="recordTime != null">
- record_time= #{recordTime} ,
- </if>
- <if test="number != null">
- `number`= #{number} ,
- </if>
- <if test="unit != null">
- unit= #{unit} ,
- </if>
- <if test="oddNumbers != null">
- odd_numbers= #{oddNumbers} ,
- </if>
- <if test="stockNumber != null">
- stock_number= #{stockNumber} ,
- </if>
- <if test="bookkeeper != null">
- bookkeeper= #{bookkeeper} ,
- </if>
- <if test="collator != null">
- collator= #{collator} ,
- </if>
- <if test="getUser != null">
- get_user= #{getUser} ,
- </if>
- <if test="checker != null">
- checker= #{checker} ,
- </if>
- <if test="manufacturer != null">
- manufacturer= #{manufacturer} ,
- </if>
- <if test="remark != null">
- remark= #{remark} ,
- </if>
- <if test="summary != null">
- summary= #{summary} ,
- </if>
- <if test="result != null">
- result= #{result},
- </if>
- <if test="houseId != null">
- houseId= #{houseId},
- </if>
- <if test="otherHouse != null">
- other_house= #{otherHouse},
- </if>
- <if test="uuid != null">
- uuid= #{uuid},
- </if>
- <if test="sign !=null">
- sign = #{sign},
- </if>
- <if test="medCode !=null">
- med_code = #{medCode},
- </if>
- <if test="workUser !=null">
- work_user = #{workUser},
- </if>
- <if test="prodDate !=null">
- prod_date = #{prodDate},
- </if>
- <if test="acceptance !=null">
- acceptance = #{acceptance},
- </if>
- <if test="purpose !=null">
- purpose = #{purpose},
- </if>
- <if test="chief !=null">
- chief = #{chief},
- </if>
- <if test="headIdea !=null">
- head_idea = #{headIdea},
- </if>
- <if test="acceptor !=null">
- acceptor = #{acceptor}
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <delete id="deleteById" parameterType="java.lang.Long">
- DELETE FROM record_medicine_inoutput WHERE id = #{id}
- </delete>
- <delete id="deleteByIds" parameterType="java.util.List">
- DELETE FROM record_medicine_inoutput WHERE id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <select id="getByUUid" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM record_medicine_inoutput a
- <include refid="joinCols"/>
- WHERE a.uuid = #{uuid}
- </select>
- <select id="getByuuid" resultType="java.lang.Double" >
- SELECT stock_number FROM record_medicine_inoutput WHERE grain_id= #{grainId} and medicine_id=#{medicineId} ORDER BY id DESC LIMIT 1
- </select>
- <update id="updateByUuid" parameterType="cn.ourwill.module.house.entity.dm.RecordMedicineInoutput">
- UPDATE record_medicine_inoutput <set>
- <if test="id != null">
- id= #{id} ,
- </if>
- <if test="grainId != null">
- grain_id= #{grainId} ,
- </if>
- <if test="medicineId != null">
- medicine_id= #{medicineId} ,
- </if>
- <if test="type != null">
- `type`= #{type} ,
- </if>
- <if test="recordTime != null">
- record_time= #{recordTime} ,
- </if>
- <if test="number != null">
- `number`= #{number} ,
- </if>
- <if test="unit != null">
- unit= #{unit} ,
- </if>
- <if test="oddNumbers != null">
- odd_numbers= #{oddNumbers} ,
- </if>
- <if test="stockNumber != null">
- stock_number= #{stockNumber} ,
- </if>
- <if test="bookkeeper != null">
- bookkeeper= #{bookkeeper} ,
- </if>
- <if test="collator != null">
- collator= #{collator} ,
- </if>
- <if test="getUser != null">
- get_user= #{getUser} ,
- </if>
- <if test="checker != null">
- checker= #{checker} ,
- </if>
- <if test="manufacturer != null">
- manufacturer= #{manufacturer} ,
- </if>
- <if test="remark != null">
- remark= #{remark} ,
- </if>
- <if test="summary != null">
- summary= #{summary} ,
- </if>
- <if test="result != null">
- result= #{result},
- </if>
- <if test="houseId != null">
- houseId= #{houseId},
- </if>
- <if test="otherHouse != null">
- other_house= #{otherHouse},
- </if>
- <if test="uuid != null">
- uuid= #{uuid},
- </if>
- <if test="sign !=null">
- sign = #{sign},
- </if>
- <if test="medCode !=null">
- med_code = #{medCode},
- </if>
- <if test="workUser !=null">
- work_user = #{workUser},
- </if>
- <if test="prodDate !=null">
- prod_date = #{prodDate},
- </if>
- <if test="acceptance !=null">
- acceptance = #{acceptance},
- </if>
- <if test="purpose !=null">
- purpose = #{purpose},
- </if>
- <if test="chief !=null">
- chief = #{chief},
- </if>
- <if test="headIdea !=null">
- head_idea = #{headIdea},
- </if>
- <if test="acceptor !=null">
- acceptor = #{acceptor}
- </if>
- </set>
- WHERE uuid= #{uuid}
- </update>
- </mapper>
|