Commit 06b43743 by xiaoyj

设备信息

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21576 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent b483a72b
package com.glsx.ordercenter.controller;
import com.glsx.common.annotation.AuthCheck;
import com.glsx.common.constants.ResultObject;
import com.glsx.common.utils.Page;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.pojo.SysDevice;
import com.glsx.ordercenter.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author xiaoyj
* @ClassName: DeviceCtroller
* @Description: TODO(这里用一句话描述这个类的作用)
* @date 2019年6月3日
*/
@RestController
@AuthCheck
@RequestMapping("/device")
public class DeviceCtroller {
@Autowired
private DeviceService deviceService;
/**
* 订货单的设备清单
* @param request
* @param indentNo
* @return
*/
@RequestMapping(value = "/indentDevices", method = RequestMethod.POST)
public ResultObject indentDevices(HttpServletRequest request,@RequestParam(defaultValue = "1") int pageIndex,
@RequestParam(defaultValue = "10") int pageSize, String indentNo) {
if (org.springframework.util.StringUtils.isEmpty(indentNo)) {
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
}
Page page = new Page(pageIndex, pageSize);
List<SysDevice> list=deviceService.catIndentDevices(indentNo,page);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg(),list);
}
}
package com.glsx.ordercenter.mapper;
import com.glsx.ordercenter.pojo.SysDevice;
import java.util.List;
public interface SysDeviceMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysDevice record);
int insertSelective(SysDevice record);
SysDevice selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysDevice record);
int updateByPrimaryKey(SysDevice record);
List<SysDevice> catIndentDevices(String indentNo);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.ordercenter.pojo;
import java.util.Date;
public class SysDevice {
private Integer id;
private String deviceType;
private String deviceNo;
private Integer deviceStatus;
private Integer userId;
private String indentNo;
private Date stockTime;
private String remark;
private Date createTime;
private Integer createBy;
private Date updateTime;
private Integer updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType == null ? null : deviceType.trim();
}
public String getDeviceNo() {
return deviceNo;
}
public void setDeviceNo(String deviceNo) {
this.deviceNo = deviceNo == null ? null : deviceNo.trim();
}
public Integer getDeviceStatus() {
return deviceStatus;
}
public void setDeviceStatus(Integer deviceStatus) {
this.deviceStatus = deviceStatus;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getIndentNo() {
return indentNo;
}
public void setIndentNo(String indentNo) {
this.indentNo = indentNo == null ? null : indentNo.trim();
}
public Date getStockTime() {
return stockTime;
}
public void setStockTime(Date stockTime) {
this.stockTime = stockTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getCreateBy() {
return createBy;
}
public void setCreateBy(Integer createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Integer updateBy) {
this.updateBy = updateBy;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.ordercenter.service;
import com.glsx.common.utils.Page;
import com.glsx.ordercenter.pojo.SysDevice;
import java.util.List;
public interface DeviceService {
List<SysDevice> catIndentDevices(String indentNo, Page page);
}
package com.glsx.ordercenter.service.impl;
import com.github.pagehelper.PageHelper;
import com.glsx.common.utils.Page;
import com.glsx.ordercenter.mapper.SysDeviceMapper;
import com.glsx.ordercenter.pojo.SysDevice;
import com.glsx.ordercenter.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class DeviceServiceImpl implements DeviceService {
@Autowired
private SysDeviceMapper sysDeviceMapper;
@Override
public List<SysDevice> catIndentDevices(String indentNo, Page page) {
if (page != null) {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
}
return sysDeviceMapper.catIndentDevices(indentNo);
}
}
<?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.glsx.ordercenter.mapper.SysDeviceMapper" >
<resultMap id="BaseResultMap" type="com.glsx.ordercenter.pojo.SysDevice" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="device_type" property="deviceType" jdbcType="VARCHAR" />
<result column="device_no" property="deviceNo" jdbcType="VARCHAR" />
<result column="device_status" property="deviceStatus" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="indent_no" property="indentNo" jdbcType="VARCHAR" />
<result column="stock_time" property="stockTime" jdbcType="TIMESTAMP" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="create_by" property="createBy" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="update_by" property="updateBy" jdbcType="INTEGER" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, device_type, device_no, device_status, user_id, indent_no, stock_time, remark,
create_time, create_by, update_time, update_by
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from sys_device
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from sys_device
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glsx.ordercenter.pojo.SysDevice" >
insert into sys_device (id, device_type, device_no,
device_status, user_id, indent_no,
stock_time, remark, create_time,
create_by, update_time, update_by
)
values (#{id,jdbcType=INTEGER}, #{deviceType,jdbcType=VARCHAR}, #{deviceNo,jdbcType=VARCHAR},
#{deviceStatus,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{indentNo,jdbcType=VARCHAR},
#{stockTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.glsx.ordercenter.pojo.SysDevice" >
insert into sys_device
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="deviceType != null" >
device_type,
</if>
<if test="deviceNo != null" >
device_no,
</if>
<if test="deviceStatus != null" >
device_status,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="indentNo != null" >
indent_no,
</if>
<if test="stockTime != null" >
stock_time,
</if>
<if test="remark != null" >
remark,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="createBy != null" >
create_by,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="updateBy != null" >
update_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="deviceType != null" >
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="deviceNo != null" >
#{deviceNo,jdbcType=VARCHAR},
</if>
<if test="deviceStatus != null" >
#{deviceStatus,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="indentNo != null" >
#{indentNo,jdbcType=VARCHAR},
</if>
<if test="stockTime != null" >
#{stockTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null" >
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null" >
#{createBy,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null" >
#{updateBy,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xyj.generator.pojo.SysDevice" >
update sys_device
<set >
<if test="deviceType != null" >
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="deviceNo != null" >
device_no = #{deviceNo,jdbcType=VARCHAR},
</if>
<if test="deviceStatus != null" >
device_status = #{deviceStatus,jdbcType=INTEGER},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="indentNo != null" >
indent_no = #{indentNo,jdbcType=VARCHAR},
</if>
<if test="stockTime != null" >
stock_time = #{stockTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null" >
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null" >
update_by = #{updateBy,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.ordercenter.pojo.SysDevice" >
update sys_device
set device_type = #{deviceType,jdbcType=VARCHAR},
device_no = #{deviceNo,jdbcType=VARCHAR},
device_status = #{deviceStatus,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
indent_no = #{indentNo,jdbcType=VARCHAR},
stock_time = #{stockTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="catIndentDevices" resultMap="BaseResultMap">
SELECT
sdd.data_value AS deviceType,
d.deviceNo
FROM
sys_device sd
INNER JOIN sys_dict_data sdd ON sd.device_type = sdd.dict_type
WHERE
sd.indent_no = #{indentNo]
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!