| @@ -39,14 +39,13 @@ public class WxBusinessController extends BaseController { | |||
| final PageInfo<WxBusiness> page = wxBusinessService.listAsPage(wxBusiness, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("业态全列表接口") | |||
| @GetMapping("allist") | |||
| @SystemControllerLog(description = "业态-全列表") | |||
| public ResultData getAllList() { | |||
| public ResultData listAll() { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||
| WxBusiness wxBusiness = new WxBusiness(); | |||
| final List<WxBusiness> busList = wxBusinessService.getList(wxBusiness); | |||
| final List<WxBusiness> busList = wxBusinessService.findListAll(); | |||
| return new ResultData(busList); | |||
| } | |||
| @@ -43,9 +43,8 @@ public class WxBusinessController extends BaseController { | |||
| @ApiOperation("业态全列表接口") | |||
| @GetMapping("allist") | |||
| public ResultData getAllList(@ModelAttribute WxBusiness wxBusiness) { | |||
| if (null == wxBusiness) wxBusiness = new WxBusiness(); | |||
| final List<WxBusiness> busList = wxBusinessService.getList(wxBusiness); | |||
| public ResultData listAll(@ModelAttribute WxBusiness wxBusiness) { | |||
| final List<WxBusiness> busList = wxBusinessService.findListAll(); | |||
| return new ResultData(busList); | |||
| } | |||
| } | |||
| @@ -0,0 +1,163 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_sub_business") | |||
| public class WxSubBusiness implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Integer id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Integer getId() { | |||
| return id; | |||
| } | |||
| public void setId(Integer id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /*子业态名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="子业态名",name="title") | |||
| private String title; | |||
| /*业态ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="业态ID",name="businessId") | |||
| private Integer businessId; | |||
| /*业态名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="业态名",name="businessTitle") | |||
| private String businessTitle; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public Integer getBusinessId() { | |||
| return businessId; | |||
| } | |||
| public void setBusinessId(Integer businessId) { | |||
| this.businessId = businessId; | |||
| } | |||
| public String getBusinessTitle() { | |||
| return businessTitle; | |||
| } | |||
| public void setBusinessTitle(String businessTitle) { | |||
| this.businessTitle = businessTitle; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,BusinessId_ASC("`business_id` ASC"),BusinessId_DESC("`business_id` DESC") | |||
| ,BusinessTitle_ASC("`business_title` ASC"),BusinessTitle_DESC("`business_title` DESC") | |||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -7,10 +7,7 @@ import com.iformall.domain.po.WxBusiness; | |||
| public interface WxBusinessMapper extends CommonMapper<WxBusiness, String> { | |||
| List<WxBusiness> findList(WxBusiness wxBusiness); | |||
| List<WxBusiness> findListAll(); | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxSubBusiness; | |||
| import java.util.List; | |||
| public interface WxSubBusinessMapper extends CommonMapper<WxSubBusiness, String> { | |||
| List<WxSubBusiness> findList(WxSubBusiness wxSubBusiness); | |||
| List<WxSubBusiness> findListAll(); | |||
| } | |||
| @@ -23,7 +23,14 @@ public interface WxBusinessService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxBusiness> getList(WxBusiness record); | |||
| List<WxBusiness> findList(WxBusiness record); | |||
| /** | |||
| * 查询全部列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<WxBusiness> findListAll(); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxSubBusiness; | |||
| import java.util.List; | |||
| public interface WxSubBusinessService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxSubBusiness> listAsPage(WxSubBusiness record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxSubBusiness> findList(WxSubBusiness record); | |||
| /** | |||
| * 查询全部列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<WxSubBusiness> findListAll(); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxSubBusiness getById(Integer id); | |||
| } | |||
| @@ -25,10 +25,16 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||
| } | |||
| @Override | |||
| public List<WxBusiness> getList(WxBusiness record) { | |||
| public List<WxBusiness> findList(WxBusiness record) { | |||
| return wxBusinessMapper.findList(record); | |||
| } | |||
| @Override | |||
| public List<WxBusiness> findListAll() { | |||
| return wxBusinessMapper.findListAll(); | |||
| } | |||
| @Override | |||
| public WxBusiness getById(Integer id) { | |||
| return wxBusinessMapper.selectByPrimaryKey(id); | |||
| @@ -0,0 +1,47 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxBusiness; | |||
| import com.iformall.domain.po.WxSubBusiness; | |||
| import com.iformall.mapper.WxBusinessMapper; | |||
| import com.iformall.mapper.WxSubBusinessMapper; | |||
| import com.iformall.service.WxBusinessService; | |||
| import com.iformall.service.WxSubBusinessService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxSubBusinessServiceImpl implements WxSubBusinessService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxSubBusinessMapper wxSubBusinessMapper; | |||
| @Override | |||
| public PageInfo<WxSubBusiness> listAsPage(WxSubBusiness record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxSubBusinessMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxSubBusiness> findList(WxSubBusiness record) { | |||
| return wxSubBusinessMapper.findList(record); | |||
| } | |||
| @Override | |||
| public List<WxSubBusiness> findListAll() { | |||
| return wxSubBusinessMapper.findListAll(); | |||
| } | |||
| @Override | |||
| public WxSubBusiness getById(Integer id) { | |||
| return wxSubBusinessMapper.selectByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -48,7 +48,11 @@ | |||
| select <include refid="allColumns" /> from wx_business | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findListAll" parameterType="com.iformall.domain.po.WxBusiness" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_business | |||
| order by create_date asc | |||
| </select> | |||
| @@ -0,0 +1,62 @@ | |||
| <?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.iformall.mapper.WxSubBusinessMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxSubBusiness"> | |||
| <id column="id" jdbcType="INTEGER" property="id" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="business_id" jdbcType="INTEGER" property="businessId" /> | |||
| <result column="business_title" jdbcType="VARCHAR" property="businessTitle" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`title`,`business_id`,`business_title`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != businessId "> | |||
| and `business_id` = #{businessId} | |||
| </if> | |||
| <if test=" null != businessTitle "> | |||
| and `business_title` like concat('%', #{businessTitle},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxSubBusiness" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_sub_business | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findListAll" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_sub_business | |||
| order by create_date asc | |||
| </select> | |||
| </mapper> | |||