| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <?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.usoftchina.saas.document.mapper.BomMapper" >
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bom" >
- <id column="bo_id" property="id" jdbcType="INTEGER" />
- <result column="bo_motherid" property="bo_motherid" jdbcType="INTEGER" />
- <result column="bo_mothercode" property="bo_mothercode" jdbcType="VARCHAR" />
- <result column="bo_mothername" property="bo_mothername" jdbcType="VARCHAR" />
- <result column="bo_version" property="bo_version" jdbcType="VARCHAR" />
- <result column="bo_status" property="bo_status" jdbcType="VARCHAR" />
- <result column="bo_statuscode" property="bo_statuscode" jdbcType="VARCHAR" />
- <result column="bo_recorderid" property="bo_recorderid" jdbcType="INTEGER" />
- <result column="bo_recorder" property="bo_recorder" jdbcType="VARCHAR" />
- <result column="bo_recorddate" property="bo_recorddate" jdbcType="TIMESTAMP" />
- <result column="companyId" property="companyId" jdbcType="INTEGER" />
- <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
- <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="bo_text1" property="bo_text1" jdbcType="VARCHAR" />
- <result column="bo_text2" property="bo_text2" jdbcType="VARCHAR" />
- <result column="bo_text3" property="bo_text3" jdbcType="VARCHAR" />
- <result column="bo_text4" property="bo_text4" jdbcType="VARCHAR" />
- <result column="bo_text5" property="bo_text5" jdbcType="VARCHAR" />
- <result column="pr_brand" property="pr_brand" jdbcType="VARCHAR" />
- <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
- <result column="pr_unit" property="pr_unit" jdbcType="VARCHAR" />
- <result column="pr_orispeccode" property="pr_orispeccode" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- bo_id, bo_motherid, bo_mothercode, bo_mothername, bo_version, bo_status, bo_statuscode,
- bo_recorderid, bo_recorder, bo_recorddate, companyId, updaterId, updateTime, bo_text1,
- bo_text2, bo_text3, bo_text4, bo_text5
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
- select
- <include refid="Base_Column_List" />
- from bom
- where bo_id = #{id}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
- delete from bom
- where bo_id = #{id}
- </delete>
- <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into bom (bo_motherid, bo_mothercode,
- bo_mothername, bo_version, bo_status,
- bo_statuscode, bo_recorderid, bo_recorder,
- bo_recorddate, companyId, updaterId,
- updateTime, bo_text1, bo_text2,
- bo_text3, bo_text4, bo_text5
- )
- values (#{bo_motherid,jdbcType=INTEGER}, #{bo_mothercode,jdbcType=VARCHAR},
- #{bo_mothername,jdbcType=VARCHAR}, #{bo_version,jdbcType=VARCHAR}, #{bo_status,jdbcType=VARCHAR},
- #{bo_statuscode,jdbcType=VARCHAR}, #{bo_recorderid,jdbcType=INTEGER}, #{bo_recorder,jdbcType=VARCHAR},
- #{bo_recorddate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
- #{updateTime,jdbcType=TIMESTAMP}, #{bo_text1,jdbcType=VARCHAR}, #{bo_text2,jdbcType=VARCHAR},
- #{bo_text3,jdbcType=VARCHAR}, #{bo_text4,jdbcType=VARCHAR}, #{bo_text5,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into bom
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="bo_motherid != null" >
- bo_motherid,
- </if>
- <if test="bo_mothercode != null" >
- bo_mothercode,
- </if>
- <if test="bo_mothername != null" >
- bo_mothername,
- </if>
- <if test="bo_version != null" >
- bo_version,
- </if>
- <if test="bo_status != null" >
- bo_status,
- </if>
- <if test="bo_statuscode != null" >
- bo_statuscode,
- </if>
- <if test="bo_recorderid != null" >
- bo_recorderid,
- </if>
- <if test="bo_recorder != null" >
- bo_recorder,
- </if>
- <if test="bo_recorddate != null" >
- bo_recorddate,
- </if>
- <if test="companyId != null" >
- companyId,
- </if>
- <if test="updaterId != null" >
- updaterId,
- </if>
- <if test="updateTime != null" >
- updateTime,
- </if>
- <if test="bo_text1 != null" >
- bo_text1,
- </if>
- <if test="bo_text2 != null" >
- bo_text2,
- </if>
- <if test="bo_text3 != null" >
- bo_text3,
- </if>
- <if test="bo_text4 != null" >
- bo_text4,
- </if>
- <if test="bo_text5 != null" >
- bo_text5,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="bo_motherid != null" >
- #{bo_motherid,jdbcType=INTEGER},
- </if>
- <if test="bo_mothercode != null" >
- #{bo_mothercode,jdbcType=VARCHAR},
- </if>
- <if test="bo_mothername != null" >
- #{bo_mothername,jdbcType=VARCHAR},
- </if>
- <if test="bo_version != null" >
- #{bo_version,jdbcType=VARCHAR},
- </if>
- <if test="bo_status != null" >
- #{bo_status,jdbcType=VARCHAR},
- </if>
- <if test="bo_statuscode != null" >
- #{bo_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="bo_recorderid != null" >
- #{bo_recorderid,jdbcType=INTEGER},
- </if>
- <if test="bo_recorder != null" >
- #{bo_recorder,jdbcType=VARCHAR},
- </if>
- <if test="bo_recorddate != null" >
- #{bo_recorddate,jdbcType=TIMESTAMP},
- </if>
- <if test="companyId != null" >
- #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bo_text1 != null" >
- #{bo_text1,jdbcType=VARCHAR},
- </if>
- <if test="bo_text2 != null" >
- #{bo_text2,jdbcType=VARCHAR},
- </if>
- <if test="bo_text3 != null" >
- #{bo_text3,jdbcType=VARCHAR},
- </if>
- <if test="bo_text4 != null" >
- #{bo_text4,jdbcType=VARCHAR},
- </if>
- <if test="bo_text5 != null" >
- #{bo_text5,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
- update bom
- <set >
- <if test="bo_motherid != null" >
- bo_motherid = #{bo_motherid,jdbcType=INTEGER},
- </if>
- <if test="bo_mothercode != null" >
- bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
- </if>
- <if test="bo_mothername != null" >
- bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
- </if>
- <if test="bo_version != null" >
- bo_version = #{bo_version,jdbcType=VARCHAR},
- </if>
- <if test="bo_status != null" >
- bo_status = #{bo_status,jdbcType=VARCHAR},
- </if>
- <if test="bo_statuscode != null" >
- bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="bo_recorderid != null" >
- bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
- </if>
- <if test="bo_recorder != null" >
- bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
- </if>
- <if test="bo_recorddate != null" >
- bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
- </if>
- <if test="companyId != null" >
- companyId = #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- updaterId = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bo_text1 != null" >
- bo_text1 = #{bo_text1,jdbcType=VARCHAR},
- </if>
- <if test="bo_text2 != null" >
- bo_text2 = #{bo_text2,jdbcType=VARCHAR},
- </if>
- <if test="bo_text3 != null" >
- bo_text3 = #{bo_text3,jdbcType=VARCHAR},
- </if>
- <if test="bo_text4 != null" >
- bo_text4 = #{bo_text4,jdbcType=VARCHAR},
- </if>
- <if test="bo_text5 != null" >
- bo_text5 = #{bo_text5,jdbcType=VARCHAR},
- </if>
- </set>
- where bo_id = #{id}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Bom" >
- update bom
- set bo_motherid = #{bo_motherid,jdbcType=INTEGER},
- bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
- bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
- bo_version = #{bo_version,jdbcType=VARCHAR},
- bo_status = #{bo_status,jdbcType=VARCHAR},
- bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
- bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
- bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
- bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
- companyId = #{companyId,jdbcType=INTEGER},
- updaterId = #{updaterId,jdbcType=INTEGER},
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- bo_text1 = #{bo_text1,jdbcType=VARCHAR},
- bo_text2 = #{bo_text2,jdbcType=VARCHAR},
- bo_text3 = #{bo_text3,jdbcType=VARCHAR},
- bo_text4 = #{bo_text4,jdbcType=VARCHAR},
- bo_text5 = #{bo_text5,jdbcType=VARCHAR}
- where bo_id = #{id}
- </update>
- <select id="validateCodeWhenInsert" resultType="int">
- select count(*) from BOM where BO_MOTHERCODE = #{code} and companyId =#{companyId}
- </select>
- <select id="validateCodeWhenUpdate" resultType="int" >
- select count(*) from BOM where BO_MOTHERCODE = #{code} and BO_ID != #{id} and companyId =#{companyId}
- </select>
- <select id="validCodeAndVersion" resultType="int">
- SELECT COUNT(*) FROM BOM WHERE BO_MOTHERCODE = #{code} and BO_VERSION=#{version} and COMPANYID=#{companyId}
- </select>
- <select id="getCodeById" resultType="string">
- SELECT BO_MOTHERCODE FROM BOM WHERE BO_ID = #{id} and COMPANYID = #{companyId}
- </select>
- <select id="getListData" resultMap="BaseResultMap">
- SELECT * FROM BOM LEFT JOIN PRODUCT ON PR_ID=BO_MOTHERID
- <where>
- <if test="condition!=null">
- ${condition}
- </if>
- <if test="companyId!=null">
- AND BOM.companyId = #{companyId}
- </if>
- </where>
- ORDER BY BO_ID DESC
- </select>
- </mapper>
|