1.分页: <div class="pagination">${page }</div>
2.日历:onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
3.确认删除提示框:<a href="${ctx}/sys/onDuty2/delete?id=${onduty.id}" onclick="return confirm('确认要删除吗?')" class="btn btn-sm btn-primary">删除</a>
4.保存提示框:
1 function tijiao(){ 2 document.getElementById("updateForm").submit(); 3 /* layer.confirm("确认保存吗?", function(r) { 4 if(r){ 5 document.getElementById("updateForm").submit(); 6 } 7 layer.close(r); 8 }); */ 9 10 11 /* var msg=comfirm("确认保存?"); 12 if(msg==true){ 13 document.getElementById("updateForm").submit(); 14 }else{ 15 return false; 16 } */ 17 18 }
5.类A包含类B:在建表时,全部使用string类型,表A中只记录B的id。在建实体类时,在类A中使用String BId,String BName,通过查询将表B的信息记录在实体类中。而数据库中之保存id。
xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 3 <mapper namespace="com.thinkgem.jeesite.modules.business.monitor.dao.DeviceDao"> 4 5 <sql id="Base_Column_List"> 6 d.id, d.num, d.name, d.model, d.type, d.is_bind, d.binder_id, 7 u.name as BinderName, d.state, d.del_flag 8 </sql> 9 10 <sql id="Joins"> 11 LEFT JOIN sys_users u ON u.id = d.binder_id 12 </sql> 13 14 <!-- 查询单个 --> 15 <select id="selectById" parameterType="java.lang.String" resultType="Device"> 16 select 17 <include refid="Base_Column_List" /> 18 from mon_device 19 where id = #{id} 20 </select> 21 22 <!-- 查询全部/条件查询列表 --> 23 <select id="selectList" parameterType="Device" resultType="Device"> 24 select 25 <include refid="Base_Column_List" /> 26 FROM mon_Device d 27 <include refid="Joins"/> 28 <where> 29 <if test="num != null"> 30 d.num = #{num} 31 </if> 32 <if test="name != null"> 33 d.name = #{name} 34 </if> 35 <if test="model != null"> 36 d.model = #{model} 37 </if> 38 <if test="type != null"> 39 d.type = #{type} 40 </if> 41 <if test="isBind != null"> 42 d.is_bind = #{isBind} 43 </if> 44 <if test="binderId != null"> 45 d.binder_id = #{binderId}, 46 </if> 47 <if test="state != null"> 48 d.state = #{state} 49 </if> 50 <if test="1 != 0"> 51 AND d.del_flag = '0' 52 </if> 53 </where> 54 </select> 55 56 <!-- 添加 --> 57 <insert id="insert" parameterType="Device"> 58 insert into mon_device 59 <trim prefix="(" suffix=")" suffixOverrides=","> 60 <if test="id != null"> 61 id, 62 </if> 63 <if test="num != null"> 64 num, 65 </if> 66 <if test="name != null"> 67 name, 68 </if> 69 <if test="model != null"> 70 model, 71 </if> 72 <if test="type != null"> 73 type, 74 </if> 75 <if test="isBind != null"> 76 is_bind, 77 </if> 78 <if test="binderId != null"> 79 binder_id, 80 </if> 81 <if test="state != null"> 82 state, 83 </if> 84 <if test="createBy != null"> 85 create_by, 86 </if> 87 <if test="createDate != null"> 88 create_date, 89 </if> 90 <if test="updateBy != null"> 91 update_by, 92 </if> 93 <if test="updateDate != null"> 94 update_date, 95 </if> 96 <if test="delFlag != null"> 97 del_flag, 98 </if> 99 </trim> 100 <trim prefix="values (" suffix=")" suffixOverrides=","> 101 <if test="id != null"> 102 #{id}, 103 </if> 104 <if test="num != null"> 105 #{num}, 106 </if> 107 <if test="name != null"> 108 #{name}, 109 </if> 110 <if test="model != null"> 111 #{model}, 112 </if> 113 <if test="type != null"> 114 #{type}, 115 </if> 116 <if test="isBind != null"> 117 #{isBind}, 118 </if> 119 <if test="binderId != null"> 120 #{binderId}, 121 </if> 122 <if test="state != null"> 123 #{state}, 124 </if> 125 <if test="createBy != null"> 126 #{createBy.id}, 127 </if> 128 <if test="createDate != null"> 129 #{createDate}, 130 </if> 131 <if test="updateBy != null"> 132 #{updateBy.id}, 133 </if> 134 <if test="updateDate != null"> 135 #{updateDate}, 136 </if> 137 <if test="delFlag != null"> 138 #{delFlag}, 139 </if> 140 </trim> 141 </insert> 142 143 <!-- 修改 --> 144 <update id="update" parameterType="Device"> 145 update mon_device 146 <set> 147 <if test="num != null"> 148 num = #{num}, 149 </if> 150 <if test="name != null"> 151 name = #{name}, 152 </if> 153 <if test="model != null"> 154 model = #{model}, 155 </if> 156 <if test="type != null"> 157 type = #{type}, 158 </if> 159 <if test="isBind != null"> 160 is_bind = #{isBind}, 161 </if> 162 <if test="binderId != null"> 163 binder_id = #{binderId}, 164 </if> 165 <if test="state != null"> 166 state = #{state}, 167 </if> 168 <if test="createBy != null"> 169 create_by = #{createBy}, 170 </if> 171 <if test="createDate != null"> 172 create_date = #{createDate}, 173 </if> 174 <if test="updateBy != null"> 175 update_by = #{updateBy}, 176 </if> 177 <if test="updateDate != null"> 178 update_date = #{updateDate}, 179 </if> 180 <if test="delFlag != null"> 181 del_flag = #{delFlag}, 182 </if> 183 </set> 184 where id = #{id} 185 </update> 186 187 <!-- 删除 --> 188 <update id="deleteById" > 189 update mon_device set del_flag = '1' 190 where id = #{id } 191 </update> 192 193 </mapper>
1 类A包含类B