数据库
首页 > 数据库> > mybats sql语句记录

mybats sql语句记录

作者:互联网

<?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.cars.ict.rbpsems.mapper.TbTicketingMapper">

<resultMap id="BaseResultMap" type="com.cars.ict.rbpsems.entity.TbTicketing">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="tree_id" jdbcType="VARCHAR" property="treeId"/>
<result column="manual_ticket_num" jdbcType="INTEGER" property="manualTicketNum"/>
<result column="auto_ticket_num" jdbcType="INTEGER" property="autoTicketNum"/>
<result column="uncash_ticket_num" jdbcType="INTEGER" property="uncashTicketNum"/>
<result column="enter_agm_num" jdbcType="INTEGER" property="enterAgmNum"/>
<result column="out_agm_num" jdbcType="INTEGER" property="outAgmNum"/>
<result column="enter_ele_agm_num" jdbcType="INTEGER" property="enterEleAgmNum"/>
<result column="out_ele_agm_num" jdbcType="INTEGER" property="outEleAgmNum"/>
<result column="column_agm_num" jdbcType="INTEGER" property="columnAgmNum"/>
<result column="seat_terminal_num" jdbcType="INTEGER" property="seatTerminalNum"/>
<result column="self_gate_num" jdbcType="INTEGER" property="selfGateNum"/>
<result column="auto_take_num" jdbcType="INTEGER" property="autoTakeNum"/>

</resultMap>
<sql id="Base_Column_List">
id,
tree_id
manual_ticket_num
auto_ticket_num
uncash_ticket_num
enter_agm_num
out_agm_num
enter_ele_agm_num
out_ele_agm_num
column_agm_num
auto_agm_isone
self_gate_num
auto_take_num
</sql>


<select id="conditioningQuery" resultType="com.cars.ict.rbpsems.entity.TbTicketing">
select
<include refid="Base_Column_List"/>
from afc_gate_equipment
<!--where gate_no = #{id,jdbcType=VARCHAR} and gate_ipaddr = #{gateIpaddr,jdbcType=VARCHAR}-->
</select>

<update id="updateByPrimaryKeySelective" parameterType="com.cars.ict.rbpsems.entity.TbTicketing">
update afc_gate_equipment
<set>
<if test="infName != null">
inf_name = #{infName,jdbcType=VARCHAR},
</if>
<if test="innerCode != null">
innercode = #{innerCode,jdbcType=CHAR},
</if>
<if test="gateNo != null">
gate_no = #{gateNo,jdbcType=VARCHAR},
</if>
<if test="gateName != null">
gate_name = #{gateName,jdbcType=VARCHAR},
</if>
<if test="relaTreeId != null">
rela_tree_id = #{relaTreeId,jdbcType=VARCHAR},
</if>
<if test="checkType != null">
check_type = #{checkType,jdbcType=VARCHAR},
</if>
<if test="gateIpaddr != null">
gate_ipaddr = #{gateIpaddr,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>

<insert id="insertAFCInfo" parameterType="java.util.List">
insert into afc_gate_equipment (inf_name,rela_tree_id,innercode,check_type,
gate_ipaddr,gate_name,gate_no)
values
<foreach collection="afcGateEquipments" item="item" index="index" separator=",">
(#{item.infName,jdbcType=VARCHAR},#{item.relaTreeId,jdbcType=VARCHAR},
#{item.innerCode,jdbcType=VARCHAR},#{item.checkType,jdbcType=VARCHAR},
#{item.gateIpaddr,jdbcType=VARCHAR},#{item.gateName,jdbcType=VARCHAR},
#{item.gateNo,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>










<?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.cars.ict.rbpsems.mapper.TbBasetreeMapper">

<select id="getPersonList" resultType="com.cars.ict.rbpsems.entity.TbBasetree">
select * from tb_basetree
</select>

<insert id="save">
insert into tb_basetree (id, parent_id, title, field, info_mark, info_value, info_type, tree_state, create_time, update_time)
values (#{id}, #{parentId}, #{title}, #{field}, #{infoMark}, #{infoValue}, #{infoType}, #{treeState}, #{createTime}, #{updateTime})
</insert>

<update id="update">
update tb_basetree set title=#{title}, field=#{field}, info_mark=#{infoMark}, info_value=#{infoValue}, info_type=#{infoType},
tree_state=#{treeState}, create_time=#{createTime}, update_time=#{updateTime}
where id = #{id}
</update>

<delete id="delete">
delete from tb_basetree where id = #{id}
</delete>

<select id="findById" resultType="com.cars.ict.rbpsems.entity.TbBasetree">
select * from tb_basetree where id = #{id}
</select>

<select id="findByParentId" resultType="com.cars.ict.rbpsems.entity.TbBasetree">
select * from tb_basetree where parent_id = #{parentId}
</select>

<select id="getTreeState" resultType="com.cars.ict.rbpsems.entity.TbBasetree">
select * from tb_basetree where tree_state = "1"
</select>

<!-- <select id="selectList" resultType="com.cars.ict.rbpsems.entity.TbBasetree">-->
<!-- select * from tb_basetree-->
<!-- </select>-->

</mapper>
 

标签:语句,VARCHAR,sql,num,jdbcType,mybats,gate,tb,id
来源: https://www.cnblogs.com/sensenh/p/15823575.html