本文共 3841 字,大约阅读时间需要 12 分钟。
???????????????????????????????????????????????????????????
??????????????????????????????????SQL?????
SELECT a.id, a.title, a.content, a.canyuze, a.liexize, a.zhuchiren, b.name zhuchirenname, a.location, DATE_FORMAT(a.startTime, '%Y-%m-%d %H-%m-%s') startTime, DATE_FORMAT(a.endTime, '%Y-%m-%d %H-%m-%s') endTime, a.state, ( CASE WHEN a.state = 0 THEN '????' WHEN a.state = 1 THEN '??' WHEN a.state = 2 THEN '???' WHEN a.state = 3 THEN '??' WHEN a.state = 4 THEN '??' WHEN a.state = 5 THEN '???' WHEN a.state = 6 THEN '????' WHEN a.state = 7 THEN '????' ELSE '??' END ) AS meetingstate, a.seatPic, a.remark, a.auditor, c.name auditornameFROM t_oa_meeting_info aINNER JOIN t_oa_user b ON a.zhuchiren = b.idLEFT JOIN t_oa_user c ON a.auditor = c.idWHERE 1 = 1
????????????????????????????????????????????CASE??????????????????????????????
?????MeetingInfoDao??????????? CRUD ??????????????
public int add(MeetingInfo t) throws Exception { String sql = "insert into t_oa_meeting_info(...) values(?)"; return super.executeUpdate(sql, t, new String[] { ... });}private String getSQL() { return "SELECT ... FROM t_oa_meeting_info a ...";}public List myInfos(MeetingInfo info, PageBean pageBean) throws Exception { String sql = getSQL(); // ?????????? return super.executeQuery(sql, pageBean);} ????????????????????
add???????????????????updatezt???????ID???????myInfos?????????????????????Layui????????????????
?????myMeeting.js?????????????????
layui.use(['layer', 'table', 'jquery'], function() { let table = layui.table; initTable(); $('#btn_search').click(query);});function initTable() { table.render({ elem: '#tb', cols: [ {field: 'id', title: '????', width: 90}, {field: 'title', title: '????', width: 120}, {field: 'location', title: '????', width: 140}, {field: 'startTime', title: '????', width: 120}, {field: 'endTime', title: '????', width: 120}, {field: 'meetingState', title: '????', width: 120}, {field: 'seatPic', title: '????', width: 120, template: function(d) { ... }}, {field: 'auditName', title: '???', width: 120}, {field: '', title: '??', width: 200, toolbar: '#tbar'}, ]; });}function query() { table.reload('tb', { url: '${ctx}/info.action', method: 'POST', where: { 'methodName': 'myInfos', 'title': $('#title').val(), 'zhuchiren': $('#zhuchiren').val() } });} ???????????????????
updatezt??????????0???????????????????????????????????????????
??uploads???????????
?resource.properties??????????????
dirPath=E:/T280/images/serverPath=/test_layui/upload/paizuo/dirPathSign=E:/T280/images/layui/serverPathSign=/test_layui/upload/sign/
??????????????????????????
????updatezt?????????????????????????
public int updatezt(MeetingInfo m) throws Exception { String sql = "update t_oa_meeting_info set state=? where id = ?"; return super.executeUpdate(sql, m, new String[] {"state", "id"});} ??????????????????????????????0??????????
?????????????????????Java???????????????????????????????????????????????????????????????????????????????????
转载地址:http://wynfk.baihongyu.com/