xml跟sql尋找,xmlsql尋找

來源:互聯網
上載者:User

xml跟sql尋找,xmlsql尋找

xml小白筆記 。。。。。。。

 

 <sql id="wDishesColumns">         a.id AS "id",        a.pid AS "pid",        a.name AS "name",        a.photo AS "photo",        a.price AS "price",        a.classification AS "classification",        a.create_by AS "createBy.id",        a.create_date AS "createDate",        a.update_by AS "updateBy.id",        a.update_date AS "updateDate",        a.remarks AS "remarks",        a.del_flag AS "delFlag",        b.name AS "wFoodClassification.name"    </sql>             <sql id="wDishesJoins">    LEFT JOIN w_food_classification b ON b.id=a.pid     </sql>

 

left join 關聯查詢  關聯欄位  需要尋找什麼就在sql裡面列出來 在擷取

xml 跟dao 跟service 跟entity 跟controller 一個方法對應一個方法

 

 

<div class="control-group">            <label class="control-label">照片:</label>            <div class="controls">                <!--<form:input path="photo" htmlEscape="false" maxlength="64" class="input-xlarge "/>-->                <form:hidden id="nameImage" path="photo" htmlEscape="false" maxlength="255" class="input-xlarge"/>                <sys:ckfinder input="nameImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>            </div>        </div>

從伺服器裡添加照片代碼

  

  <c:forEach items="${page.list}" var="wDishes">            <tr>                <td><a href="${ctx}/dis/wDishes/form?id=${wDishes.id}">                    ${wDishes.name}                </a></td>                <td>                    <img src="${wDishes.photo}" height="100" width="100"/>                 </td>                <td>                    ${wDishes.price}                </td>                <td>                     ${wDishes.wFoodClassification.name}                                     </td>                <td>                    <fmt:formatDate value="${wDishes.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>                </td>                <td>                    ${wDishes.remarks}                </td>                <shiro:hasPermission name="dis:wDishes:edit"><td>                    <a href="${ctx}/dis/wDishes/form?id=${wDishes.id}">修改</a>                    <a href="${ctx}/dis/wDishes/delete?id=${wDishes.id}" onclick="return confirmx('確認要刪除該菜名嗎?', this.href)">刪除</a>                </td></shiro:hasPermission>            </tr>        </c:forEach>

 foreach 裡面顯示的屬性 可以自己修改需要什麼取出來

<div class="control-group">            <label class="control-label">分類:</label>            <div class="controls">              <form:select path="wFoodClassification.id" class="input-xxlarge">                     <form:options items="${find}"  itemLabel="name" itemValue="id" htmlEscape="false"/>                              </form:select>            </div>        </div>

擷取items  用下拉框格式顯示出來

 

 

 <form:form id="searchForm" modelAttribute="wDishes" action="${ctx}/dis/wDishes/" method="post" class="breadcrumb form-search">        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>          <ul class="ul-form">            <li><label>名字:</label>                <form:input path="name" htmlEscape="false" maxlength="10" class="input-medium"/>            </li>            <li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查詢"/></li>            <li class="clearfix"></li>        </ul>      </form:form>

jeesite自動產生的查詢有錯誤的話  是controller方法裡面沒有取出來

 

在controller裡面model取出來就好了

@RequiresPermissions("dis:wDishes:view")    @RequestMapping(value = {"list", ""})    public String list(WDishes wDishes, HttpServletRequest request, HttpServletResponse response, Model model) {        Page<WDishes> page = wDishesService.findPage(new Page<WDishes>(request, response), wDishes);         model.addAttribute("page", page);        model.addAttribute("wDishes", new WDishes());        return "modules/dis/wDishesList";    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.